From a04d39bc52b6a03b5feb1c263a71d564e0fe5fe1 Mon Sep 17 00:00:00 2001 From: Gregory Burd Date: Sat, 10 Mar 2007 20:04:07 +0100 Subject: [PATCH] Initial import. --- LICENSE | 339 + LICENSE_EXCEPTIONS | 109 + README | 46 + dist/Makefile.in | 486 + dist/RELEASE | 31 + dist/aclocal/config.ac | 26 + dist/aclocal/cxx.ac | 17 + dist/aclocal/gcc.ac | 36 + dist/aclocal/libtool.ac | 5867 +++ dist/aclocal/options.ac | 255 + dist/aclocal/programs.ac | 118 + dist/aclocal/readline.ac | 47 + dist/aclocal/sosuffix.ac | 76 + dist/aclocal/tcl.ac | 128 + dist/aclocal/types.ac | 130 + dist/buildrel | 138 + dist/config.guess | 1410 + dist/config.hin | 223 + dist/config.sub | 1508 + dist/configure | 33132 ++++++++++++++++ dist/configure.ac | 530 + dist/dbsql.pc.in | 33 + dist/dbsql.spec.in | 55 + dist/dot-gdbinit | 39 + dist/gen_inc.awk | 67 + dist/install-sh | 251 + dist/ltmain.sh | 6290 +++ dist/s_all | 33 + dist/s_config | 54 + dist/s_include | 109 + dist/s_perm | 49 + dist/s_readme | 86 + dist/s_symlink | 44 + dist/s_tags | 52 + dist/s_test | 104 + dist/splint.rc | 5 + dist/sqlconf | 61 + dist/srcfiles.in | 86 + dist/win_config.in | 418 + dist/win_dbsql.in | 60 + dist/win_exports.in | 136 + docs_src/dbsql.1 | 203 + docs_src/lemon.html | 892 + src/TODO | 141 + src/api.c | 1492 + src/api_table.c | 279 + src/cg_attach.c | 394 + src/cg_auth.c | 285 + src/cg_build.c | 2797 ++ src/cg_copy.c | 154 + src/cg_date.c | 1052 + src/cg_delete.c | 500 + src/cg_expr.c | 1980 + src/cg_insert.c | 1072 + src/cg_pragma.c | 397 + src/cg_select.c | 2975 ++ src/cg_trigger.c | 978 + src/cg_update.c | 531 + src/cg_vacuum.c | 86 + src/cg_where.c | 1450 + src/clib/getopt.c | 213 + src/clib/memcmp.c | 128 + src/clib/random.c | 241 + src/clib/snprintf.c | 159 + src/clib/strcasecmp.c | 155 + src/clib/strdup.c | 112 + src/clib/xvprintf.c | 845 + src/common/dbsql_alloc.c | 179 + src/common/dbsql_atof.c | 107 + src/common/dbsql_atoi.c | 56 + src/common/dbsql_err.c | 469 + src/common/hash.c | 592 + src/common/str.c | 892 + src/dbsql.in | 434 + src/dbsql/dbsql.c | 1517 + src/dbsql_tclsh.c | 106 + src/inc/clib_ext.h | 41 + src/inc/common_ext.h | 49 + src/inc/db_int.h | 53 + src/inc/dbsql_ext.h | 198 + src/inc/dbsql_int.in | 1019 + src/inc/debug.h | 126 + src/inc/globals.h | 27 + src/inc/hash.h | 189 + src/inc/os_ext.h | 14 + src/inc/queue.h | 564 + src/inc/random.h | 33 + src/inc/str.h | 111 + src/inc/vdbe.h | 88 + src/inc/vdbe_int.h | 303 + src/inc/xvprintf.h | 54 + src/lemon/lemon.c | 4379 ++ src/lemon/lempar.c | 688 + src/os/os_jtime.c | 78 + src/py/LICENSE | 25 + src/py/MANIFEST.in | 9 + src/py/Makefile | 4 + src/py/README | 7 + src/py/benchmarks/fetch.py | 118 + src/py/benchmarks/insert.py | 61 + src/py/doc/code/adapter_datetime.py | 14 + src/py/doc/code/adapter_point_1.py | 16 + src/py/doc/code/adapter_point_2.py | 17 + src/py/doc/code/authorizer.py | 26 + src/py/doc/code/collation_reverse.py | 15 + src/py/doc/code/complete_statement.py | 30 + src/py/doc/code/connect_db_1.py | 3 + src/py/doc/code/connect_db_2.py | 3 + src/py/doc/code/converter_point.py | 47 + src/py/doc/code/countcursors.py | 15 + src/py/doc/code/createdb.py | 28 + src/py/doc/code/execsql_fetchonerow.py | 17 + src/py/doc/code/execsql_printall_1.py | 13 + src/py/doc/code/execute_1.py | 11 + src/py/doc/code/execute_2.py | 12 + src/py/doc/code/execute_3.py | 12 + src/py/doc/code/executemany_1.py | 24 + src/py/doc/code/executemany_2.py | 15 + src/py/doc/code/executescript.py | 24 + src/py/doc/code/insert_more_people.py | 16 + src/py/doc/code/md5func.py | 11 + src/py/doc/code/mysumaggr.py | 20 + src/py/doc/code/parse_colnames.py | 8 + src/py/doc/code/pysqlite_datetime.py | 20 + src/py/doc/code/row_factory.py | 13 + src/py/doc/code/rowclass.py | 12 + src/py/doc/code/shared_cache.py | 6 + src/py/doc/code/shortcut_methods.py | 21 + src/py/doc/code/simple_tableprinter.py | 26 + src/py/doc/code/text_factory.py | 42 + src/py/doc/default.css | 10 + src/py/doc/docutils.css | 260 + src/py/doc/install-source-win32.txt | 169 + src/py/doc/install-source.txt | 148 + .../pydbsql-introduction.odp | Bin 0 -> 16742 bytes .../pydbsql-introduction.pdf | Bin 0 -> 165301 bytes src/py/doc/silvercity.css | 542 + src/py/doc/usage-guide.txt | 910 + src/py/docutilsupport.py | 81 + src/py/extended_setup.py | 96 + src/py/ez_setup.py | 221 + src/py/misc/Makefile | 55 + src/py/misc/lru.py | 146 + src/py/pydbsql/__init__.py | 39 + src/py/pydbsql/dbapi2.py | 108 + src/py/pydbsql/test/__init__.py | 36 + src/py/pydbsql/test/dbapi.py | 751 + src/py/pydbsql/test/factory.py | 204 + src/py/pydbsql/test/hooks.py | 136 + src/py/pydbsql/test/regression.py | 110 + src/py/pydbsql/test/transactions.py | 175 + src/py/pydbsql/test/types.py | 389 + src/py/pydbsql/test/userfunctions.py | 431 + src/py/scripts/stress.py | 80 + src/py/scripts/test-pydbsql | 3 + src/py/setup.cfg | 5 + src/py/setup.py.in | 194 + src/py/src/cache.c | 397 + src/py/src/cache.h | 95 + src/py/src/connection.c | 1325 + src/py/src/connection.h | 150 + src/py/src/cursor.c | 1091 + src/py/src/cursor.h | 93 + src/py/src/dbsqlcompat.h | 58 + src/py/src/microprotocols.c | 166 + src/py/src/microprotocols.h | 83 + src/py/src/module.c | 422 + src/py/src/module.h | 79 + src/py/src/prepare_protocol.c | 106 + src/py/src/prepare_protocol.h | 63 + src/py/src/row.c | 255 + src/py/src/row.h | 61 + src/py/src/statement.c | 457 + src/py/src/statement.h | 81 + src/py/src/util.c | 115 + src/py/src/util.h | 60 + src/py/win32env.cmd | 6 + src/safety.c | 104 + src/sm.c | 1494 + src/sql_fns.c | 809 + src/sql_parser.y | 901 + src/sql_tokenize.c | 791 + src/vdbe.c | 5002 +++ src/vdbe_method.c | 1393 + test/README | 139 + test/scr001/chk.code | 38 + test/scr002/chk.def | 64 + test/scr003/chk.define | 51 + test/scr005/chk.nl | 114 + test/scr006/chk.offt | 25 + test/scr007/chk.proto | 35 + test/scr008/chk.pubdef | 101 + test/scr009/chk.srcfiles | 36 + test/scr010/chk.str | 42 + test/scr010/spell.ok | 852 + test/scr011/chk.tags | 34 + test/scr013/chk.stats | 120 + test/scr014/chk.err | 34 + test/scr018/chk.comma | 34 + test/scr018/t.c | 46 + test/scr019/chk.include | 37 + test/scr020/chk.inc | 42 + test/scr021/chk.flags | 118 + test/scr021/t.c | 69 + test/scr022/chk.rr | 29 + test/scr026/chk.method | 93 + test/scr030/chk.build | 87 + test/scr050/Makefile | 174 + test/scr050/Makefile.in | 174 + test/scr050/crashtest1.c | 96 + test/scr050/dbsql_tclsh.c | 103 + test/scr050/s_include | 88 + test/scr050/tcl_dbsql.c | 1202 + test/scr050/tcl_dbsql.h | 60 + test/scr050/tcl_ext.h | 24 + test/scr050/tcl_internal.c | 234 + test/scr050/tcl_md5.c | 424 + test/scr050/tcl_printf.c | 1171 + test/scr050/tcl_randstr.c | 53 + test/scr050/tcl_sql_funcs.c | 68 + test/scr050/tcl_threads.c | 587 + test/scr050/tester.tcl | 242 + test/scr050/tests/all.test | 109 + test/scr050/tests/attach.test | 582 + test/scr050/tests/attach2.test | 146 + test/scr050/tests/auth.test | 1892 + test/scr050/tests/bigfile.test_ | 177 + test/scr050/tests/bigrow.test | 215 + test/scr050/tests/bind.test | 72 + test/scr050/tests/capi2.test | 475 + test/scr050/tests/conflict.test | 694 + test/scr050/tests/copy.test | 264 + test/scr050/tests/date.test | 205 + test/scr050/tests/delete.test | 291 + test/scr050/tests/expr.test | 517 + test/scr050/tests/fkey1.test | 53 + test/scr050/tests/func.test | 340 + test/scr050/tests/hook.test | 83 + test/scr050/tests/in.test | 303 + test/scr050/tests/index.test | 518 + test/scr050/tests/insert.test | 286 + test/scr050/tests/insert2.test | 194 + test/scr050/tests/interrupt.test_ | 77 + test/scr050/tests/intpkey.test | 487 + test/scr050/tests/ioerr.test_ | 120 + test/scr050/tests/join.test | 393 + test/scr050/tests/join2.test | 73 + test/scr050/tests/limit.test | 296 + test/scr050/tests/lock.test | 346 + test/scr050/tests/main.test | 297 + test/scr050/tests/malloc.test | 225 + test/scr050/tests/memdb.test | 396 + test/scr050/tests/memleak.test | 83 + test/scr050/tests/minmax.test | 240 + test/scr050/tests/misc1.test | 540 + test/scr050/tests/misc2.test | 235 + test/scr050/tests/misc3.test | 211 + test/scr050/tests/misuse.test | 166 + test/scr050/tests/notnull.test | 500 + test/scr050/tests/null.test | 236 + test/scr050/tests/pager.test | 409 + test/scr050/tests/pragma.test | 269 + test/scr050/tests/printf.test | 116 + test/scr050/tests/progress.test | 118 + test/scr050/tests/quick.test | 44 + test/scr050/tests/quote.test | 88 + test/scr050/tests/rowid.test | 633 + test/scr050/tests/select1.test | 736 + test/scr050/tests/select2.test | 162 + test/scr050/tests/select3.test | 225 + test/scr050/tests/select4.test | 495 + test/scr050/tests/select5.test | 119 + test/scr050/tests/select6.test | 435 + test/scr050/tests/sort.test | 361 + test/scr050/tests/subselect.test | 155 + test/scr050/tests/table.test | 503 + test/scr050/tests/tableapi.test | 201 + test/scr050/tests/tclsqlite.test | 118 + test/scr050/tests/temptable.test | 399 + test/scr050/tests/thread1.test | 158 + test/scr050/tests/trans.test | 901 + test/scr050/tests/trigger1.test | 395 + test/scr050/tests/trigger2.test | 718 + test/scr050/tests/trigger3.test | 166 + test/scr050/tests/trigger4.test | 127 + test/scr050/tests/unique.test | 232 + test/scr050/tests/update.test | 501 + test/scr050/tests/vacuum.test | 176 + test/scr050/tests/view.test | 389 + test/scr050/tests/where.test | 742 + test/smoke.sql | 18 + test/smoke2.sql | 12 + test/smoke3.sql | 28 + test/smoke4.sql | 15 + test/test.tcl | 449 + test/testparams.tcl | 63 + test/testutils.tcl | 2567 ++ 297 files changed, 138798 insertions(+) create mode 100644 LICENSE create mode 100644 LICENSE_EXCEPTIONS create mode 100644 README create mode 100644 dist/Makefile.in create mode 100644 dist/RELEASE create mode 100644 dist/aclocal/config.ac create mode 100644 dist/aclocal/cxx.ac create mode 100644 dist/aclocal/gcc.ac create mode 100644 dist/aclocal/libtool.ac create mode 100644 dist/aclocal/options.ac create mode 100644 dist/aclocal/programs.ac create mode 100644 dist/aclocal/readline.ac create mode 100644 dist/aclocal/sosuffix.ac create mode 100644 dist/aclocal/tcl.ac create mode 100644 dist/aclocal/types.ac create mode 100644 dist/buildrel create mode 100644 dist/config.guess create mode 100644 dist/config.hin create mode 100644 dist/config.sub create mode 100644 dist/configure create mode 100644 dist/configure.ac create mode 100644 dist/dbsql.pc.in create mode 100644 dist/dbsql.spec.in create mode 100644 dist/dot-gdbinit create mode 100644 dist/gen_inc.awk create mode 100644 dist/install-sh create mode 100644 dist/ltmain.sh create mode 100644 dist/s_all create mode 100644 dist/s_config create mode 100644 dist/s_include create mode 100644 dist/s_perm create mode 100644 dist/s_readme create mode 100644 dist/s_symlink create mode 100644 dist/s_tags create mode 100644 dist/s_test create mode 100644 dist/splint.rc create mode 100644 dist/sqlconf create mode 100644 dist/srcfiles.in create mode 100644 dist/win_config.in create mode 100644 dist/win_dbsql.in create mode 100644 dist/win_exports.in create mode 100644 docs_src/dbsql.1 create mode 100644 docs_src/lemon.html create mode 100644 src/TODO create mode 100644 src/api.c create mode 100644 src/api_table.c create mode 100644 src/cg_attach.c create mode 100644 src/cg_auth.c create mode 100644 src/cg_build.c create mode 100644 src/cg_copy.c create mode 100644 src/cg_date.c create mode 100644 src/cg_delete.c create mode 100644 src/cg_expr.c create mode 100644 src/cg_insert.c create mode 100644 src/cg_pragma.c create mode 100644 src/cg_select.c create mode 100644 src/cg_trigger.c create mode 100644 src/cg_update.c create mode 100644 src/cg_vacuum.c create mode 100644 src/cg_where.c create mode 100644 src/clib/getopt.c create mode 100644 src/clib/memcmp.c create mode 100644 src/clib/random.c create mode 100644 src/clib/snprintf.c create mode 100644 src/clib/strcasecmp.c create mode 100644 src/clib/strdup.c create mode 100644 src/clib/xvprintf.c create mode 100644 src/common/dbsql_alloc.c create mode 100644 src/common/dbsql_atof.c create mode 100644 src/common/dbsql_atoi.c create mode 100644 src/common/dbsql_err.c create mode 100644 src/common/hash.c create mode 100644 src/common/str.c create mode 100644 src/dbsql.in create mode 100644 src/dbsql/dbsql.c create mode 100644 src/dbsql_tclsh.c create mode 100644 src/inc/clib_ext.h create mode 100644 src/inc/common_ext.h create mode 100644 src/inc/db_int.h create mode 100644 src/inc/dbsql_ext.h create mode 100644 src/inc/dbsql_int.in create mode 100644 src/inc/debug.h create mode 100644 src/inc/globals.h create mode 100644 src/inc/hash.h create mode 100644 src/inc/os_ext.h create mode 100644 src/inc/queue.h create mode 100644 src/inc/random.h create mode 100644 src/inc/str.h create mode 100644 src/inc/vdbe.h create mode 100644 src/inc/vdbe_int.h create mode 100644 src/inc/xvprintf.h create mode 100644 src/lemon/lemon.c create mode 100644 src/lemon/lempar.c create mode 100644 src/os/os_jtime.c create mode 100644 src/py/LICENSE create mode 100644 src/py/MANIFEST.in create mode 100644 src/py/Makefile create mode 100644 src/py/README create mode 100644 src/py/benchmarks/fetch.py create mode 100644 src/py/benchmarks/insert.py create mode 100644 src/py/doc/code/adapter_datetime.py create mode 100644 src/py/doc/code/adapter_point_1.py create mode 100644 src/py/doc/code/adapter_point_2.py create mode 100644 src/py/doc/code/authorizer.py create mode 100644 src/py/doc/code/collation_reverse.py create mode 100644 src/py/doc/code/complete_statement.py create mode 100644 src/py/doc/code/connect_db_1.py create mode 100644 src/py/doc/code/connect_db_2.py create mode 100644 src/py/doc/code/converter_point.py create mode 100644 src/py/doc/code/countcursors.py create mode 100644 src/py/doc/code/createdb.py create mode 100644 src/py/doc/code/execsql_fetchonerow.py create mode 100644 src/py/doc/code/execsql_printall_1.py create mode 100644 src/py/doc/code/execute_1.py create mode 100644 src/py/doc/code/execute_2.py create mode 100644 src/py/doc/code/execute_3.py create mode 100644 src/py/doc/code/executemany_1.py create mode 100644 src/py/doc/code/executemany_2.py create mode 100644 src/py/doc/code/executescript.py create mode 100644 src/py/doc/code/insert_more_people.py create mode 100644 src/py/doc/code/md5func.py create mode 100644 src/py/doc/code/mysumaggr.py create mode 100644 src/py/doc/code/parse_colnames.py create mode 100644 src/py/doc/code/pysqlite_datetime.py create mode 100644 src/py/doc/code/row_factory.py create mode 100644 src/py/doc/code/rowclass.py create mode 100644 src/py/doc/code/shared_cache.py create mode 100644 src/py/doc/code/shortcut_methods.py create mode 100644 src/py/doc/code/simple_tableprinter.py create mode 100644 src/py/doc/code/text_factory.py create mode 100644 src/py/doc/default.css create mode 100644 src/py/doc/docutils.css create mode 100644 src/py/doc/install-source-win32.txt create mode 100644 src/py/doc/install-source.txt create mode 100644 src/py/doc/pydbsql-introduction-slides/pydbsql-introduction.odp create mode 100644 src/py/doc/pydbsql-introduction-slides/pydbsql-introduction.pdf create mode 100644 src/py/doc/silvercity.css create mode 100644 src/py/doc/usage-guide.txt create mode 100644 src/py/docutilsupport.py create mode 100644 src/py/extended_setup.py create mode 100644 src/py/ez_setup.py create mode 100644 src/py/misc/Makefile create mode 100644 src/py/misc/lru.py create mode 100644 src/py/pydbsql/__init__.py create mode 100644 src/py/pydbsql/dbapi2.py create mode 100644 src/py/pydbsql/test/__init__.py create mode 100644 src/py/pydbsql/test/dbapi.py create mode 100644 src/py/pydbsql/test/factory.py create mode 100644 src/py/pydbsql/test/hooks.py create mode 100644 src/py/pydbsql/test/regression.py create mode 100644 src/py/pydbsql/test/transactions.py create mode 100644 src/py/pydbsql/test/types.py create mode 100644 src/py/pydbsql/test/userfunctions.py create mode 100644 src/py/scripts/stress.py create mode 100644 src/py/scripts/test-pydbsql create mode 100644 src/py/setup.cfg create mode 100644 src/py/setup.py.in create mode 100644 src/py/src/cache.c create mode 100644 src/py/src/cache.h create mode 100644 src/py/src/connection.c create mode 100644 src/py/src/connection.h create mode 100644 src/py/src/cursor.c create mode 100644 src/py/src/cursor.h create mode 100644 src/py/src/dbsqlcompat.h create mode 100644 src/py/src/microprotocols.c create mode 100644 src/py/src/microprotocols.h create mode 100644 src/py/src/module.c create mode 100644 src/py/src/module.h create mode 100644 src/py/src/prepare_protocol.c create mode 100644 src/py/src/prepare_protocol.h create mode 100644 src/py/src/row.c create mode 100644 src/py/src/row.h create mode 100644 src/py/src/statement.c create mode 100644 src/py/src/statement.h create mode 100644 src/py/src/util.c create mode 100644 src/py/src/util.h create mode 100644 src/py/win32env.cmd create mode 100644 src/safety.c create mode 100644 src/sm.c create mode 100644 src/sql_fns.c create mode 100644 src/sql_parser.y create mode 100644 src/sql_tokenize.c create mode 100644 src/vdbe.c create mode 100644 src/vdbe_method.c create mode 100644 test/README create mode 100644 test/scr001/chk.code create mode 100644 test/scr002/chk.def create mode 100644 test/scr003/chk.define create mode 100644 test/scr005/chk.nl create mode 100644 test/scr006/chk.offt create mode 100644 test/scr007/chk.proto create mode 100644 test/scr008/chk.pubdef create mode 100644 test/scr009/chk.srcfiles create mode 100644 test/scr010/chk.str create mode 100644 test/scr010/spell.ok create mode 100644 test/scr011/chk.tags create mode 100644 test/scr013/chk.stats create mode 100644 test/scr014/chk.err create mode 100644 test/scr018/chk.comma create mode 100644 test/scr018/t.c create mode 100644 test/scr019/chk.include create mode 100644 test/scr020/chk.inc create mode 100644 test/scr021/chk.flags create mode 100644 test/scr021/t.c create mode 100644 test/scr022/chk.rr create mode 100644 test/scr026/chk.method create mode 100644 test/scr030/chk.build create mode 100644 test/scr050/Makefile create mode 100644 test/scr050/Makefile.in create mode 100644 test/scr050/crashtest1.c create mode 100644 test/scr050/dbsql_tclsh.c create mode 100644 test/scr050/s_include create mode 100644 test/scr050/tcl_dbsql.c create mode 100644 test/scr050/tcl_dbsql.h create mode 100644 test/scr050/tcl_ext.h create mode 100644 test/scr050/tcl_internal.c create mode 100644 test/scr050/tcl_md5.c create mode 100644 test/scr050/tcl_printf.c create mode 100644 test/scr050/tcl_randstr.c create mode 100644 test/scr050/tcl_sql_funcs.c create mode 100644 test/scr050/tcl_threads.c create mode 100644 test/scr050/tester.tcl create mode 100644 test/scr050/tests/all.test create mode 100644 test/scr050/tests/attach.test create mode 100644 test/scr050/tests/attach2.test create mode 100644 test/scr050/tests/auth.test create mode 100644 test/scr050/tests/bigfile.test_ create mode 100644 test/scr050/tests/bigrow.test create mode 100644 test/scr050/tests/bind.test create mode 100644 test/scr050/tests/capi2.test create mode 100644 test/scr050/tests/conflict.test create mode 100644 test/scr050/tests/copy.test create mode 100644 test/scr050/tests/date.test create mode 100644 test/scr050/tests/delete.test create mode 100644 test/scr050/tests/expr.test create mode 100644 test/scr050/tests/fkey1.test create mode 100644 test/scr050/tests/func.test create mode 100644 test/scr050/tests/hook.test create mode 100644 test/scr050/tests/in.test create mode 100644 test/scr050/tests/index.test create mode 100644 test/scr050/tests/insert.test create mode 100644 test/scr050/tests/insert2.test create mode 100644 test/scr050/tests/interrupt.test_ create mode 100644 test/scr050/tests/intpkey.test create mode 100644 test/scr050/tests/ioerr.test_ create mode 100644 test/scr050/tests/join.test create mode 100644 test/scr050/tests/join2.test create mode 100644 test/scr050/tests/limit.test create mode 100644 test/scr050/tests/lock.test create mode 100644 test/scr050/tests/main.test create mode 100644 test/scr050/tests/malloc.test create mode 100644 test/scr050/tests/memdb.test create mode 100644 test/scr050/tests/memleak.test create mode 100644 test/scr050/tests/minmax.test create mode 100644 test/scr050/tests/misc1.test create mode 100644 test/scr050/tests/misc2.test create mode 100644 test/scr050/tests/misc3.test create mode 100644 test/scr050/tests/misuse.test create mode 100644 test/scr050/tests/notnull.test create mode 100644 test/scr050/tests/null.test create mode 100644 test/scr050/tests/pager.test create mode 100644 test/scr050/tests/pragma.test create mode 100644 test/scr050/tests/printf.test create mode 100644 test/scr050/tests/progress.test create mode 100644 test/scr050/tests/quick.test create mode 100644 test/scr050/tests/quote.test create mode 100644 test/scr050/tests/rowid.test create mode 100644 test/scr050/tests/select1.test create mode 100644 test/scr050/tests/select2.test create mode 100644 test/scr050/tests/select3.test create mode 100644 test/scr050/tests/select4.test create mode 100644 test/scr050/tests/select5.test create mode 100644 test/scr050/tests/select6.test create mode 100644 test/scr050/tests/sort.test create mode 100644 test/scr050/tests/subselect.test create mode 100644 test/scr050/tests/table.test create mode 100644 test/scr050/tests/tableapi.test create mode 100644 test/scr050/tests/tclsqlite.test create mode 100644 test/scr050/tests/temptable.test create mode 100644 test/scr050/tests/thread1.test create mode 100644 test/scr050/tests/trans.test create mode 100644 test/scr050/tests/trigger1.test create mode 100644 test/scr050/tests/trigger2.test create mode 100644 test/scr050/tests/trigger3.test create mode 100644 test/scr050/tests/trigger4.test create mode 100644 test/scr050/tests/unique.test create mode 100644 test/scr050/tests/update.test create mode 100644 test/scr050/tests/vacuum.test create mode 100644 test/scr050/tests/view.test create mode 100644 test/scr050/tests/where.test create mode 100644 test/smoke.sql create mode 100644 test/smoke2.sql create mode 100644 test/smoke3.sql create mode 100644 test/smoke4.sql create mode 100644 test/test.tcl create mode 100644 test/testparams.tcl create mode 100644 test/testutils.tcl diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d511905 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/LICENSE_EXCEPTIONS b/LICENSE_EXCEPTIONS new file mode 100644 index 0000000..8d62017 --- /dev/null +++ b/LICENSE_EXCEPTIONS @@ -0,0 +1,109 @@ +FLOSS License Exception v1.0 + +The DBSQL Exception for Free/Libre and Open Source Software-only Applications +Using DBSQL Libraries (the "FLOSS Exception"). + +Version 1.0, 4 February 2007 + +Exception Intent + +We want specified Free/Libre and Open Source Software ("FLOSS") applications +to be able to use specified GPL-licensed MySQL client libraries (the "Program") +despite the fact that not all FLOSS licenses are compatible with version 2 of +the GNU General Public License (the "GPL"). + +Legal Terms and Conditions + +As a special exception to the terms and conditions of version 2.0 or later of +the GPL: + +You are free to distribute a Derivative Work that is formed entirely from the +Program and one or more works (each, a "FLOSS Work") licensed under one or +more of the licenses listed below in section 1, as long as: + + 1. You obey the GPL in all respects for the Program and the Derivative + Work, except for identifiable sections of the Derivative Work which + are not derived from the Program, and which can reasonably be considered + independent and separate works in themselves, + 2. all identifiable sections of the Derivative Work which are not derived + from the Program, and which can reasonably be considered independent and + separate works in themselves, + 1. are distributed subject to one of the FLOSS licenses listed below, + and + 2. the object code or executable form of those sections are + accompanied by the complete corresponding machine-readable source + code for those sections on the same medium and under the same + FLOSS license as the corresponding object code or executable forms + of those sections, and + 3. any works which are aggregated with the Program or with a + Derivative Work on a volume of a storage or distribution medium in + accordance with the GPL, can reasonably be considered independent + and separate works in themselves which are not derivatives of + either the Program, a Derivative Work or a FLOSS Work. + +If the above conditions are not met, then the Program may only be copied, +modified, distributed or used under the terms and conditions of the GPL or +another valid licensing option from The DBSQL Group, Inc. + + 1. FLOSS License List + +License name Version(s)/Copyright Date +-----------------------------------------------------|------------------------- +Academic Free License | 2.0 +Apache Software License | 1.0/1.1/2.0 +Apple Public Source License | 2.0 +Artistic license | From Perl 5.8.0 +BSD license | "July 22 1999" +Common Development and Distribution License (CDDL) | 1.0 +Common Public License | 1.0 +GNU Library or "Lesser" General Public License (LGPL)| 2.0/2.1 +Jabber Open Source License | 1.0 +MIT License (As listed in file MIT-License.txt) | - +Mozilla Public License (MPL) | 1.0/1.1 +Open Software License | 2.0 +OpenSSL license (with original SSLeay license) | "2003" ("1998") +PHP License | 3.0 +Python license (CNRI Python License) | - +Python Software Foundation License | 2.1.1 +Sleepycat License | "1999" +University of Illinois/NCSA Open Source License | - +W3C License | "2001" +X11 License | "2001" +Zlib/libpng License | - +Zope Public License | 2.0 + +Due to the many variants of some of the above licenses, we require that any +version follow the 2003 version of the Free Software Foundation's Free +Software Definition (http://www.gnu.org/philosophy/free-sw.html) or version +1.9 of the Open Source Definition by the Open Source Initiative +(http://www.opensource.org/docs/definition.php). + + 2. Definitions + 1. Terms used, but not defined, herein shall have the meaning + provided in the GPL. + 2. Derivative Work means a derivative work under copyright law. + + 3. Applicability + +This FLOSS Exception applies to all Programs that contain a notice placed by +The DBSQL Group, Inc. saying that the Program may be distributed under the +terms of this FLOSS Exception. If you create or distribute a work which is a +Derivative Work of both the Program and any other work licensed under the GPL, +then this FLOSS Exception is not available for that work; thus, you must +remove the FLOSS Exception notice from that work and comply with the GPL in +all respects, including by retaining all GPL notices. You may choose to +redistribute a copy of the Program exclusively under the terms of the GPL by +removing the FLOSS Exception notice from that copy of the Program, provided +that the copy has never been modified by you or any third party. + +Appendix A. Qualified Libraries and + +The following is a a non-exhaustive list of libraries and packages which are +covered by the FLOSS License Exception. Please note that appendix is merely +provided as an additional service to specific FLOSS projects who wish to +simplify licensing information for their users. Compliance with one of the +licenses noted under the "FLOSS license list" section remains a prerequisite. + +Package name | Qualifying License | Version +------------------------------|--------------------------|--------------------- +Apache Portable Runtime (APR) | Apache Software License | 2.0 diff --git a/README b/README new file mode 100644 index 0000000..563c5b0 --- /dev/null +++ b/README @@ -0,0 +1,46 @@ +DBSQL 0.2.2: (March 10, 2007) + +This is version 0.2.2 of DBSQL. + +To view the release and installation documentation, load the distribution +file docs/index.html into your web browser. + +This work started from the SQLite project (found on the web at +http://www.sqlite.org/). SQLite and all contributions to the SQLite +project have been placed in the public domain by its author, Dr. Richard Hipp. +There was no assertion of copyright at all on the code I used as a starting +point for my work. In fact there are statements that explicitly disclaim +copyright. I am asserting copyright on this work, DBSQL. I believe +that if you examine the extent to which I've changed, updated, and +modified the SQLite code you'll respect my copyright assertion. This +is a new product, heavily inspired by another. + +The goal for DBSQL is to provide a small SQL92 relational database layer +on top of the Berkeley DB database. Berkeley DB is copyright Oracle +Corporation (formerly Sleepycat Software, acquired in Feb 2006) and +licensed under the Sleepycat Public License. That license is compatible +with the GPL for open source use. Recognize that you, as someone using +DBSQL, will need to review the Sleepycat License and the GPL before you +use and redistribute your incorporating work. It is your responsibility +to comply with those licenses as I am in my work on DBSQL itself. My +motivation on a personal level is quite simple, I am in product management +these days and not in the code itself. I believe that product managers +should be engineers at heart with an ability to understand business, +politics, and software sales and support. This is my playground to keep +my engineering skills sharp enough to speak fluent geek. As a former +engineer at Sleepycat I understand and value the Berkeley DB programming +infrasture, design, and methodologies and I have liberally copied and +reused them in this project to improve SQLite in ways that I hope will +be of value to open source users out there. I did this because I see the +value of SQLite to its userbase, it is a perfect example of the 80/20 +rule and the KISS method and I admire those qualities in software. My +hope is that the Berkeley DB database engine will provide some significant +features that SQLite cannot such as replication for high availability +while remaining small enough to live comfortably inside applications, +services, and devices. + +Information and resources pertaining to DBSQL can be found at dbsql.org. + +Commercial licenses without the restrictions found in the GPL can be +purchased for this product. See http://dbsql.org/wiki/CommercialUse + diff --git a/dist/Makefile.in b/dist/Makefile.in new file mode 100644 index 0000000..ad3edcc --- /dev/null +++ b/dist/Makefile.in @@ -0,0 +1,486 @@ +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: Makefile.in 7 2007-02-03 13:34:17Z gburd $ + +srcdir= @srcdir@/../src +tstdir= @srcdir@/../test +distdir= @srcdir@/../dist +builddir=. + +################################################## +# Installation directories and permissions. +################################################## +prefix= @prefix@ +exec_prefix= @exec_prefix@ +bindir= @bindir@ +includedir= @includedir@ +libdir= @libdir@ +docdir= $(prefix)/docs + +dmode= 755 +emode= 555 +fmode= 444 + +transform=@program_transform_name@ + +################################################## +# Paths for standard user-level commands. +################################################## +SHELL= @db_cv_path_sh@ +ar= @db_cv_path_ar@ +awk= @db_cv_path_awk@ +chmod= @db_cv_path_chmod@ +cp= @db_cv_path_cp@ +depend= @db_cv_path_makedepend@ +grep= @db_cv_path_grep@ +ln= @db_cv_path_ln@ +mkdir= @db_cv_path_mkdir@ +ranlib= @db_cv_path_ranlib@ +rm= @db_cv_path_rm@ +rpm= @db_cv_path_rpm@ +sed= @db_cv_path_sed@ +perl= @db_cv_path_perl@ +splint= @db_cv_path_splint@ +strip= @db_cv_path_strip@ + +################################################## +# General library information. +################################################## +DEF_LIB= @DEFAULT_LIB@ +DEF_LIB_CXX= @DEFAULT_LIB_CXX@ +INSTALLER= @INSTALLER@ +LIBTOOL= @LIBTOOL@ +POSTLINK= @POSTLINK@ +SOLINK= @MAKEFILE_SOLINK@ +SOFLAGS= @SOFLAGS@ +LIBMAJOR= @DBSQL_VERSION_MAJOR@ +LIBVERSION= @DBSQL_VERSION_MAJOR@.@DBSQL_VERSION_MINOR@ +CPPFLAGS= -I$(builddir) -I$(srcdir) @CPPFLAGS@ + +################################################## +# Lemon parser generator information. +################################################## +LEMON= ./lemon +LEMON_FLAGS= + +################################################## +# C API. +################################################## +CFLAGS= -c $(CPPFLAGS) @CFLAGS@ +CC= @MAKEFILE_CC@ +CCLINK= @MAKEFILE_CCLINK@ + +LDFLAGS= @LDFLAGS@ +LIBS= @LIBS@ +LIBSO_LIBS= @LIBSO_LIBS@ + +libdbsql_base= libdbsql +libdbsql= $(libdbsql_base).a +libdbsql_version= $(libdbsql_base)-$(LIBVERSION).a +libso= $(libdbsql_base)-$(LIBVERSION)@SOSUFFIX@ +libso_target= $(libdbsql_base)-$(LIBVERSION).la +libso_default= $(libdbsql_base)@SOSUFFIX@ +libso_major= $(libdbsql_base)-$(LIBMAJOR)@SOSUFFIX@ + +################################################## +# Python Language Bindings +# +# Python support is optional and requires shared libraries. +################################################## + +################################################## +# NOTHING BELOW THIS LINE SHOULD EVER NEED TO BE MODIFIED. +################################################## + +################################################## +# Source file lists. +################################################## + +C_FILES=\ + $(srcdir)/api.c $(srcdir)/api_table.c $(srcdir)/cg_attach.c \ + $(srcdir)/cg_auth.c $(srcdir)/cg_build.c $(srcdir)/cg_copy.c \ + $(srcdir)/cg_date.c $(srcdir)/cg_delete.c $(srcdir)/cg_expr.c \ + $(srcdir)/cg_insert.c $(srcdir)/cg_pragma.c $(srcdir)/cg_select.c \ + $(srcdir)/cg_trigger.c $(srcdir)/cg_update.c $(srcdir)/cg_where.c \ + $(srcdir)/clib/xvprintf.c $(srcdir)/dbsql/dbsql.c \ + $(srcdir)/sm.c $(srcdir)/common/hash.c $(srcdir)/lemon/lemon.c \ + $(srcdir)/lemon/lempar.c $(srcdir)/os/os.c $(srcdir)/clib/random.c \ + $(srcdir)/sql_fns.c $(srcdir)/sql_tokenize.c \ + $(srcdir)/cg_vacuum.c $(srcdir)/vdbe.c $(srcdir)/vdbe_method.c \ + $(srcdir)/common/dbsql_err.c $(srcdir)/clib/snprintf.c \ + $(srcdir)/os/os_jtime.c $(srcdir)/clib/memcmp.c \ + $(srcdir)/clib/strcasecmp.c $(srcdir)/os/dbsql_alloc.c \ + $(srcdir)/common/str.c $(srcdir)/common/dbsql_atoi.c \ + $(srcdir)/common/dbsql_atof.c $(srcdir)/safety.c \ + $(srcdir)/clib/strdup.c + +################################################## +# Object and utility lists. +################################################## + +C_OBJS= @ADDITIONAL_OBJS@ @REPLACEMENT_OBJS@ \ + cg_attach@o@ cg_insert@o@ sql_tokenize@o@ cg_auth@o@ \ + cg_copy@o@ api_table@o@ cg_date@o@ api@o@ xvprintf@o@ \ + cg_pragma@o@ cg_where@o@ cg_trigger@o@ cg_build@o@ \ + sql_fns@o@ random@o@ cg_update@o@ cg_delete@o@ hash@o@ \ + cg_expr@o@ opcodes@o@ sql_parser@o@ cg_vacuum@o@ \ + vdbe@o@ vdbe_method@o@ sm@o@ snprintf@o@ dbsql_err@o@ cg_select@o@ \ + os_jtime@o@ memcmp@o@ dbsql_atof@o@ safety@o@ \ + strcasecmp@o@ strdup@o@ dbsql_alloc@o@ str@o@ dbsql_atoi@o@ + +LEMON_OBJS=\ + lemon@o@ + +UTIL_PROGS=\ + @ADDITIONAL_PROGS@ \ + dbsql + +################################################## +# List of files installed into the library directory. +################################################## +LIB_INSTALL_FILE_LIST=\ + $(libdbsql) \ + $(libso) \ + $(libso_default) \ + $(libso_major) \ + $(libdbsql_version) \ + $(libso_target) \ + $(libtso) \ + $(libtso_default) \ + $(libtso_major) \ + $(libtso_static) \ + $(libtso_target) + +################################################## +# We're building a standard library or a RPM file hierarchy. +# Note: "all" must be the first target in the Makefile. +################################################## +all: @BUILD_TARGET@ + +install-strip install: all @INSTALL_TARGET@ + +################################################## +# Library and standard utilities build. +################################################## +library_build: @INSTALL_LIBS@ @ADDITIONAL_LANG@ $(UTIL_PROGS) + +# Static C library named libdbsql.a. +$(libdbsql): $(DEF_LIB) + $(rm) -f $@ + test ! -f .libs/$(libdbsql_version) || \ + $(ln) -s .libs/$(libdbsql_version) $@ + test -f .libs/$(libdbsql_version) || \ + (test -f $(libdbsql_version) && + $(ln) -s $(libdbsql_version) $@) + +# Real static C library. +$(libdbsql_version): dbsql_int.h sql_parser.h opcodes.h $(C_OBJS) + $(ar) cr $@ $(C_OBJS) + test ! -f $(ranlib) || $(ranlib) $@ + +# Shared C library. +$(libso_target): dbsql_int.h sql_parser.h opcodes.h $(C_OBJS) + $(SOLINK) $(SOFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) $(LIBSO_LIBS) + +################################################## +# Utilities +################################################## +lemon: $(LEMON_OBJS) + $(CCLINK) -o $@ $(LDFLAGS) \ + $(LEMON_OBJS) $(LIBS) + $(POSTLINK) $@ + $(cp) $(srcdir)/lemon/lempar.c . + +dbsql: $(DEF_LIB) dbsql@o@ + $(CCLINK) -o $@ $(LDFLAGS) \ + dbsql@o@ $(DEF_LIB) $(LIBS) + $(POSTLINK) $@ + +################################################## +# Testing. +################################################## +test: $(tstdir)/scr050/dbsql_tclsh + $(tstdir)/scr050/dbsql_tclsh $(tstdir)/quick.test + +################################################## +# Library and standard utilities install. +################################################## +library_install: install_setup +library_install: install_include install_lib install_utilities install_docs + +uninstall: uninstall_include uninstall_lib uninstall_utilities uninstall_docs + +install_setup: + @test -d $(DESTDIR)$(prefix) || \ + ($(mkdir) -p $(DESTDIR)$(prefix) && \ + $(chmod) $(dmode) $(DESTDIR)$(prefix)) + +INCDOT= dbsql.h @ADDITIONAL_INCS@ +install_include: + @echo "Installing DBSQL include files: $(DESTDIR)$(includedir) ..." + @test -d $(DESTDIR)$(includedir) || \ + ($(mkdir) -p $(DESTDIR)$(includedir) && \ + $(chmod) $(dmode) $(DESTDIR)$(includedir)) + @cd $(DESTDIR)$(includedir) && $(rm) -f $(INCDOT) + @$(cp) -p $(INCDOT) $(DESTDIR)$(includedir) + @cd $(DESTDIR)$(includedir) && $(chmod) $(fmode) $(INCDOT) + +uninstall_include: + @cd $(DESTDIR)$(includedir) && $(rm) -f $(INCDOT) + +install_lib: + @echo "Installing DBSQL library: $(DESTDIR)$(libdir) ..." + @test -d $(DESTDIR)$(libdir) || \ + ($(mkdir) -p $(DESTDIR)$(libdir) && \ + $(chmod) $(dmode) $(DESTDIR)$(libdir)) + @cd $(DESTDIR)$(libdir) && $(rm) -f $(LIB_INSTALL_FILE_LIST) + @$(INSTALLER) @INSTALL_LIBS@ $(DESTDIR)$(libdir) + @(cd $(DESTDIR)$(libdir) && \ + test -f $(libso) && $(ln) -s $(libso) $(libso_default); \ + test -f $(libso) && $(ln) -s $(libso) $(libso_major); \ + test -f $(libtso) && $(ln) -s $(libtso) $(libtso_default); \ + test -f $(libtso) && $(ln) -s $(libtso) $(libtso_major); + +uninstall_lib: + @cd $(DESTDIR)$(libdir) && $(rm) -f $(LIB_INSTALL_FILE_LIST) + +install_utilities: + @echo "Installing DBSQL utilities: $(DESTDIR)$(bindir) ..." + @test -d $(DESTDIR)$(bindir) || \ + ($(mkdir) -p $(DESTDIR)$(bindir) && \ + $(chmod) $(dmode) $(DESTDIR)$(bindir)) + @for i in $(UTIL_PROGS); do \ + $(rm) -f $(DESTDIR)$(bindir)/$$i $(DESTDIR)$(bindir)/$$i.exe; \ + test -f $$i.exe && i=$$i.exe || true; \ + $(INSTALLER) $$i $(DESTDIR)$(bindir)/$$i; \ + test -f $(strip) && $(strip) $(DESTDIR)$(bindir)/$$i || true; \ + $(chmod) $(emode) $(DESTDIR)$(bindir)/$$i; \ + done + +uninstall_utilities: + @(cd $(DESTDIR)$(bindir); for i in $(UTIL_PROGS); do \ + $(rm) -f $$i $$i.exe; \ + done) + +################################################## +# RPM, build and install. +################################################## +rpm_build: + @test -f @db_cv_path_rpm_archive@ || \ + (echo "@db_cv_path_rpm_archive@: archive file not found" && false) + @$(rm) -rf BUILD RPMS SOURCES SPECS SRPMS RPM_INSTALL + @$(mkdir) -p BUILD && $(chmod) $(dmode) BUILD + @$(mkdir) -p RPMS/i386 && $(chmod) $(dmode) RPMS RPMS/i386 + @$(mkdir) -p SOURCES && $(chmod) $(dmode) SOURCES + @$(mkdir) -p SPECS && $(chmod) $(dmode) SPECS + @$(mkdir) -p SRPMS && $(chmod) $(dmode) SRPMS + $(cp) @db_cv_path_rpm_archive@ SOURCES/ + $(cp) dbsql.spec SPECS/dbsql.spec + @RPM_BUILD@ --define="`cat rpm-macro-defines`" -ba SPECS/dbsql.spec + +rpm_install: + +RPM_SRPMS=dbsql-@DBSQL_VERSION_MAJOR@.@DBSQL_VERSION_MINOR@.@DBSQL_VERSION_PATCH@-1.src.rpm + +################################################## +# Remaining standard Makefile targets. +################################################## +CLEAN_LIST=\ + lemon + +mostly-clean clean: + $(rm) -rf $(C_OBJS) + $(rm) -rf $(UTIL_PROGS) *.exe $(CLEAN_LIST) + $(rm) -rf $(JAVA_CLASSTOP) $(JAVA_EXCLASSTOP) + $(rm) -rf tags *@o@ *~ *.o *.o.lock *.lo core *.core *.loT + $(rm) -rf .libs $(LIB_INSTALL_FILE_LIST) + $(rm) -rf sql_parser.c sql_parser.h sql_parser.out + $(rm) -rf opcodes.c opcodes.h + $(rm) -rf lempar.c + $(rm) -rf test.db test?.db test.db-journal test1.bt data?.txt + $(rm) -f log.* + +REALCLEAN_LIST=\ + Makefile config.cache config.log config.status \ + configure.lineno dbsql.h dbsql.spec dbsql_config.h \ + db_int.h dbsql_int.h db_int_def.h rpm-macro-defines win_dbsql.h + +distclean maintainer-clean realclean: clean + $(rm) -rf $(REALCLEAN_LIST) + $(rm) -rf libtool + +check dvi info obj TAGS: + @echo "$@: make target not supported" && true + +dist: + @echo "$@: make target not supported" && false + +################################################## +# TODO Example programs for C. +################################################## + +################################################## +# Opcodes are generated from the vdbe.[ch] files. +################################################## +opcodes.c: $(srcdir)/vdbe.c + @echo '/* Automatically generated file. Do not edit */' >opcodes.c + @echo 'char *__opcode_names[] = { "???", ' >>opcodes.c + @$(grep) '^case OP_' $(srcdir)/vdbe.c | \ + $(sed) -e 's/^.*OP_/ "/' -e 's/:.*$$/", /' >>opcodes.c + @echo '};' >>opcodes.c + +opcodes.h: $(srcdir)/vdbe.c + @echo '/* Automatically generated file. Do not edit */' >opcodes.h + @$(grep) '^case OP_' $(srcdir)/vdbe.c | \ + $(sed) -e 's/://' | \ + $(awk) '{printf "#define %-30s %3d\n", $$2, ++cnt}' >>opcodes.h + +################################################## +# C API build rules. +################################################## +api@o@: $(srcdir)/api.c + $(CC) $(CFLAGS) $? +api_table@o@: $(srcdir)/api_table.c + $(CC) $(CFLAGS) $? +cg_attach@o@: $(srcdir)/cg_attach.c + $(CC) $(CFLAGS) $? +cg_auth@o@: $(srcdir)/cg_auth.c + $(CC) $(CFLAGS) $? +cg_build@o@: $(srcdir)/cg_build.c + $(CC) $(CFLAGS) $? +cg_copy@o@: $(srcdir)/cg_copy.c + $(CC) $(CFLAGS) $? +cg_date@o@: $(srcdir)/cg_date.c + $(CC) $(CFLAGS) $? +cg_delete@o@: $(srcdir)/cg_delete.c + $(CC) $(CFLAGS) $? +cg_expr@o@: $(srcdir)/cg_expr.c + $(CC) $(CFLAGS) $? +cg_insert@o@: $(srcdir)/cg_insert.c + $(CC) $(CFLAGS) $? +cg_pragma@o@: $(srcdir)/cg_pragma.c + $(CC) $(CFLAGS) $? +cg_select@o@: $(srcdir)/cg_select.c + $(CC) $(CFLAGS) $? +cg_trigger@o@: $(srcdir)/cg_trigger.c + $(CC) $(CFLAGS) $? +cg_update@o@: $(srcdir)/cg_update.c + $(CC) $(CFLAGS) $? +cg_where@o@: $(srcdir)/cg_where.c + $(CC) $(CFLAGS) $? +cg_vacuum@o@: $(srcdir)/cg_vacuum.c + $(CC) $(CFLAGS) $? +db_int.h: $(srcdir)/inc/db_int.h + @$(sed) -e 's/__DB_UNIQUE_NAME__/@DB_UNIQUE_NAME@/g' \ + $(srcdir)/inc/db_int.h > db_int.h +dbsql_atof@o@: $(srcdir)/common/dbsql_atof.c + $(CC) $(CFLAGS) $? +dbsql_atoi@o@: $(srcdir)/common/dbsql_atoi.c + $(CC) $(CFLAGS) $? +dbsql_err@o@: $(srcdir)/common/dbsql_err.c + $(CC) $(CFLAGS) $? +str@o@: $(srcdir)/common/str.c + $(CC) $(CFLAGS) $? +hash@o@: $(srcdir)/common/hash.c + $(CC) $(CFLAGS) $? +opcodes.c: opcodes.h +opcodes@o@: opcodes.c + $(CC) $(CFLAGS) $? +dbsql_alloc@o@: $(srcdir)/common/dbsql_alloc.c + $(CC) $(CFLAGS) $? +os_jtime@o@: $(srcdir)/os/os_jtime.c + $(CC) $(CFLAGS) $? +lemon@o@: $(srcdir)/lemon/lemon.c + $(CC) $(CFLAGS) $? +memcmp@o@: $(srcdir)/clib/memcmp.c + $(CC) $(CFLAGS) $? +xvprintf@o@: $(srcdir)/clib/xvprintf.c + $(CC) $(CFLAGS) $? +random@o@: $(srcdir)/clib/random.c + $(CC) $(CFLAGS) $? +safety@o@: $(srcdir)/safety.c + $(CC) $(CFLAGS) $? +sm@o@: $(srcdir)/sm.c + $(CC) $(CFLAGS) $? +snprintf@o@: $(srcdir)/clib/snprintf.c + $(CC) $(CFLAGS) $? +sql_fns@o@: $(srcdir)/sql_fns.c + $(CC) $(CFLAGS) $? +sql_parser.c: $(srcdir)/sql_parser.y lemon + @$(cp) $(srcdir)/sql_parser.y . + @$(LEMON) $(LEMON_FLAGS) sql_parser.y + @$(cp) ./sql_parser.c ./_sql_parser.c + @$(sed) -e 's/dbsql_parserAlloc/__sql_parser_alloc/g' \ + -e 's/dbsql_parserFree/__sql_parser_free/g' \ + -e 's/dbsql_parserTrace/__sql_parser_trace/g' \ + -e 's/dbsql_parser(/__sql_parser(/g' \ + -e 's/__set_stringn/__str_nappend/g' \ + -e 's/__set_string/__str_append/g' \ + ./_sql_parser.c > ./sql_parser.c + @$(rm) -f ./_sql_parser.c + @$(rm) -f ./sql_parser.y +sql_parser.h: sql_parser.c +sql_parser@o@: sql_parser.c + $(CC) $(CFLAGS) $? +sql_tokenize@o@: $(srcdir)/sql_tokenize.c + $(CC) $(CFLAGS) $? +strcasecmp@o@: $(srcdir)/clib/strcasecmp.c + $(CC) $(CFLAGS) $? +strdup@o@: $(srcdir)/clib/strdup.c + $(CC) $(CFLAGS) $? +vdbe@o@: $(srcdir)/vdbe.c + $(CC) $(CFLAGS) $? +vdbe_method@o@: $(srcdir)/vdbe_method.c + $(CC) $(CFLAGS) $? +dbsql.h: $(srcdir)/dbsql.in + @echo dbsql.h is out of date, re-configure to regenerate it. + + +################################################## +# Utility build rules. +################################################## +dbsql@o@: $(srcdir)/dbsql/dbsql.c + $(CC) $(CFLAGS) $? + + +################################################## +# Lint. +################################################## + +splint: + $(splint) -nof -f $(distdir)/splint.rc -strict \ + $(CPPFLAGS) @CFLAGS@ -I. $(C_FILES) + +lint: splint + +################################################## +# Dependencies +################################################## + +#depend: +# @$(depend) -o @o@ $(CPPFLAGS) @CFLAGS@ $(C_FILES) +# @$(perl) -p -i -e 's#^@srcdir@/../src/common/##g' Makefile +# @$(perl) -p -i -e 's#^@srcdir@/../src/os/##g' Makefile +# @$(perl) -p -i -e 's#^@srcdir@/../src/clib/##g' Makefile +# @$(perl) -p -i -e 's#^@srcdir@/../src/lemon/##g' Makefile +# @$(perl) -p -i -e 's#^@srcdir@/../src/##g' Makefile + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/dist/RELEASE b/dist/RELEASE new file mode 100644 index 0000000..5a74adf --- /dev/null +++ b/dist/RELEASE @@ -0,0 +1,31 @@ +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: RELEASE 7 2007-02-03 13:34:17Z gburd $ + +DBSQL_VERSION_MAJOR=0 +DBSQL_VERSION_MINOR=2 +DBSQL_VERSION_PATCH=2 +DBSQL_VERSION="$DBSQL_VERSION_MAJOR.$DBSQL_VERSION_MINOR.$DBSQL_VERSION_PATCH" + +DBSQL_VERSION_UNIQUE_NAME=`printf "_%d%03d" $DBSQL_VERSION_MAJOR $DBSQL_VERSION_MINOR` + +DBSQL_RELEASE_DATE=`date "+%B %e, %Y"` +DBSQL_VERSION_STRING="DBSQL $DBSQL_VERSION: ($DBSQL_RELEASE_DATE)" diff --git a/dist/aclocal/config.ac b/dist/aclocal/config.ac new file mode 100644 index 0000000..d18ba83 --- /dev/null +++ b/dist/aclocal/config.ac @@ -0,0 +1,26 @@ +# Features we don't test for, but want the #defines to exist for +# other ports. +AH_TEMPLATE(DBSQL_WIN32, + [We use DBSQL_WIN32 much as one would use _WIN32 -- to specify that + we're using an operating system environment that supports Win32 + calls and semantics. We don't use _WIN32 because Cygwin/GCC also + defines _WIN32, even though Cygwin/GCC closely emulates the Unix + environment.]) + +AH_TEMPLATE(HAVE_FILESYSTEM_NOTZERO, + [Define to 1 if allocated filesystem blocks are not zeroed.]) + +AH_TEMPLATE(HAVE_UNLINK_WITH_OPEN_FAILURE, + [Define to 1 if unlink of file with open file descriptors will fail.]) + +AH_BOTTOM([/* + * Exit success/failure macros. + */ +#ifndef HAVE_EXIT_SUCCESS +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#endif + +#ifdef DBSQL_WIN32 +#include "win_dbsql.h" +#endif]) diff --git a/dist/aclocal/cxx.ac b/dist/aclocal/cxx.ac new file mode 100644 index 0000000..49103cc --- /dev/null +++ b/dist/aclocal/cxx.ac @@ -0,0 +1,17 @@ +# C++ checks to determine what style of headers to use and +# whether to use "using" clauses. + +AC_DEFUN(AC_CXX_HAVE_STDHEADERS, [ +AC_SUBST(cxx_have_stdheaders) +AC_CACHE_CHECK([whether C++ supports the ISO C++ standard includes], +db_cv_cxx_have_stdheaders, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([#include +],[std::ostream *o; return 0;], + db_cv_cxx_have_stdheaders=yes, db_cv_cxx_have_stdheaders=no) + AC_LANG_RESTORE +]) +if test "$db_cv_cxx_have_stdheaders" = yes; then + cxx_have_stdheaders="#define HAVE_CXX_STDHEADERS 1" +fi]) diff --git a/dist/aclocal/gcc.ac b/dist/aclocal/gcc.ac new file mode 100644 index 0000000..0949d98 --- /dev/null +++ b/dist/aclocal/gcc.ac @@ -0,0 +1,36 @@ +# Version 2.96 of gcc (shipped with RedHat Linux 7.[01] and Mandrake) had +# serious problems. +AC_DEFUN(AC_GCC_CONFIG1, [ +AC_CACHE_CHECK([whether we are using gcc version 2.96], +db_cv_gcc_2_96, [ +db_cv_gcc_2_96=no +if test "$GCC" = "yes"; then + GCC_VERSION=`${MAKEFILE_CC} --version` + case ${GCC_VERSION} in + 2.96*) + db_cv_gcc_2_96=yes;; + esac +fi]) +if test "$db_cv_gcc_2_96" = "yes"; then + CFLAGS=`echo "$CFLAGS" | sed 's/-O2/-O/'` + CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-O2/-O/'` + AC_MSG_WARN([INSTALLED GCC COMPILER HAS SERIOUS BUGS; PLEASE UPGRADE.]) + AC_MSG_WARN([GCC OPTIMIZATION LEVEL SET TO -O.]) +fi]) + +# Versions of g++ up to 2.8.0 required -fhandle-exceptions, but it is +# renamed as -fexceptions and is the default in versions 2.8.0 and after. +AC_DEFUN(AC_GCC_CONFIG2, [ +AC_CACHE_CHECK([whether g++ requires -fhandle-exceptions], +db_cv_gxx_except, [ +db_cv_gxx_except=no; +if test "$GXX" = "yes"; then + GXX_VERSION=`${MAKEFILE_CXX} --version` + case ${GXX_VERSION} in + 1.*|2.[[01234567]].*|*-1.*|*-2.[[01234567]].*) + db_cv_gxx_except=yes;; + esac +fi]) +if test "$db_cv_gxx_except" = "yes"; then + CXXFLAGS="$CXXFLAGS -fhandle-exceptions" +fi]) diff --git a/dist/aclocal/libtool.ac b/dist/aclocal/libtool.ac new file mode 100644 index 0000000..59d0b09 --- /dev/null +++ b/dist/aclocal/libtool.ac @@ -0,0 +1,5867 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +## Copyright 1996, 1997, 1998, 1999, 2000, 2001 +## Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 1996 +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 47 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx | nto-qnx6*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +#- set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + case $host_cpu in + alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh*) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx | nto-qnx6*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/${ac_tool_prefix}nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_builddir and top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, lt_dlinit, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,CXX" | sed 's/^,//'`]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,F77" | sed 's/^,//'`]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,GCJ" | sed 's/^,//'`]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,RC" | sed 's/^,//'`]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGISTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $CC in + icc|ecc) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + ccc) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi4*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +SED=$lt_cv_path_SED +]) +AC_MSG_RESULT([$SED]) +]) diff --git a/dist/aclocal/options.ac b/dist/aclocal/options.ac new file mode 100644 index 0000000..bd2bef0 --- /dev/null +++ b/dist/aclocal/options.ac @@ -0,0 +1,255 @@ +# $Id: options.ac 7 2007-02-03 13:34:17Z gburd $ + +# Process user-specified options. +AC_DEFUN(AM_OPTIONS_SET, [ + +AC_MSG_CHECKING(if --enable-utf8-encoding option specified) +AC_ARG_ENABLE(utf8-encoding, + AC_HELP_STRING([--enable-utf8-encoding], + [Encode strings as UTF-8 or ISO-8859.]),, enableval="yes") +db_cv_utf8_strings="$enableval" +case "$enableval" in + no) AC_MSG_RESULT(yes);; +yes) AC_MSG_RESULT(no);; +esac +if test "$cv_utf8_strings" = "yes"; then + ENCODING=UTF8 + AC_DEFINE(DBSQL_UTF8_ENCODING) +else + ENCODING=ISO8859 + AC_DEFINE(DBSQL_ISO8859_ENCODING) +fi +AH_TEMPLATE(DBSQL_ISO8859_ENCODING, + [Define to use ISO8859 string encoding.]) +AH_TEMPLATE(DBSQL_UTF8_ENCODING, + [Define use UTF8 string encoding.]) + + +AC_MSG_CHECKING(if --enable-incore-databases option specified) +AC_ARG_ENABLE(incore-databases, + AC_HELP_STRING([--enable-incore-databases], + [Enable incore databases for ATTACH and OPEN.]),, enableval="yes") +db_cv_incore_databases="$enableval" +case "$enableval" in + no) AC_MSG_RESULT(yes);; +yes) AC_MSG_RESULT(no);; +esac +if test "$db_cv_incore_databases" = "no"; then + INMEMORYDB=0 +else + INMEMORYDB=1 +fi +AC_DEFINE(INMEMORYDB) +AH_TEMPLATE(INMEMORYDB, + [Define to 1 to enable incore databases for ATTACH and OPEN.]) + +AC_MSG_CHECKING(if --enable-authentication option specified) +AC_ARG_ENABLE(authentication, + AC_HELP_STRING([--enable-authentication], + [Include authorization validation code.]),, enableval="yes") +db_cv_auth="$enableval" +case "$enableval" in + no) AC_MSG_RESULT(no);; +yes) AC_MSG_RESULT(yes);; +esac +if test "$db_cv_auth" = "no"; then + AC_DEFINE(DBSQL_OMIT_AUTHORIZATION) +fi +AH_TEMPLATE(DBSQL_OMIT_AUTHORIZATION, + [Define to 1 to omit authorization code from the build.]) + + +AC_MSG_CHECKING(if --enable-vacuum option specified) +AC_ARG_ENABLE(vacuum, + AC_HELP_STRING([--enable-vacuum], + [Include the VACUUM command.]),, enableval="yes") +db_cv_auth="$enableval" +case "$enableval" in + no) AC_MSG_RESULT(no);; +yes) AC_MSG_RESULT(yes);; +esac +if test "$db_cv_auth" = "no"; then + AC_DEFINE(DBSQL_OMIT_VACUUM) +fi +AH_TEMPLATE(DBSQL_OMIT_VACUUM, + [Define to 1 to omit the code for the VACCUM command from the build.]) + +AC_MSG_CHECKING(if --enable-datetime option specified) +AC_ARG_ENABLE(enable-datetime, + AC_HELP_STRING([--enable-datetime], + [Include datetime functions.]),, enableval="yes") +db_cv_datetime="$enableval" +case "$enableval" in + no) AC_MSG_RESULT(no);; +yes) AC_MSG_RESULT(yes);; +esac +if test "$db_cv_datetime" = "no"; then + AC_DEFINE(DBSQL_OMIT_DATETIME_FUNCS) + +fi +AH_TEMPLATE(DBSQL_OMIT_DATETIME_FUNCS, + [Define to 1 to omit support for datetime functions from the build.]) + + +AC_MSG_CHECKING([if --with-berkeleydb=DIR option specified]) +AC_ARG_WITH(berkeleydb, + [AC_HELP_STRING([--with-berkeleydb=DIR], + [Path of Berkeley DB. [DIR="/usr/local/BerkeleyDB.4.5"]])], + [with_berkeleydb="$withval"], [with_berkeleydb="no"]) +AC_MSG_RESULT($with_berkeleydb) +# If --with-berkeleydb isn't specified, assume it's here | wc -l` -gt 0 +if test "$with_berkeleydb" = "no"; then + with_berkeleydb="/usr/local/BerkeleyDB.4.5" +fi +DB_PATH="$with_berkeleydb" +if test `ls "$with_berkeleydb"/lib/libdb-*.la 2>/dev/null | wc -l` -gt 0 ; then + AC_MSG_CHECKING([for Berkeley DB version from install tree]) + db_version=`ls "$with_berkeleydb"/lib/libdb-*.la | sed 's/.*db-\(.*\).la/\1/'` + AC_MSG_RESULT([$db_version]) + echo "$CPPFLAGS" | grep "$with_berkeleydb/include" >/dev/null 2>&1 || CPPFLAGS="$CPPFLAGS -I$with_berkeleydb/include" + if test `ls "$with_berkeleydb"/lib/libdb-$db_version.* 2>/dev/null | wc -l` -gt 0 ; then + LIBSO_LIBS="$LIBS -L$with_berkeleydb/lib -ldb-$db_version" + else + LIBS="$LIBS -l$with_berkeleydb/lib/libdb-$db_version.a" + fi +elif test `ls /usr/local/lib/db?? 2>/dev/null | wc -l` -gt 0 ; then + AC_MSG_CHECKING([if Berkeley DB was installed using BSD ports]) + db_num=`ls /usr/local/lib | grep db | grep -v lib | sed -e 's/db//' | sort -n | head -1` + db_version=`echo $db_num | sed 's/\(.\)\(.\)/\1.\2/'` + AC_MSG_RESULT([yes, $db_version]) + echo "$CPPFLAGS" | grep /usr/local/include/db$db_num >/dev/null 2>&1 || CPPFLAGS="$CPPFLAGS -I/usr/local/include/db$db_num" + if test `ls /usr/local/lib/libdb-$db_version.* 2>/dev/null | wc -l` -gt 0 ; then + LIBSO_LIBS="$LIBS -L/usr/local/lib -ldb-$db_version" + else + LIBS="$LIBS -l/usr/local/lib/libdb-$db_version.a" + fi +else + AC_MSG_ERROR([$with_berkeleydb not a valid Berkeley DB install tree.]) +fi + +AC_MSG_CHECKING([if --with-db-uniquename=NAME option specified]) +AC_ARG_WITH(db-uniquename, + [AC_HELP_STRING([--with-db-uniquename=NAME], + [Unique name used when building DB library.])], + [with_db_uniquename="$withval"], [with_db_uniquename="no"]) +if test "$with_db_uniquename" = "no"; then + db_cv_uniquename="no" + DB_UNIQUE_NAME="" + AC_MSG_RESULT($with_db_uniquename) +else + db_cv_uniquename="yes" + if test "$with_db_uniquename" = "yes"; then + DB_UNIQUE_NAME="__EDIT_DB_VERSION_UNIQUE_NAME__" + else + DB_UNIQUE_NAME="$with_db_uniquename" + fi + AC_MSG_RESULT($DB_UNIQUE_NAME) +fi + +AC_MSG_CHECKING(if --enable-incore-temp-databases option specified) +AC_ARG_ENABLE(incore-temp-databases, + AC_HELP_STRING([--enable-incore-temp-databases], + [Enable incore databases for temporary tables.]),, enableval="no") +db_cv_incore_temp_databases="$enableval" +case "$db_cv_incore_temp_databases" in + never) + TEMP_STORE=0 + AC_MSG_RESULT([never]) + ;; + no) + INMEMORYDB=1 + TEMP_STORE=1 + AC_MSG_RESULT([no]) + ;; + always) + INMEMORYDB=1 + TEMP_STORE=3 + AC_MSG_RESULT([always]) + ;; + *) + INMEMORYDB=1 + TEMP_STORE=2 + AC_MSG_RESULT([yes]) + ;; +esac +AC_DEFINE(INMEMORYDB) +AH_TEMPLATE(INMEMORYDB, + [Define to 1 to enable memory resident databases.]) +AC_DEFINE(TEMP_STORE) +AH_TEMPLATE(TEMP_STORE, + [Determines where TEMP databases can be stored, see table in source code.]) + +AC_MSG_CHECKING(if --disable-statistics option specified) +AC_ARG_ENABLE(statistics, + AC_HELP_STRING([--disable-statistics], + [Do not build statistics support.]),, enableval="yes") +db_cv_build_statistics="$enableval" +case "$enableval" in + no) AC_MSG_RESULT(yes);; +yes) AC_MSG_RESULT(no);; +esac + +AC_MSG_CHECKING(if --enable-sqlite-compat option specified) +AC_ARG_ENABLE(sqlite-compat, + [AC_HELP_STRING([--enable-sqlite-compat], + [Build SQLite compatibility API.])], + [db_cv_sqlite_compat="$enable_sqlite_compat"], + [db_cv_sqlite_compat="no"]) +AC_MSG_RESULT($db_cv_sqlite_compat) + +AC_MSG_CHECKING(if --enable-soundex-sqlfn option specified) +AC_ARG_ENABLE(soundex-sqlfn, + [AC_HELP_STRING([--enable-soundex-sqlfn], + [Include soundex() sql function support.])], + [db_cv_sqlite_compat="$enable_soundex_sqlfn"], + [db_cv_sqlite_compat="no"]) +AC_MSG_RESULT($db_cv_soundex_sqlfn) + +AC_MSG_CHECKING(if --enable-posixmutexes option specified) +AC_ARG_ENABLE(posixmutexes, + [AC_HELP_STRING([--enable-posixmutexes], + [Force use of POSIX standard mutexes.])], + [db_cv_posixmutexes="$enable_posixmutexes"], [db_cv_posixmutexes="no"]) +AC_MSG_RESULT($db_cv_posixmutexes) + +AC_MSG_CHECKING(if --enable-debug option specified) +AC_ARG_ENABLE(debug, + [AC_HELP_STRING([--enable-debug], + [Build a debugging version.])], + [db_cv_debug="$enable_debug"], [db_cv_debug="no"]) +AC_MSG_RESULT($db_cv_debug) + +AC_MSG_CHECKING(if --enable-diagnostic option specified) +AC_ARG_ENABLE(diagnostic, + [AC_HELP_STRING([--enable-diagnostic], + [Build a version with run-time diagnostics.])], + [db_cv_diagnostic="$enable_diagnostic"], [db_cv_diagnostic="no"]) +AC_MSG_RESULT($db_cv_diagnostic) + +AC_MSG_CHECKING(if --enable-tcl option specified) +AC_ARG_ENABLE(tcl, + [AC_HELP_STRING([--enable-tcl], + [Build Tcl API.])], + [db_cv_tcl="$enable_tcl"], [db_cv_tcl="no"]) +AC_MSG_RESULT($db_cv_tcl) + +AC_MSG_CHECKING([if --with-tcl=DIR option specified]) +AC_ARG_WITH(tcl, + [AC_HELP_STRING([--with-tcl=DIR], + [Directory location of tclConfig.sh.])], + [with_tclconfig="$withval"], [with_tclconfig="no"]) +AC_MSG_RESULT($with_tclconfig) + +AC_MSG_CHECKING(if --enable-test option specified) +AC_ARG_ENABLE(test, + [AC_HELP_STRING([--enable-test], + [Configure to run the test suite.])], + [db_cv_test="$enable_test"], [db_cv_test="no"]) +AC_MSG_RESULT($db_cv_test) + +# Test requires Tcl +if test "$db_cv_test" = "yes"; then + if test "$db_cv_tcl" = "no"; then + AC_MSG_ERROR([--enable-test requires --enable-tcl]) + fi +fi]) diff --git a/dist/aclocal/programs.ac b/dist/aclocal/programs.ac new file mode 100644 index 0000000..a0bea46 --- /dev/null +++ b/dist/aclocal/programs.ac @@ -0,0 +1,118 @@ +# $Id: programs.ac 7 2007-02-03 13:34:17Z gburd $ + +# Check for programs used in building/installation. +AC_DEFUN(AM_PROGRAMS_SET, [ + +AC_CHECK_TOOL(db_cv_path_ar, ar, missing_ar) +if test "$db_cv_path_ar" = missing_ar; then + AC_MSG_ERROR([No ar utility found.]) +fi + +AC_CHECK_TOOL(db_cv_path_chmod, chmod, missing_chmod) +if test "$db_cv_path_chmod" = missing_chmod; then + AC_MSG_ERROR([No chmod utility found.]) +fi + +AC_CHECK_TOOL(db_cv_path_sed, sed, missing_sed) +if test "$db_cv_path_sed" = missing_sed; then + AC_MSG_ERROR([No sed utility found.]) +fi + +AC_CHECK_TOOL(db_cv_path_perl, perl, missing_perl) +if test "$db_cv_path_perl" = missing_perl; then + AC_MSG_ERROR([No perl utility found.]) +fi + +AC_CHECK_TOOL(db_cv_path_makedepend, makedepend, missing_makedepend) +if test "$db_cv_path_makedepend" = missing_makedepend; then + AC_MSG_RESULT([no]) + db_cv_path_makedepend=echo +fi + +AC_CHECK_TOOL(db_cv_path_splint, splint, missing_splint) +if test "$db_cv_path_splint" = missing_splint; then + AC_MSG_RESULT([no]) + db_cv_path_splint=echo +fi + +AC_CHECK_TOOL(db_cv_path_python, python, missing_python) +if test "$db_cv_path_python" = missing_python; then + AC_MSG_RESULT([no]) + db_cv_path_python=echo +fi + +AC_CHECK_TOOL(db_cv_path_grep, grep, missing_grep) +if test "$db_cv_path_grep" = missing_grep; then + AC_MSG_ERROR([No grep utility found.]) +fi + +AC_CHECK_TOOL(db_cv_path_awk, awk, missing_awk) +if test "$db_cv_path_awk" = missing_awk; then + AC_MSG_ERROR([No awk utility found.]) +fi + +AC_CHECK_TOOL(db_cv_path_cp, cp, missing_cp) +if test "$db_cv_path_cp" = missing_cp; then + AC_MSG_ERROR([No cp utility found.]) +fi + +if test "$db_cv_rpm" = "yes"; then + AC_CHECK_TOOL(path_ldconfig, ldconfig, missing_ldconfig) + AC_PATH_PROG(db_cv_path_ldconfig, $path_ldconfig, missing_ldconfig) + if test "$db_cv_path_ldconfig" != missing_ldconfig; then + RPM_POST_INSTALL="%post -p $db_cv_path_ldconfig" + RPM_POST_UNINSTALL="%postun -p $db_cv_path_ldconfig" + fi +fi + +AC_CHECK_TOOL(db_cv_path_ln, ln, missing_ln) +if test "$db_cv_path_ln" = missing_ln; then + AC_MSG_ERROR([No ln utility found.]) +fi + +AC_CHECK_TOOL(db_cv_path_mkdir, mkdir, missing_mkdir) +if test "$db_cv_path_mkdir" = missing_mkdir; then + AC_MSG_ERROR([No mkdir utility found.]) +fi + +# We need a complete path for ranlib, because it doesn't exist on some +# architectures because the ar utility packages the library itself. +AC_CHECK_TOOL(path_ranlib, ranlib, missing_ranlib) +AC_PATH_PROG(db_cv_path_ranlib, $path_ranlib, missing_ranlib) + +AC_CHECK_TOOL(db_cv_path_rm, rm, missing_rm) +if test "$db_cv_path_rm" = missing_rm; then + AC_MSG_ERROR([No rm utility found.]) +fi + +if test "$db_cv_rpm" = "yes"; then + AC_CHECK_TOOL(db_cv_path_rpm, rpm, missing_rpm) + if test "$db_cv_path_rpm" = missing_rpm; then + AC_MSG_ERROR([No rpm utility found.]) + fi +fi + +# We need a complete path for sh, because some implementations of make +# get upset if SHELL is set to just the command name. +AC_CHECK_TOOL(path_sh, sh, missing_sh) +AC_PATH_PROG(db_cv_path_sh, $path_sh, missing_sh) +if test "$db_cv_path_sh" = missing_sh; then + AC_MSG_ERROR([No sh utility found.]) +fi + +# Don't strip the binaries if --enable-debug was specified. +if test "$db_cv_debug" = yes; then + db_cv_path_strip=debug_build_no_strip +else + AC_CHECK_TOOL(path_strip, strip, missing_strip) + AC_PATH_PROG(db_cv_path_strip, $path_strip, missing_strip) +fi + +if test "$db_cv_test" = "yes"; then + AC_CHECK_TOOL(db_cv_path_kill, kill, missing_kill) + if test "$db_cv_path_kill" = missing_kill; then + AC_MSG_ERROR([No kill utility found.]) + fi +fi + +]) diff --git a/dist/aclocal/readline.ac b/dist/aclocal/readline.ac new file mode 100644 index 0000000..7624269 --- /dev/null +++ b/dist/aclocal/readline.ac @@ -0,0 +1,47 @@ +# $Id: readline.ac 7 2007-02-03 13:34:17Z gburd $ + +# Find a readline compatible library. + +AC_DEFUN([VL_LIB_READLINE], [ + AC_CACHE_CHECK([for a readline compatible library], + vl_cv_lib_readline, [ + ORIG_LIBS="$LIBS" + for readline_lib in readline edit editline; do + for termcap_lib in "" termcap curses ncurses; do + if test -z "$termcap_lib"; then + TRY_LIB="-l$readline_lib" + else + TRY_LIB="-l$readline_lib -l$termcap_lib" + fi + LIBS="$ORIG_LIBS $TRY_LIB" + AC_TRY_LINK_FUNC(readline, vl_cv_lib_readline="$TRY_LIB") + if test -n "$vl_cv_lib_readline"; then + break + fi + done + if test -n "$vl_cv_lib_readline"; then + break + fi + done + if test -z "$vl_cv_lib_readline"; then + vl_cv_lib_readline="no" + LIBS="$ORIG_LIBS" + fi + ]) + + if test "$vl_cv_lib_readline" != "no"; then + AC_DEFINE(HAVE_LIBREADLINE, 1, + [Define if you have a readline compatible library]) + AC_CHECK_HEADERS(readline.h readline/readline.h) + AC_CACHE_CHECK([whether readline supports history], + vl_cv_lib_readline_history, [ + vl_cv_lib_readline_history="no" + AC_TRY_LINK_FUNC(add_history, vl_cv_lib_readline_history="yes") + ]) + if test "$vl_cv_lib_readline_history" = "yes"; then + AC_DEFINE(HAVE_READLINE_HISTORY, 1, + [Define if your readline library has \`add_history']) + AC_CHECK_HEADERS(history.h readline/history.h) + fi + fi +])dnl diff --git a/dist/aclocal/sosuffix.ac b/dist/aclocal/sosuffix.ac new file mode 100644 index 0000000..99638bc --- /dev/null +++ b/dist/aclocal/sosuffix.ac @@ -0,0 +1,76 @@ +# $Id: sosuffix.ac 7 2007-02-03 13:34:17Z gburd $ +# Determine shared object suffixes. +# +# Our method is to use the libtool variable $library_names_spec, +# set by using AC_PROG_LIBTOOL. This variable is a snippet of shell +# defined in terms of $versuffix, $release, $libname and $module +# We want to eval it and grab the suffix used for shared objects. +# By setting $module to yes/no, we obtain the suffixes +# used to create dlloadable, or java loadable modules. +# On many (*nix) systems, these all evaluate to .so, but there +# are some notable exceptions. +# Before calling this macro, $LIBTOOL_PROG must be set to +# the correct method of invoking libtool (e.g. $SHELL ./libtool) + +# This macro is used internally to discover the suffix for the current +# settings of $module. The result is stored in $_SOSUFFIX. +AC_DEFUN(_SOSUFFIX_INTERNAL, [ + versuffix="" + release="" + libname=libfoo + eval _SOSUFFIX=\"$shrext\" + if test "X$_SOSUFFIX" = "" ; then + _SOSUFFIX=".so" + if test `$LIBTOOL_PROG --config | grep build_libtool_libs | grep no` 2>/dev/null; then + if test "X$_SOSUFFIX_MESSAGE" = "X"; then + _SOSUFFIX_MESSAGE=yes + AC_MSG_WARN([libtool may not know about this architecture.]) + AC_MSG_WARN([assuming $_SUFFIX suffix for dynamic libraries.]) + fi + fi + fi +]) + +# SOSUFFIX_CONFIG will set the variable SOSUFFIX to be the +# shared library extension used for general linking, not dlopen. +AC_DEFUN(SOSUFFIX_CONFIG, [ + AC_MSG_CHECKING([SOSUFFIX from libtool]) + module=no + _SOSUFFIX_INTERNAL + SOSUFFIX=$_SOSUFFIX + AC_MSG_RESULT($SOSUFFIX) + AC_SUBST(SOSUFFIX) +]) + +# MODSUFFIX_CONFIG will set the variable MODSUFFIX to be the +# shared library extension used for dlopen'ed modules. +# To discover this, we set $module, simulating libtool's -module option. +AC_DEFUN(MODSUFFIX_CONFIG, [ + AC_MSG_CHECKING([MODSUFFIX from libtool]) + module=yes + _SOSUFFIX_INTERNAL + MODSUFFIX=$_SOSUFFIX + AC_MSG_RESULT($MODSUFFIX) + AC_SUBST(MODSUFFIX) +]) + +# JMODSUFFIX_CONFIG will set the variable JMODSUFFIX to be the +# shared library extension used JNI modules opened by Java. +# To discover this, we set $jnimodule, simulating libtool's -shrext option. +########################################################################## +# Robert Boehne: Not much point in this macro any more because apparently +# Darwin is the only OS that wants or needs the .jnilib extension. +########################################################################## +AC_DEFUN(JMODSUFFIX_CONFIG, [ + AC_MSG_CHECKING([JMODSUFFIX from libtool]) + module=yes + _SOSUFFIX_INTERNAL + if test `uname` = "Darwin"; then + JMODSUFFIX=".jnilib" + else + JMODSUFFIX=$_SOSUFFIX + fi + AC_MSG_RESULT($JMODSUFFIX) + AC_SUBST(JMODSUFFIX) +]) + diff --git a/dist/aclocal/tcl.ac b/dist/aclocal/tcl.ac new file mode 100644 index 0000000..baef4ce --- /dev/null +++ b/dist/aclocal/tcl.ac @@ -0,0 +1,128 @@ +# $Id: tcl.ac 7 2007-02-03 13:34:17Z gburd $ + +# The SC_* macros in this file are from the unix/tcl.m4 files in the Tcl +# 8.3.0 distribution, with some minor changes. For this reason, license +# terms for the Berkeley DB distribution dist/aclocal/tcl.m4 file are as +# follows (copied from the license.terms file in the Tcl 8.3 distribution): +# +# This software is copyrighted by the Regents of the University of +# California, Sun Microsystems, Inc., Scriptics Corporation, +# and other parties. The following terms apply to all files associated +# with the software unless explicitly disclaimed in individual files. +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# +# IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY +# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +# ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY +# DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE +# IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE +# NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR +# MODIFICATIONS. +# +# GOVERNMENT USE: If you are acquiring this software on behalf of the +# U.S. government, the Government shall have only "Restricted Rights" +# in the software and related documentation as defined in the Federal +# Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you +# are acquiring the software on behalf of the Department of Defense, the +# software shall be classified as "Commercial Computer Software" and the +# Government shall have only "Restricted Rights" as defined in Clause +# 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the +# authors grant the U.S. Government and others acting in its behalf +# permission to use and distribute the software in accordance with the +# terms specified in this license. + +AC_DEFUN(SC_PATH_TCLCONFIG, [ + AC_CACHE_VAL(ac_cv_c_tclconfig,[ + + # First check to see if --with-tclconfig was specified. + if test x"${with_tclconfig}" != x; then + if test -f "${with_tclconfig}/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` + else + AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) + fi + fi + + # check in a few common install locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in `ls -d /usr/local/lib 2>/dev/null` ; do + if test -f "$i/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i; pwd)` + break + fi + done + fi + + ]) + + if test x"${ac_cv_c_tclconfig}" = x ; then + TCL_BIN_DIR="# no Tcl configs found" + AC_MSG_ERROR(can't find Tcl configuration definitions) + else + TCL_BIN_DIR=${ac_cv_c_tclconfig} + fi + AC_SUBST(TCL_BIN_DIR) +]) + +AC_DEFUN(SC_LOAD_TCLCONFIG, [ + AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) + + if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + AC_MSG_RESULT([loading]) + . $TCL_BIN_DIR/tclConfig.sh + else + AC_MSG_RESULT([file not found]) + fi + + # DBSQL requires at least version 8.4. + if test ${TCL_MAJOR_VERSION} -lt 8 \ + -o ${TCL_MAJOR_VERSION} -eq 8 -a ${TCL_MINOR_VERSION} -lt 4; then + AC_MSG_ERROR([Berkeley DB requires Tcl version 8.4 or better.]) + fi + + if test x"$TCL_INCLUDE_SPEC" != x; then + TCL_CFLAGS="$TCL_INCLUDE_SPEC" + fi + + AC_SUBST(TCL_LD_FLAGS) + AC_SUBST(TCL_LIBS) + AC_SUBST(TCL_LIB_SPEC) +]) + +# Optional Tcl API. +AC_DEFUN(AM_TCL_LOAD, [ +if test "$db_cv_tcl" = "yes"; then + if test `$LIBTOOL_PROG --config | grep build_libtool_libs | grep no` 2>/dev/null; then + AC_MSG_ERROR([Tcl requires shared libraries]) + fi + + SC_PATH_TCLCONFIG + SC_LOAD_TCLCONFIG + + if test x"$TCL_INCLUDE_SPEC" != x && test -f "$TCL_INCLUDE_SPEC/tcl.h"; then + TCL_CFLAGS="${TCL_CFLAGS} -I$TCL_INCLUDE_SPEC" + fi + + INSTALL_LIBS="${INSTALL_LIBS} \$(libtso_target)" + + TCL_TCLSH="${TCL_PREFIX}/bin/tclsh${TCL_VERSION}" + + AC_SUBST(TCL_SRC_DIR) + AC_SUBST(TCL_LIB_FILE) + AC_SUBST(TCL_CFLAGS) + AC_SUBST(TCL_TCLSH) +fi]) diff --git a/dist/aclocal/types.ac b/dist/aclocal/types.ac new file mode 100644 index 0000000..19811b9 --- /dev/null +++ b/dist/aclocal/types.ac @@ -0,0 +1,130 @@ +# $Id: types.ac 7 2007-02-03 13:34:17Z gburd $ + +# Check the sizes we know about, and see if any of them match what's needed. +# +# Prefer ints to anything else, because read, write and others historically +# returned an int. +AC_DEFUN(AM_SEARCH_USIZES, [ + case "$3" in + "$ac_cv_sizeof_unsigned_int") + $1="typedef unsigned int $2;";; + "$ac_cv_sizeof_unsigned_char") + $1="typedef unsigned char $2;";; + "$ac_cv_sizeof_unsigned_short") + $1="typedef unsigned short $2;";; + "$ac_cv_sizeof_unsigned_long") + $1="typedef unsigned long $2;";; + *) + AC_MSG_ERROR([No unsigned $3-byte integral type]);; + esac]) +AC_DEFUN(AM_SEARCH_SSIZES, [ + case "$3" in + "$ac_cv_sizeof_int") + $1="typedef int $2;";; + "$ac_cv_sizeof_char") + $1="typedef char $2;";; + "$ac_cv_sizeof_short") + $1="typedef short $2;";; + "$ac_cv_sizeof_long") + $1="typedef long $2;";; + *) + AC_MSG_ERROR([No signed $3-byte integral type]);; + esac]) + +# Check for the standard system types. +AC_DEFUN(AM_TYPES, [ + +# db.h includes and , not the other default includes +# autoconf usually includes. For that reason, we specify a set of includes +# for all type checking tests. [#5060] +# +# IBM's OS/390 and z/OS releases have types in not also found +# in . Include as well, if it exists. +AC_SUBST(inttypes_decl) +db_includes="#include " +AC_CHECK_HEADER(inttypes.h, [ + inttypes_decl="#include " + db_includes="$db_includes +#include "]) +db_includes="$db_includes +#include " + +# We need to know the sizes of various objects on this system. +# We don't use the SIZEOF_XXX values created by autoconf. +AC_CHECK_SIZEOF(char,, $db_includes) +AC_CHECK_SIZEOF(unsigned char,, $db_includes) +AC_CHECK_SIZEOF(short,, $db_includes) +AC_CHECK_SIZEOF(unsigned short,, $db_includes) +AC_CHECK_SIZEOF(int,, $db_includes) +AC_CHECK_SIZEOF(unsigned int,, $db_includes) +AC_CHECK_SIZEOF(long,, $db_includes) +AC_CHECK_SIZEOF(unsigned long,, $db_includes) +AC_CHECK_SIZEOF(size_t,, $db_includes) +AC_CHECK_SIZEOF(char *,, $db_includes) +AC_CHECK_SIZEOF(long double,, $db_includes) + +# We require off_t and size_t, and we don't try to substitute our own +# if we can't find them. +AC_CHECK_TYPE(off_t,, AC_MSG_ERROR([No off_t type.]), $db_includes) +AC_CHECK_TYPE(size_t,, AC_MSG_ERROR([No size_t type.]), $db_includes) + +# We look for u_char, u_short, u_int, u_long -- if we can't find them, +# we create our own. +AC_SUBST(u_char_decl) +AC_CHECK_TYPE(u_char,, + [u_char_decl="typedef unsigned char u_char;"], $db_includes) + +AC_SUBST(u_short_decl) +AC_CHECK_TYPE(u_short,, + [u_short_decl="typedef unsigned short u_short;"], $db_includes) + +AC_SUBST(u_int_decl) +AC_CHECK_TYPE(u_int,, + [u_int_decl="typedef unsigned int u_int;"], $db_includes) + +AC_SUBST(u_long_decl) +AC_CHECK_TYPE(u_long,, + [u_long_decl="typedef unsigned long u_long;"], $db_includes) + +AC_SUBST(u_int8_decl) +AC_CHECK_TYPE(u_int8_t,, + [AM_SEARCH_USIZES(u_int8_decl, u_int8_t, 1)], $db_includes) + +AC_SUBST(u_int16_decl) +AC_CHECK_TYPE(u_int16_t,, + [AM_SEARCH_USIZES(u_int16_decl, u_int16_t, 2)], $db_includes) + +AC_SUBST(int16_decl) +AC_CHECK_TYPE(int16_t,, + [AM_SEARCH_SSIZES(int16_decl, int16_t, 2)], $db_includes) + +AC_SUBST(u_int32_decl) +AC_CHECK_TYPE(u_int32_t,, + [AM_SEARCH_USIZES(u_int32_decl, u_int32_t, 4)], $db_includes) + +AC_SUBST(int32_decl) +AC_CHECK_TYPE(int32_t,, + [AM_SEARCH_SSIZES(int32_decl, int32_t, 4)], $db_includes) + +AC_SUBST(long_double_decl) +AC_CHECK_TYPE(long double, + [long_double_decl="typedef long double long_double_t;"], + [long_double_decl="typedef long double long_double_t;"], $db_includes) + +# Check for ssize_t -- if none exists, find a signed integral type that's +# the same size as a size_t. +AC_SUBST(ssize_t_decl) +AC_CHECK_TYPE(ssize_t,, + [AM_SEARCH_SSIZES(ssize_t_decl, ssize_t, $ac_cv_sizeof_size_t)], + $db_includes) + +# Find the largest integral type. +AC_SUBST(db_align_t_decl) +AC_CHECK_TYPE(unsigned long long, + [db_align_t_decl="typedef unsigned long long db_align_t;"], + [db_align_t_decl="typedef unsigned long db_align_t;"], $db_includes) + +# Find an integral type which is the same size as a pointer. +AC_SUBST(db_alignp_t_decl) +AM_SEARCH_USIZES(db_alignp_t_decl, db_alignp_t, $ac_cv_sizeof_char_p) +]) diff --git a/dist/buildrel b/dist/buildrel new file mode 100644 index 0000000..d5a1a78 --- /dev/null +++ b/dist/buildrel @@ -0,0 +1,138 @@ +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: buildrel 7 2007-02-03 13:34:17Z gburd $ +# +# Build the distribution package. +# +# A set of commands intended to be cut and pasted into a csh window. + +# Development tree, release home. +setenv D `pwd` + +# Update the release number. +cd $D/dist +cvs -q update RELEASE +vi RELEASE +setenv VERSION `sh -c '. RELEASE; echo $DB_VERSION'` +echo "Version: $VERSION" + +# Make sure the source tree is up-to-date +cd $D && cvs -q update + +# Build the documentation. +cd db.docs && cvs -q update +cd db.docs && sh build ../db.rel clean && sh build ../db.rel |& sed '/.html$/d' +cd db.docs && sh build ../db.rel javadoc + +# Generate new support files, commit anything that's changed. +cd $D/dist && sh s_all +cd $D && cvs -q commit + +# Copy a development tree into a release tree. +setenv R /var/tmp/db-$VERSION +rm -rf $R && mkdir -p $R +cd $D && cvs -q status | \ + grep "Repository revision" | \ + sed -e 's;.*CVSROOT/db/;;' \ + -e 's;.*CVSROOT/;;' \ + -e 's;,v$;;' | pax -rw $R/ + +# Copy the already-built documentation into place +rm -rf $R/docs && cp -r $D/docs $R/docs + +# Remove source directories we don't distribute. +cd $R && rm -rf docs_src docs/api_java +cd $R && rm -rf test/TODO test/upgrade test_perf test_purify +cd $R && rm -rf test_server test_thread test_vxworks test_xa +cd $R && rm -rf java/src/com/sleepycat/xa + +# Fix symbolic links and permissions. +cd $R/dist && sh s_perm +cd $R/dist && sh s_symlink + +# Build a version. +cd $R && rm -rf build_run && mkdir build_run +cd $R/build_run && ~bostic/bin/dbconf && make >& mklog + +# Smoke test. +cd $R/build_run && ./ex_access + +# Check the install +cd $R/build_run && make prefix=`pwd`/BDB install + +# Build a small-footprint version. +cd $R && rm -rf build_run && mkdir build_run +cd $R/build_run && ../dist/configure --enable-smallbuild && make >& mklog + +# Remove the build directory +cd $R && rm -rf build_run + +# ACQUIRE ROOT PRIVILEGES +cd $R && find . -type d | xargs chmod 775 +cd $R && find . -type f | xargs chmod 444 +cd $R && chmod 664 build_win32/*.dsp +cd $R/dist && sh s_perm +chown -R 100 $R +chgrp -R 100 $R +# DISCARD ROOT PRIVILEGES + +# Create the crypto tar archive release. +setenv T "$R/../db-$VERSION.tar.gz" +cd $R/.. && tar cf - db-$VERSION | gzip --best > $T +chmod 444 $T + +# Create the non-crypto tree. +setenv RNC "$R/../db-$VERSION.NC" +rm -rf $RNC $R/../__TMP && mkdir $R/../__TMP +cd $R/../__TMP && gzcat $T | tar xpf - && mv -i db-$VERSION $RNC +cd $R && rm -rf $R/../__TMP +cd $RNC/dist && sh s_crypto + +# ACQUIRE ROOT PRIVILEGES +cd $RNC && find . -type d | xargs chmod 775 +cd $RNC && find . -type f | xargs chmod 444 +cd $RNC && chmod 664 build_win32/*.dsp +cd $RNC/dist && sh s_perm +chown -R 100 $RNC +chgrp -R 100 $RNC +# DISCARD ROOT PRIVILEGES + +# Create the non-crypto tar archive release. +setenv T "$R/../db-$VERSION.NC.tar.gz" +cd $RNC/.. && tar cf - db-$VERSION.NC | gzip --best > $T +chmod 444 $T + +# Remove tags files. They're large and we don't want to store symbolic links +# in the zip archive for portability reasons. +# ACQUIRE ROOT PRIVILEGES +cd $R && rm -f `find . -name 'tags'` +cd $RNC && rm -f `find . -name 'tags'` +# DISCARD ROOT PRIVILEGES + +# Create the crypto zip archive release. +setenv T "$R/../db-$VERSION.zip" +cd $R/.. && zip -r - db-$VERSION > $T +chmod 444 $T + +# Create the non-crypto zip archive release. +setenv T "$R/../db-$VERSION.NC.zip" +cd $RNC/.. && zip -r - db-$VERSION.NC > $T +chmod 444 $T diff --git a/dist/config.guess b/dist/config.guess new file mode 100644 index 0000000..d56c46d --- /dev/null +++ b/dist/config.guess @@ -0,0 +1,1410 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-08-18' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha*:OpenVMS:*:*) + echo alpha-hp-vms + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + *:UNICOS/mp:*:*) + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + # GNU/FreeBSD systems have a "k" prefix to indicate we are using + # FreeBSD's kernel, but not the complete OS. + case ${LIBC} in gnu) kernel_only='k' ;; esac + echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + case `uname -p` in + *86) UNAME_PROCESSOR=i686 ;; + powerpc) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +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` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/dist/config.hin b/dist/config.hin new file mode 100644 index 0000000..fa0ddaf --- /dev/null +++ b/dist/config.hin @@ -0,0 +1,223 @@ +/* config.hin. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you want a TCL API with test support. */ +#undef CONFIG_TEST + +/* Define to use ISO8859 string encoding. */ +#undef DBSQL_ISO8859_ENCODING + +/* Define to 1 to omit authorization code from the build. */ +#undef DBSQL_OMIT_AUTHORIZATION + +/* Define to 1 to omit support for datetime functions from the build. */ +#undef DBSQL_OMIT_DATETIME_FUNCS + +/* Define to 1 to omit the code for the VACCUM command from the build. */ +#undef DBSQL_OMIT_VACUUM + +/* Define use UTF8 string encoding. */ +#undef DBSQL_UTF8_ENCODING + +/* We use DBSQL_WIN32 much as one would use _WIN32 -- to specify that we're + using an operating system environment that supports Win32 calls and + semantics. We don't use _WIN32 because Cygwin/GCC also defines _WIN32, even + though Cygwin/GCC closely emulates the Unix environment. */ +#undef DBSQL_WIN32 + +/* Define to 1 if you want a debugging version. */ +#undef DEBUG + +/* Define to 1 if you want a version with run-time diagnostic checking. */ +#undef DIAGNOSTIC + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have EXIT_SUCCESS/EXIT_FAILURE #defines. */ +#undef HAVE_EXIT_SUCCESS + +/* Define to 1 if allocated filesystem blocks are not zeroed. */ +#undef HAVE_FILESYSTEM_NOTZERO + +/* Define to 1 if you have the `getopt' function. */ +#undef HAVE_GETOPT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `localtime_r' function. */ +#undef HAVE_LOCALTIME_R + +/* Define to 1 if you have the `lrand48_r' function. */ +#undef HAVE_LRAND48_R + +/* Define to 1 if you have the `memcmp' function. */ +#undef HAVE_MEMCMP + +/* Define to 1 if you have the `memcpy' function. */ +#undef HAVE_MEMCPY + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if building on QNX. */ +#undef HAVE_QNX + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the `srand48_r' function. */ +#undef HAVE_SRAND48_R + +/* Define to 1 if building statistics support. */ +#undef HAVE_STATISTICS + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strncasecmp' function. */ +#undef HAVE_STRNCASECMP + +/* Define to 1 if you have the `strndup' function. */ +#undef HAVE_STRNDUP + +/* Define to 1 if `st_blksize' is member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BLKSIZE + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FCNTL_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if unlink of file with open file descriptors will fail. */ +#undef HAVE_UNLINK_WITH_OPEN_FAILURE + +/* Define to 1 if you have the `usleep' function. */ +#undef HAVE_USLEEP + +/* Define to 1 to enable memory resident databases. */ +#undef INMEMORYDB + +/* 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 `char', as computed by sizeof. */ +#undef SIZEOF_CHAR + +/* The size of `char *', as computed by sizeof. */ +#undef SIZEOF_CHAR_P + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `long double', as computed by sizeof. */ +#undef SIZEOF_LONG_DOUBLE + +/* The size of `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* The size of `unsigned char', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_CHAR + +/* The size of `unsigned int', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_INT + +/* The size of `unsigned long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG + +/* The size of `unsigned short', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_SHORT + +/* Define to 1 if the `S_IS*' macros in do not work properly. */ +#undef STAT_MACROS_BROKEN + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Determines where TEMP databases can be stored, see table in source code. */ +#undef TEMP_STORE + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* + * Exit success/failure macros. + */ +#ifndef HAVE_EXIT_SUCCESS +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#endif + +#ifdef DBSQL_WIN32 +#include "win_dbsql.h" +#endif diff --git a/dist/config.sub b/dist/config.sub new file mode 100644 index 0000000..6890099 --- /dev/null +++ b/dist/config.sub @@ -0,0 +1,1508 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-08-18' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | msp430-* \ + | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nv1) + basic_machine=nv1-cray + os=-unicosmp + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/dist/configure b/dist/configure new file mode 100644 index 0000000..3a88030 --- /dev/null +++ b/dist/configure @@ -0,0 +1,33132 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.60 for DBSQL 0.2.2. +# +# Report bugs to . +# +# 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 Bourne compatible +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 +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + + +# 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 /usr/bin/posix$PATH_SEPARATOR/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 +# Be Bourne compatible +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 +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +# Be Bourne compatible +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 +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +: +(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 autoconf@gnu.org 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 + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# 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'" + + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +tagnames=`echo "$tagnames,CXX" | sed 's/^,//'` + +tagnames=`echo "$tagnames,F77" | sed 's/^,//'` + +exec 7<&0 &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='DBSQL' +PACKAGE_TARNAME='dbsql-0.2.2' +PACKAGE_VERSION='0.2.2' +PACKAGE_STRING='DBSQL 0.2.2' +PACKAGE_BUGREPORT='support@dbsql.org' + +ac_unique_file="../src/clib/memcmp.c" +ac_default_prefix=/usr/local/DBSQL.0.2 +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#endif +#if HAVE_STDINT_H +# include +#endif +#if HAVE_UNISTD_H +# include +#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 +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +ADDITIONAL_INCS +ADDITIONAL_LANG +ADDITIONAL_OBJS +ADDITIONAL_PROGS +BUILD_TARGET +CFLAGS +CONFIGURATION_ARGS +CONFIGURATION_PATH +CPPFLAGS +CXX +CXXFLAGS +DB_PATH +DB_UNIQUE_NAME +DEFAULT_LIB +DEFAULT_LIB_CXX +ENCODING +INSTALLER +INSTALL_LIBS +INSTALL_TARGET +LDFLAGS +LIBSO_LIBS +LIBTOOL +LIBTSO_LIBS +LIBTSO_MODSUFFIX +LIBTSO_MODULE +LIBXSO_LIBS +LOAD_LIBS +MAKEFILE_CC +MAKEFILE_CCLINK +MAKEFILE_CXX +MAKEFILE_CXXLINK +MAKEFILE_SOLINK +MAKEFILE_XSOLINK +OSDIR +POSTLINK +REPLACEMENT_OBJS +RPC_CLIENT_OBJS +RPM_BUILD +RPM_POST_INSTALL +RPM_POST_UNINSTALL +SOFLAGS +o +DBSQL_VERSION_MAJOR +DBSQL_VERSION_MINOR +DBSQL_VERSION_PATCH +DBSQL_VERSION_STRING +DBSQL_VERSION_UNIQUE_NAME +db_cv_path_ar +db_cv_path_chmod +db_cv_path_sed +db_cv_path_perl +db_cv_path_makedepend +db_cv_path_splint +db_cv_path_python +db_cv_path_grep +db_cv_path_awk +db_cv_path_cp +path_ldconfig +db_cv_path_ldconfig +db_cv_path_ln +db_cv_path_mkdir +path_ranlib +db_cv_path_ranlib +db_cv_path_rm +db_cv_path_rpm +path_sh +db_cv_path_sh +path_strip +db_cv_path_strip +db_cv_path_kill +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +db_cv_build_tcl_test_objs +db_cv_build_type +CC +ac_ct_CC +EXEEXT +OBJEXT +DB_PROTO1 +DB_PROTO2 +DB_CONST +CCC +ac_ct_CXX +CXXCPP +cxx_have_stdheaders +GREP +EGREP +LN_S +ECHO +AR +RANLIB +STRIP +CPP +F77 +FFLAGS +ac_ct_F77 +SOSUFFIX +MODSUFFIX +TCL_BIN_DIR +TCL_LD_FLAGS +TCL_LIBS +TCL_LIB_SPEC +TCL_SRC_DIR +TCL_LIB_FILE +TCL_CFLAGS +TCL_TCLSH +inttypes_decl +u_char_decl +u_short_decl +u_int_decl +u_long_decl +u_int8_decl +u_int16_decl +int16_decl +u_int32_decl +int32_decl +long_double_decl +ssize_t_decl +db_align_t_decl +db_alignp_t_decl +LIBOBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +CPPFLAGS +CXX +CXXFLAGS +CCC +CXXCPP +CPP +F77 +FFLAGS' + + +# 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 DBSQL 0.2.2 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/dbsql-0.2.2] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of DBSQL 0.2.2:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-utf8-encoding Encode strings as UTF-8 or ISO-8859. + --enable-incore-databases + Enable incore databases for ATTACH and OPEN. + --enable-authentication Include authorization validation code. + --enable-vacuum Include the VACUUM command. + --enable-datetime Include datetime functions. + --enable-incore-temp-databases + Enable incore databases for temporary tables. + --disable-statistics Do not build statistics support. + --enable-sqlite-compat Build SQLite compatibility API. + --enable-soundex-sqlfn Include soundex() sql function support. + --enable-posixmutexes Force use of POSIX standard mutexes. + --enable-debug Build a debugging version. + --enable-diagnostic Build a version with run-time diagnostics. + --enable-tcl Build Tcl API. + --enable-test Configure to run the test suite. + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-berkeleydb=DIR Path of Berkeley DB. + [DIR="/usr/local/BerkeleyDB.4.5"] + --with-db-uniquename=NAME + Unique name used when building DB library. + --with-tcl=DIR Directory location of tclConfig.sh. + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-tags[=TAGS] include additional configurations [automatic] + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + CPP C preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags + +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 . +_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 +DBSQL configure 0.2.2 +generated by GNU Autoconf 2.60 + +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 DBSQL $as_me 0.2.2, which was +generated by GNU Autoconf 2.60. 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 + + + +ac_config_headers="$ac_config_headers dbsql_config.h:config.hin" + + +# Configure setup. +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + 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 \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&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. + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6; } +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm -f conftest.sed + + +# Don't build in the top-level or dist directories. +{ echo "$as_me:$LINENO: checking if building in the top-level or dist directories" >&5 +echo $ECHO_N "checking if building in the top-level or dist directories... $ECHO_C" >&6; } +if test -d build_unix -o -d aclocal ; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + { { echo "$as_me:$LINENO: error: DBSQL should not be built in the top-level or dist directories." >&5 +echo "$as_me: error: DBSQL should not be built in the top-level or dist directories." >&2;} + { (exit 1); exit 1; }; } +fi +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + +# Substitution variables. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# RPM needs the current absolute path. +# RPM needs the list of original arguments, but we don't include the RPM +# option itself. +CONFIGURATION_PATH=${PWD-`pwd`} +CONFIGURATION_ARGS=`echo "$*" | sed -e 's/--with-rpm[^ ]*//'` + +# Set the default installation location. + + +# Configure the version information. + +DBSQL_VERSION_MAJOR="0" + +DBSQL_VERSION_MINOR="2" + +DBSQL_VERSION_PATCH="2" + +DBSQL_VERSION_STRING='"DBSQL 0.2.2: (March 10, 2007)"' + + +# Process all options before using them. + + +{ echo "$as_me:$LINENO: checking if --enable-utf8-encoding option specified" >&5 +echo $ECHO_N "checking if --enable-utf8-encoding option specified... $ECHO_C" >&6; } +# Check whether --enable-utf8-encoding was given. +if test "${enable_utf8_encoding+set}" = set; then + enableval=$enable_utf8_encoding; +else + enableval="yes" +fi + +db_cv_utf8_strings="$enableval" +case "$enableval" in + no) { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; };; +yes) { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; };; +esac +if test "$cv_utf8_strings" = "yes"; then + ENCODING=UTF8 + cat >>confdefs.h <<\_ACEOF +#define DBSQL_UTF8_ENCODING 1 +_ACEOF + +else + ENCODING=ISO8859 + cat >>confdefs.h <<\_ACEOF +#define DBSQL_ISO8859_ENCODING 1 +_ACEOF + +fi + + + + + + +{ echo "$as_me:$LINENO: checking if --enable-incore-databases option specified" >&5 +echo $ECHO_N "checking if --enable-incore-databases option specified... $ECHO_C" >&6; } +# Check whether --enable-incore-databases was given. +if test "${enable_incore_databases+set}" = set; then + enableval=$enable_incore_databases; +else + enableval="yes" +fi + +db_cv_incore_databases="$enableval" +case "$enableval" in + no) { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; };; +yes) { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; };; +esac +if test "$db_cv_incore_databases" = "no"; then + INMEMORYDB=0 +else + INMEMORYDB=1 +fi +cat >>confdefs.h <<\_ACEOF +#define INMEMORYDB 1 +_ACEOF + + + + +{ echo "$as_me:$LINENO: checking if --enable-authentication option specified" >&5 +echo $ECHO_N "checking if --enable-authentication option specified... $ECHO_C" >&6; } +# Check whether --enable-authentication was given. +if test "${enable_authentication+set}" = set; then + enableval=$enable_authentication; +else + enableval="yes" +fi + +db_cv_auth="$enableval" +case "$enableval" in + no) { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; };; +yes) { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; };; +esac +if test "$db_cv_auth" = "no"; then + cat >>confdefs.h <<\_ACEOF +#define DBSQL_OMIT_AUTHORIZATION 1 +_ACEOF + +fi + + + + +{ echo "$as_me:$LINENO: checking if --enable-vacuum option specified" >&5 +echo $ECHO_N "checking if --enable-vacuum option specified... $ECHO_C" >&6; } +# Check whether --enable-vacuum was given. +if test "${enable_vacuum+set}" = set; then + enableval=$enable_vacuum; +else + enableval="yes" +fi + +db_cv_auth="$enableval" +case "$enableval" in + no) { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; };; +yes) { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; };; +esac +if test "$db_cv_auth" = "no"; then + cat >>confdefs.h <<\_ACEOF +#define DBSQL_OMIT_VACUUM 1 +_ACEOF + +fi + + + +{ echo "$as_me:$LINENO: checking if --enable-datetime option specified" >&5 +echo $ECHO_N "checking if --enable-datetime option specified... $ECHO_C" >&6; } +# Check whether --enable-enable-datetime was given. +if test "${enable_enable_datetime+set}" = set; then + enableval=$enable_enable_datetime; +else + enableval="yes" +fi + +db_cv_datetime="$enableval" +case "$enableval" in + no) { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; };; +yes) { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; };; +esac +if test "$db_cv_datetime" = "no"; then + cat >>confdefs.h <<\_ACEOF +#define DBSQL_OMIT_DATETIME_FUNCS 1 +_ACEOF + + +fi + + + + +{ echo "$as_me:$LINENO: checking if --with-berkeleydb=DIR option specified" >&5 +echo $ECHO_N "checking if --with-berkeleydb=DIR option specified... $ECHO_C" >&6; } + +# Check whether --with-berkeleydb was given. +if test "${with_berkeleydb+set}" = set; then + withval=$with_berkeleydb; with_berkeleydb="$withval" +else + with_berkeleydb="no" +fi + +{ echo "$as_me:$LINENO: result: $with_berkeleydb" >&5 +echo "${ECHO_T}$with_berkeleydb" >&6; } +# If --with-berkeleydb isn't specified, assume it's here | wc -l` -gt 0 +if test "$with_berkeleydb" = "no"; then + with_berkeleydb="/usr/local/BerkeleyDB.4.5" +fi +DB_PATH="$with_berkeleydb" +if test `ls "$with_berkeleydb"/lib/libdb-*.la 2>/dev/null | wc -l` -gt 0 ; then + { echo "$as_me:$LINENO: checking for Berkeley DB version from install tree" >&5 +echo $ECHO_N "checking for Berkeley DB version from install tree... $ECHO_C" >&6; } + db_version=`ls "$with_berkeleydb"/lib/libdb-*.la | sed 's/.*db-\(.*\).la/\1/'` + { echo "$as_me:$LINENO: result: $db_version" >&5 +echo "${ECHO_T}$db_version" >&6; } + echo "$CPPFLAGS" | grep "$with_berkeleydb/include" >/dev/null 2>&1 || CPPFLAGS="$CPPFLAGS -I$with_berkeleydb/include" + if test `ls "$with_berkeleydb"/lib/libdb-$db_version.* 2>/dev/null | wc -l` -gt 0 ; then + LIBSO_LIBS="$LIBS -L$with_berkeleydb/lib -ldb-$db_version" + else + LIBS="$LIBS -l$with_berkeleydb/lib/libdb-$db_version.a" + fi +elif test `ls /usr/local/lib/db?? 2>/dev/null | wc -l` -gt 0 ; then + { echo "$as_me:$LINENO: checking if Berkeley DB was installed using BSD ports" >&5 +echo $ECHO_N "checking if Berkeley DB was installed using BSD ports... $ECHO_C" >&6; } + db_num=`ls /usr/local/lib | grep db | grep -v lib | sed -e 's/db//' | sort -n | head -1` + db_version=`echo $db_num | sed 's/\(.\)\(.\)/\1.\2/'` + { echo "$as_me:$LINENO: result: yes, $db_version" >&5 +echo "${ECHO_T}yes, $db_version" >&6; } + echo "$CPPFLAGS" | grep /usr/local/include/db$db_num >/dev/null 2>&1 || CPPFLAGS="$CPPFLAGS -I/usr/local/include/db$db_num" + if test `ls /usr/local/lib/libdb-$db_version.* 2>/dev/null | wc -l` -gt 0 ; then + LIBSO_LIBS="$LIBS -L/usr/local/lib -ldb-$db_version" + else + LIBS="$LIBS -l/usr/local/lib/libdb-$db_version.a" + fi +else + { { echo "$as_me:$LINENO: error: $with_berkeleydb not a valid Berkeley DB install tree." >&5 +echo "$as_me: error: $with_berkeleydb not a valid Berkeley DB install tree." >&2;} + { (exit 1); exit 1; }; } +fi + +{ echo "$as_me:$LINENO: checking if --with-db-uniquename=NAME option specified" >&5 +echo $ECHO_N "checking if --with-db-uniquename=NAME option specified... $ECHO_C" >&6; } + +# Check whether --with-db-uniquename was given. +if test "${with_db_uniquename+set}" = set; then + withval=$with_db_uniquename; with_db_uniquename="$withval" +else + with_db_uniquename="no" +fi + +if test "$with_db_uniquename" = "no"; then + db_cv_uniquename="no" + DB_UNIQUE_NAME="" + { echo "$as_me:$LINENO: result: $with_db_uniquename" >&5 +echo "${ECHO_T}$with_db_uniquename" >&6; } +else + db_cv_uniquename="yes" + if test "$with_db_uniquename" = "yes"; then + DB_UNIQUE_NAME="__EDIT_DB_VERSION_UNIQUE_NAME__" + else + DB_UNIQUE_NAME="$with_db_uniquename" + fi + { echo "$as_me:$LINENO: result: $DB_UNIQUE_NAME" >&5 +echo "${ECHO_T}$DB_UNIQUE_NAME" >&6; } +fi + +{ echo "$as_me:$LINENO: checking if --enable-incore-temp-databases option specified" >&5 +echo $ECHO_N "checking if --enable-incore-temp-databases option specified... $ECHO_C" >&6; } +# Check whether --enable-incore-temp-databases was given. +if test "${enable_incore_temp_databases+set}" = set; then + enableval=$enable_incore_temp_databases; +else + enableval="no" +fi + +db_cv_incore_temp_databases="$enableval" +case "$db_cv_incore_temp_databases" in + never) + TEMP_STORE=0 + { echo "$as_me:$LINENO: result: never" >&5 +echo "${ECHO_T}never" >&6; } + ;; + no) + INMEMORYDB=1 + TEMP_STORE=1 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + ;; + always) + INMEMORYDB=1 + TEMP_STORE=3 + { echo "$as_me:$LINENO: result: always" >&5 +echo "${ECHO_T}always" >&6; } + ;; + *) + INMEMORYDB=1 + TEMP_STORE=2 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + ;; +esac +cat >>confdefs.h <<\_ACEOF +#define INMEMORYDB 1 +_ACEOF + + + +cat >>confdefs.h <<\_ACEOF +#define TEMP_STORE 1 +_ACEOF + + + + +{ echo "$as_me:$LINENO: checking if --disable-statistics option specified" >&5 +echo $ECHO_N "checking if --disable-statistics option specified... $ECHO_C" >&6; } +# Check whether --enable-statistics was given. +if test "${enable_statistics+set}" = set; then + enableval=$enable_statistics; +else + enableval="yes" +fi + +db_cv_build_statistics="$enableval" +case "$enableval" in + no) { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; };; +yes) { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; };; +esac + +{ echo "$as_me:$LINENO: checking if --enable-sqlite-compat option specified" >&5 +echo $ECHO_N "checking if --enable-sqlite-compat option specified... $ECHO_C" >&6; } +# Check whether --enable-sqlite-compat was given. +if test "${enable_sqlite_compat+set}" = set; then + enableval=$enable_sqlite_compat; db_cv_sqlite_compat="$enable_sqlite_compat" +else + db_cv_sqlite_compat="no" +fi + +{ echo "$as_me:$LINENO: result: $db_cv_sqlite_compat" >&5 +echo "${ECHO_T}$db_cv_sqlite_compat" >&6; } + +{ echo "$as_me:$LINENO: checking if --enable-soundex-sqlfn option specified" >&5 +echo $ECHO_N "checking if --enable-soundex-sqlfn option specified... $ECHO_C" >&6; } +# Check whether --enable-soundex-sqlfn was given. +if test "${enable_soundex_sqlfn+set}" = set; then + enableval=$enable_soundex_sqlfn; db_cv_sqlite_compat="$enable_soundex_sqlfn" +else + db_cv_sqlite_compat="no" +fi + +{ echo "$as_me:$LINENO: result: $db_cv_soundex_sqlfn" >&5 +echo "${ECHO_T}$db_cv_soundex_sqlfn" >&6; } + +{ echo "$as_me:$LINENO: checking if --enable-posixmutexes option specified" >&5 +echo $ECHO_N "checking if --enable-posixmutexes option specified... $ECHO_C" >&6; } +# Check whether --enable-posixmutexes was given. +if test "${enable_posixmutexes+set}" = set; then + enableval=$enable_posixmutexes; db_cv_posixmutexes="$enable_posixmutexes" +else + db_cv_posixmutexes="no" +fi + +{ echo "$as_me:$LINENO: result: $db_cv_posixmutexes" >&5 +echo "${ECHO_T}$db_cv_posixmutexes" >&6; } + +{ echo "$as_me:$LINENO: checking if --enable-debug option specified" >&5 +echo $ECHO_N "checking if --enable-debug option specified... $ECHO_C" >&6; } +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then + enableval=$enable_debug; db_cv_debug="$enable_debug" +else + db_cv_debug="no" +fi + +{ echo "$as_me:$LINENO: result: $db_cv_debug" >&5 +echo "${ECHO_T}$db_cv_debug" >&6; } + +{ echo "$as_me:$LINENO: checking if --enable-diagnostic option specified" >&5 +echo $ECHO_N "checking if --enable-diagnostic option specified... $ECHO_C" >&6; } +# Check whether --enable-diagnostic was given. +if test "${enable_diagnostic+set}" = set; then + enableval=$enable_diagnostic; db_cv_diagnostic="$enable_diagnostic" +else + db_cv_diagnostic="no" +fi + +{ echo "$as_me:$LINENO: result: $db_cv_diagnostic" >&5 +echo "${ECHO_T}$db_cv_diagnostic" >&6; } + +{ echo "$as_me:$LINENO: checking if --enable-tcl option specified" >&5 +echo $ECHO_N "checking if --enable-tcl option specified... $ECHO_C" >&6; } +# Check whether --enable-tcl was given. +if test "${enable_tcl+set}" = set; then + enableval=$enable_tcl; db_cv_tcl="$enable_tcl" +else + db_cv_tcl="no" +fi + +{ echo "$as_me:$LINENO: result: $db_cv_tcl" >&5 +echo "${ECHO_T}$db_cv_tcl" >&6; } + +{ echo "$as_me:$LINENO: checking if --with-tcl=DIR option specified" >&5 +echo $ECHO_N "checking if --with-tcl=DIR option specified... $ECHO_C" >&6; } + +# Check whether --with-tcl was given. +if test "${with_tcl+set}" = set; then + withval=$with_tcl; with_tclconfig="$withval" +else + with_tclconfig="no" +fi + +{ echo "$as_me:$LINENO: result: $with_tclconfig" >&5 +echo "${ECHO_T}$with_tclconfig" >&6; } + +{ echo "$as_me:$LINENO: checking if --enable-test option specified" >&5 +echo $ECHO_N "checking if --enable-test option specified... $ECHO_C" >&6; } +# Check whether --enable-test was given. +if test "${enable_test+set}" = set; then + enableval=$enable_test; db_cv_test="$enable_test" +else + db_cv_test="no" +fi + +{ echo "$as_me:$LINENO: result: $db_cv_test" >&5 +echo "${ECHO_T}$db_cv_test" >&6; } + +# Test requires Tcl +if test "$db_cv_test" = "yes"; then + if test "$db_cv_tcl" = "no"; then + { { echo "$as_me:$LINENO: error: --enable-test requires --enable-tcl" >&5 +echo "$as_me: error: --enable-test requires --enable-tcl" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# Set some #defines based on configuration options. +if test "$db_cv_diagnostic" = "yes"; then + cat >>confdefs.h <<\_ACEOF +#define DIAGNOSTIC 1 +_ACEOF + + + +fi +if test "$db_cv_test" = "yes"; then + cat >>confdefs.h <<\_ACEOF +#define CONFIG_TEST 1 +_ACEOF + + + +fi + +# Check for programs used in building and installation. + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; 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_db_cv_path_ar+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_ar"; then + ac_cv_prog_db_cv_path_ar="$db_cv_path_ar" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_ar="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_ar=$ac_cv_prog_db_cv_path_ar +if test -n "$db_cv_path_ar"; then + { echo "$as_me:$LINENO: result: $db_cv_path_ar" >&5 +echo "${ECHO_T}$db_cv_path_ar" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_ar"; then + ac_ct_db_cv_path_ar=$db_cv_path_ar + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; 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_db_cv_path_ar+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_ar"; then + ac_cv_prog_ac_ct_db_cv_path_ar="$ac_ct_db_cv_path_ar" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_ar="ar" + 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_db_cv_path_ar=$ac_cv_prog_ac_ct_db_cv_path_ar +if test -n "$ac_ct_db_cv_path_ar"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_ar" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_ar" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_ar" = x; then + db_cv_path_ar="missing_ar" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_ar=$ac_ct_db_cv_path_ar + fi +else + db_cv_path_ar="$ac_cv_prog_db_cv_path_ar" +fi + +if test "$db_cv_path_ar" = missing_ar; then + { { echo "$as_me:$LINENO: error: No ar utility found." >&5 +echo "$as_me: error: No ar utility found." >&2;} + { (exit 1); exit 1; }; } +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}chmod", so it can be a program name with args. +set dummy ${ac_tool_prefix}chmod; 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_db_cv_path_chmod+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_chmod"; then + ac_cv_prog_db_cv_path_chmod="$db_cv_path_chmod" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_chmod="${ac_tool_prefix}chmod" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_chmod=$ac_cv_prog_db_cv_path_chmod +if test -n "$db_cv_path_chmod"; then + { echo "$as_me:$LINENO: result: $db_cv_path_chmod" >&5 +echo "${ECHO_T}$db_cv_path_chmod" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_chmod"; then + ac_ct_db_cv_path_chmod=$db_cv_path_chmod + # Extract the first word of "chmod", so it can be a program name with args. +set dummy chmod; 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_db_cv_path_chmod+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_chmod"; then + ac_cv_prog_ac_ct_db_cv_path_chmod="$ac_ct_db_cv_path_chmod" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_chmod="chmod" + 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_db_cv_path_chmod=$ac_cv_prog_ac_ct_db_cv_path_chmod +if test -n "$ac_ct_db_cv_path_chmod"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_chmod" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_chmod" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_chmod" = x; then + db_cv_path_chmod="missing_chmod" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_chmod=$ac_ct_db_cv_path_chmod + fi +else + db_cv_path_chmod="$ac_cv_prog_db_cv_path_chmod" +fi + +if test "$db_cv_path_chmod" = missing_chmod; then + { { echo "$as_me:$LINENO: error: No chmod utility found." >&5 +echo "$as_me: error: No chmod utility found." >&2;} + { (exit 1); exit 1; }; } +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}sed", so it can be a program name with args. +set dummy ${ac_tool_prefix}sed; 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_db_cv_path_sed+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_sed"; then + ac_cv_prog_db_cv_path_sed="$db_cv_path_sed" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_sed="${ac_tool_prefix}sed" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_sed=$ac_cv_prog_db_cv_path_sed +if test -n "$db_cv_path_sed"; then + { echo "$as_me:$LINENO: result: $db_cv_path_sed" >&5 +echo "${ECHO_T}$db_cv_path_sed" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_sed"; then + ac_ct_db_cv_path_sed=$db_cv_path_sed + # Extract the first word of "sed", so it can be a program name with args. +set dummy sed; 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_db_cv_path_sed+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_sed"; then + ac_cv_prog_ac_ct_db_cv_path_sed="$ac_ct_db_cv_path_sed" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_sed="sed" + 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_db_cv_path_sed=$ac_cv_prog_ac_ct_db_cv_path_sed +if test -n "$ac_ct_db_cv_path_sed"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_sed" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_sed" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_sed" = x; then + db_cv_path_sed="missing_sed" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_sed=$ac_ct_db_cv_path_sed + fi +else + db_cv_path_sed="$ac_cv_prog_db_cv_path_sed" +fi + +if test "$db_cv_path_sed" = missing_sed; then + { { echo "$as_me:$LINENO: error: No sed utility found." >&5 +echo "$as_me: error: No sed utility found." >&2;} + { (exit 1); exit 1; }; } +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}perl", so it can be a program name with args. +set dummy ${ac_tool_prefix}perl; 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_db_cv_path_perl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_perl"; then + ac_cv_prog_db_cv_path_perl="$db_cv_path_perl" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_perl="${ac_tool_prefix}perl" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_perl=$ac_cv_prog_db_cv_path_perl +if test -n "$db_cv_path_perl"; then + { echo "$as_me:$LINENO: result: $db_cv_path_perl" >&5 +echo "${ECHO_T}$db_cv_path_perl" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_perl"; then + ac_ct_db_cv_path_perl=$db_cv_path_perl + # Extract the first word of "perl", so it can be a program name with args. +set dummy perl; 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_db_cv_path_perl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_perl"; then + ac_cv_prog_ac_ct_db_cv_path_perl="$ac_ct_db_cv_path_perl" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_perl="perl" + 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_db_cv_path_perl=$ac_cv_prog_ac_ct_db_cv_path_perl +if test -n "$ac_ct_db_cv_path_perl"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_perl" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_perl" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_perl" = x; then + db_cv_path_perl="missing_perl" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_perl=$ac_ct_db_cv_path_perl + fi +else + db_cv_path_perl="$ac_cv_prog_db_cv_path_perl" +fi + +if test "$db_cv_path_perl" = missing_perl; then + { { echo "$as_me:$LINENO: error: No perl utility found." >&5 +echo "$as_me: error: No perl utility found." >&2;} + { (exit 1); exit 1; }; } +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}makedepend", so it can be a program name with args. +set dummy ${ac_tool_prefix}makedepend; 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_db_cv_path_makedepend+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_makedepend"; then + ac_cv_prog_db_cv_path_makedepend="$db_cv_path_makedepend" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_makedepend="${ac_tool_prefix}makedepend" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_makedepend=$ac_cv_prog_db_cv_path_makedepend +if test -n "$db_cv_path_makedepend"; then + { echo "$as_me:$LINENO: result: $db_cv_path_makedepend" >&5 +echo "${ECHO_T}$db_cv_path_makedepend" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_makedepend"; then + ac_ct_db_cv_path_makedepend=$db_cv_path_makedepend + # Extract the first word of "makedepend", so it can be a program name with args. +set dummy makedepend; 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_db_cv_path_makedepend+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_makedepend"; then + ac_cv_prog_ac_ct_db_cv_path_makedepend="$ac_ct_db_cv_path_makedepend" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_makedepend="makedepend" + 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_db_cv_path_makedepend=$ac_cv_prog_ac_ct_db_cv_path_makedepend +if test -n "$ac_ct_db_cv_path_makedepend"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_makedepend" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_makedepend" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_makedepend" = x; then + db_cv_path_makedepend="missing_makedepend" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_makedepend=$ac_ct_db_cv_path_makedepend + fi +else + db_cv_path_makedepend="$ac_cv_prog_db_cv_path_makedepend" +fi + +if test "$db_cv_path_makedepend" = missing_makedepend; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + db_cv_path_makedepend=echo +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}splint", so it can be a program name with args. +set dummy ${ac_tool_prefix}splint; 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_db_cv_path_splint+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_splint"; then + ac_cv_prog_db_cv_path_splint="$db_cv_path_splint" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_splint="${ac_tool_prefix}splint" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_splint=$ac_cv_prog_db_cv_path_splint +if test -n "$db_cv_path_splint"; then + { echo "$as_me:$LINENO: result: $db_cv_path_splint" >&5 +echo "${ECHO_T}$db_cv_path_splint" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_splint"; then + ac_ct_db_cv_path_splint=$db_cv_path_splint + # Extract the first word of "splint", so it can be a program name with args. +set dummy splint; 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_db_cv_path_splint+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_splint"; then + ac_cv_prog_ac_ct_db_cv_path_splint="$ac_ct_db_cv_path_splint" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_splint="splint" + 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_db_cv_path_splint=$ac_cv_prog_ac_ct_db_cv_path_splint +if test -n "$ac_ct_db_cv_path_splint"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_splint" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_splint" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_splint" = x; then + db_cv_path_splint="missing_splint" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_splint=$ac_ct_db_cv_path_splint + fi +else + db_cv_path_splint="$ac_cv_prog_db_cv_path_splint" +fi + +if test "$db_cv_path_splint" = missing_splint; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + db_cv_path_splint=echo +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}python", so it can be a program name with args. +set dummy ${ac_tool_prefix}python; 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_db_cv_path_python+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_python"; then + ac_cv_prog_db_cv_path_python="$db_cv_path_python" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_python="${ac_tool_prefix}python" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_python=$ac_cv_prog_db_cv_path_python +if test -n "$db_cv_path_python"; then + { echo "$as_me:$LINENO: result: $db_cv_path_python" >&5 +echo "${ECHO_T}$db_cv_path_python" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_python"; then + ac_ct_db_cv_path_python=$db_cv_path_python + # Extract the first word of "python", so it can be a program name with args. +set dummy python; 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_db_cv_path_python+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_python"; then + ac_cv_prog_ac_ct_db_cv_path_python="$ac_ct_db_cv_path_python" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_python="python" + 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_db_cv_path_python=$ac_cv_prog_ac_ct_db_cv_path_python +if test -n "$ac_ct_db_cv_path_python"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_python" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_python" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_python" = x; then + db_cv_path_python="missing_python" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_python=$ac_ct_db_cv_path_python + fi +else + db_cv_path_python="$ac_cv_prog_db_cv_path_python" +fi + +if test "$db_cv_path_python" = missing_python; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + db_cv_path_python=echo +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}grep", so it can be a program name with args. +set dummy ${ac_tool_prefix}grep; 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_db_cv_path_grep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_grep"; then + ac_cv_prog_db_cv_path_grep="$db_cv_path_grep" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_grep="${ac_tool_prefix}grep" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_grep=$ac_cv_prog_db_cv_path_grep +if test -n "$db_cv_path_grep"; then + { echo "$as_me:$LINENO: result: $db_cv_path_grep" >&5 +echo "${ECHO_T}$db_cv_path_grep" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_grep"; then + ac_ct_db_cv_path_grep=$db_cv_path_grep + # Extract the first word of "grep", so it can be a program name with args. +set dummy grep; 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_db_cv_path_grep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_grep"; then + ac_cv_prog_ac_ct_db_cv_path_grep="$ac_ct_db_cv_path_grep" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_grep="grep" + 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_db_cv_path_grep=$ac_cv_prog_ac_ct_db_cv_path_grep +if test -n "$ac_ct_db_cv_path_grep"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_grep" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_grep" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_grep" = x; then + db_cv_path_grep="missing_grep" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_grep=$ac_ct_db_cv_path_grep + fi +else + db_cv_path_grep="$ac_cv_prog_db_cv_path_grep" +fi + +if test "$db_cv_path_grep" = missing_grep; then + { { echo "$as_me:$LINENO: error: No grep utility found." >&5 +echo "$as_me: error: No grep utility found." >&2;} + { (exit 1); exit 1; }; } +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}awk", so it can be a program name with args. +set dummy ${ac_tool_prefix}awk; 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_db_cv_path_awk+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_awk"; then + ac_cv_prog_db_cv_path_awk="$db_cv_path_awk" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_awk="${ac_tool_prefix}awk" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_awk=$ac_cv_prog_db_cv_path_awk +if test -n "$db_cv_path_awk"; then + { echo "$as_me:$LINENO: result: $db_cv_path_awk" >&5 +echo "${ECHO_T}$db_cv_path_awk" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_awk"; then + ac_ct_db_cv_path_awk=$db_cv_path_awk + # Extract the first word of "awk", so it can be a program name with args. +set dummy awk; 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_db_cv_path_awk+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_awk"; then + ac_cv_prog_ac_ct_db_cv_path_awk="$ac_ct_db_cv_path_awk" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_awk="awk" + 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_db_cv_path_awk=$ac_cv_prog_ac_ct_db_cv_path_awk +if test -n "$ac_ct_db_cv_path_awk"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_awk" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_awk" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_awk" = x; then + db_cv_path_awk="missing_awk" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_awk=$ac_ct_db_cv_path_awk + fi +else + db_cv_path_awk="$ac_cv_prog_db_cv_path_awk" +fi + +if test "$db_cv_path_awk" = missing_awk; then + { { echo "$as_me:$LINENO: error: No awk utility found." >&5 +echo "$as_me: error: No awk utility found." >&2;} + { (exit 1); exit 1; }; } +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cp", so it can be a program name with args. +set dummy ${ac_tool_prefix}cp; 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_db_cv_path_cp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_cp"; then + ac_cv_prog_db_cv_path_cp="$db_cv_path_cp" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_cp="${ac_tool_prefix}cp" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_cp=$ac_cv_prog_db_cv_path_cp +if test -n "$db_cv_path_cp"; then + { echo "$as_me:$LINENO: result: $db_cv_path_cp" >&5 +echo "${ECHO_T}$db_cv_path_cp" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_cp"; then + ac_ct_db_cv_path_cp=$db_cv_path_cp + # Extract the first word of "cp", so it can be a program name with args. +set dummy cp; 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_db_cv_path_cp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_cp"; then + ac_cv_prog_ac_ct_db_cv_path_cp="$ac_ct_db_cv_path_cp" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_cp="cp" + 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_db_cv_path_cp=$ac_cv_prog_ac_ct_db_cv_path_cp +if test -n "$ac_ct_db_cv_path_cp"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_cp" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_cp" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_cp" = x; then + db_cv_path_cp="missing_cp" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_cp=$ac_ct_db_cv_path_cp + fi +else + db_cv_path_cp="$ac_cv_prog_db_cv_path_cp" +fi + +if test "$db_cv_path_cp" = missing_cp; then + { { echo "$as_me:$LINENO: error: No cp utility found." >&5 +echo "$as_me: error: No cp utility found." >&2;} + { (exit 1); exit 1; }; } +fi + +if test "$db_cv_rpm" = "yes"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ldconfig", so it can be a program name with args. +set dummy ${ac_tool_prefix}ldconfig; 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_path_ldconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$path_ldconfig"; then + ac_cv_prog_path_ldconfig="$path_ldconfig" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_path_ldconfig="${ac_tool_prefix}ldconfig" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +path_ldconfig=$ac_cv_prog_path_ldconfig +if test -n "$path_ldconfig"; then + { echo "$as_me:$LINENO: result: $path_ldconfig" >&5 +echo "${ECHO_T}$path_ldconfig" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_path_ldconfig"; then + ac_ct_path_ldconfig=$path_ldconfig + # Extract the first word of "ldconfig", so it can be a program name with args. +set dummy ldconfig; 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_path_ldconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_path_ldconfig"; then + ac_cv_prog_ac_ct_path_ldconfig="$ac_ct_path_ldconfig" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_path_ldconfig="ldconfig" + 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_path_ldconfig=$ac_cv_prog_ac_ct_path_ldconfig +if test -n "$ac_ct_path_ldconfig"; then + { echo "$as_me:$LINENO: result: $ac_ct_path_ldconfig" >&5 +echo "${ECHO_T}$ac_ct_path_ldconfig" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_path_ldconfig" = x; then + path_ldconfig="missing_ldconfig" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + path_ldconfig=$ac_ct_path_ldconfig + fi +else + path_ldconfig="$ac_cv_prog_path_ldconfig" +fi + + # Extract the first word of "$path_ldconfig", so it can be a program name with args. +set dummy $path_ldconfig; 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_db_cv_path_ldconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $db_cv_path_ldconfig in + [\\/]* | ?:[\\/]*) + ac_cv_path_db_cv_path_ldconfig="$db_cv_path_ldconfig" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_db_cv_path_ldconfig="$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 + + test -z "$ac_cv_path_db_cv_path_ldconfig" && ac_cv_path_db_cv_path_ldconfig="missing_ldconfig" + ;; +esac +fi +db_cv_path_ldconfig=$ac_cv_path_db_cv_path_ldconfig +if test -n "$db_cv_path_ldconfig"; then + { echo "$as_me:$LINENO: result: $db_cv_path_ldconfig" >&5 +echo "${ECHO_T}$db_cv_path_ldconfig" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + if test "$db_cv_path_ldconfig" != missing_ldconfig; then + RPM_POST_INSTALL="%post -p $db_cv_path_ldconfig" + RPM_POST_UNINSTALL="%postun -p $db_cv_path_ldconfig" + fi +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ln", so it can be a program name with args. +set dummy ${ac_tool_prefix}ln; 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_db_cv_path_ln+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_ln"; then + ac_cv_prog_db_cv_path_ln="$db_cv_path_ln" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_ln="${ac_tool_prefix}ln" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_ln=$ac_cv_prog_db_cv_path_ln +if test -n "$db_cv_path_ln"; then + { echo "$as_me:$LINENO: result: $db_cv_path_ln" >&5 +echo "${ECHO_T}$db_cv_path_ln" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_ln"; then + ac_ct_db_cv_path_ln=$db_cv_path_ln + # Extract the first word of "ln", so it can be a program name with args. +set dummy ln; 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_db_cv_path_ln+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_ln"; then + ac_cv_prog_ac_ct_db_cv_path_ln="$ac_ct_db_cv_path_ln" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_ln="ln" + 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_db_cv_path_ln=$ac_cv_prog_ac_ct_db_cv_path_ln +if test -n "$ac_ct_db_cv_path_ln"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_ln" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_ln" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_ln" = x; then + db_cv_path_ln="missing_ln" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_ln=$ac_ct_db_cv_path_ln + fi +else + db_cv_path_ln="$ac_cv_prog_db_cv_path_ln" +fi + +if test "$db_cv_path_ln" = missing_ln; then + { { echo "$as_me:$LINENO: error: No ln utility found." >&5 +echo "$as_me: error: No ln utility found." >&2;} + { (exit 1); exit 1; }; } +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mkdir", so it can be a program name with args. +set dummy ${ac_tool_prefix}mkdir; 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_db_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_mkdir"; then + ac_cv_prog_db_cv_path_mkdir="$db_cv_path_mkdir" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_mkdir="${ac_tool_prefix}mkdir" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_mkdir=$ac_cv_prog_db_cv_path_mkdir +if test -n "$db_cv_path_mkdir"; then + { echo "$as_me:$LINENO: result: $db_cv_path_mkdir" >&5 +echo "${ECHO_T}$db_cv_path_mkdir" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_mkdir"; then + ac_ct_db_cv_path_mkdir=$db_cv_path_mkdir + # Extract the first word of "mkdir", so it can be a program name with args. +set dummy mkdir; 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_db_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_mkdir"; then + ac_cv_prog_ac_ct_db_cv_path_mkdir="$ac_ct_db_cv_path_mkdir" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_mkdir="mkdir" + 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_db_cv_path_mkdir=$ac_cv_prog_ac_ct_db_cv_path_mkdir +if test -n "$ac_ct_db_cv_path_mkdir"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_mkdir" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_mkdir" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_mkdir" = x; then + db_cv_path_mkdir="missing_mkdir" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_mkdir=$ac_ct_db_cv_path_mkdir + fi +else + db_cv_path_mkdir="$ac_cv_prog_db_cv_path_mkdir" +fi + +if test "$db_cv_path_mkdir" = missing_mkdir; then + { { echo "$as_me:$LINENO: error: No mkdir utility found." >&5 +echo "$as_me: error: No mkdir utility found." >&2;} + { (exit 1); exit 1; }; } +fi + +# We need a complete path for ranlib, because it doesn't exist on some +# architectures because the ar utility packages the library itself. +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_path_ranlib+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$path_ranlib"; then + ac_cv_prog_path_ranlib="$path_ranlib" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_path_ranlib="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +path_ranlib=$ac_cv_prog_path_ranlib +if test -n "$path_ranlib"; then + { echo "$as_me:$LINENO: result: $path_ranlib" >&5 +echo "${ECHO_T}$path_ranlib" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_path_ranlib"; then + ac_ct_path_ranlib=$path_ranlib + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; 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_path_ranlib+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_path_ranlib"; then + ac_cv_prog_ac_ct_path_ranlib="$ac_ct_path_ranlib" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_path_ranlib="ranlib" + 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_path_ranlib=$ac_cv_prog_ac_ct_path_ranlib +if test -n "$ac_ct_path_ranlib"; then + { echo "$as_me:$LINENO: result: $ac_ct_path_ranlib" >&5 +echo "${ECHO_T}$ac_ct_path_ranlib" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_path_ranlib" = x; then + path_ranlib="missing_ranlib" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + path_ranlib=$ac_ct_path_ranlib + fi +else + path_ranlib="$ac_cv_prog_path_ranlib" +fi + +# Extract the first word of "$path_ranlib", so it can be a program name with args. +set dummy $path_ranlib; 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_db_cv_path_ranlib+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $db_cv_path_ranlib in + [\\/]* | ?:[\\/]*) + ac_cv_path_db_cv_path_ranlib="$db_cv_path_ranlib" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_db_cv_path_ranlib="$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 + + test -z "$ac_cv_path_db_cv_path_ranlib" && ac_cv_path_db_cv_path_ranlib="missing_ranlib" + ;; +esac +fi +db_cv_path_ranlib=$ac_cv_path_db_cv_path_ranlib +if test -n "$db_cv_path_ranlib"; then + { echo "$as_me:$LINENO: result: $db_cv_path_ranlib" >&5 +echo "${ECHO_T}$db_cv_path_ranlib" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}rm", so it can be a program name with args. +set dummy ${ac_tool_prefix}rm; 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_db_cv_path_rm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_rm"; then + ac_cv_prog_db_cv_path_rm="$db_cv_path_rm" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_rm="${ac_tool_prefix}rm" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_rm=$ac_cv_prog_db_cv_path_rm +if test -n "$db_cv_path_rm"; then + { echo "$as_me:$LINENO: result: $db_cv_path_rm" >&5 +echo "${ECHO_T}$db_cv_path_rm" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_rm"; then + ac_ct_db_cv_path_rm=$db_cv_path_rm + # Extract the first word of "rm", so it can be a program name with args. +set dummy rm; 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_db_cv_path_rm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_rm"; then + ac_cv_prog_ac_ct_db_cv_path_rm="$ac_ct_db_cv_path_rm" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_rm="rm" + 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_db_cv_path_rm=$ac_cv_prog_ac_ct_db_cv_path_rm +if test -n "$ac_ct_db_cv_path_rm"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_rm" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_rm" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_rm" = x; then + db_cv_path_rm="missing_rm" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_rm=$ac_ct_db_cv_path_rm + fi +else + db_cv_path_rm="$ac_cv_prog_db_cv_path_rm" +fi + +if test "$db_cv_path_rm" = missing_rm; then + { { echo "$as_me:$LINENO: error: No rm utility found." >&5 +echo "$as_me: error: No rm utility found." >&2;} + { (exit 1); exit 1; }; } +fi + +if test "$db_cv_rpm" = "yes"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}rpm", so it can be a program name with args. +set dummy ${ac_tool_prefix}rpm; 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_db_cv_path_rpm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_rpm"; then + ac_cv_prog_db_cv_path_rpm="$db_cv_path_rpm" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_rpm="${ac_tool_prefix}rpm" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_rpm=$ac_cv_prog_db_cv_path_rpm +if test -n "$db_cv_path_rpm"; then + { echo "$as_me:$LINENO: result: $db_cv_path_rpm" >&5 +echo "${ECHO_T}$db_cv_path_rpm" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_rpm"; then + ac_ct_db_cv_path_rpm=$db_cv_path_rpm + # Extract the first word of "rpm", so it can be a program name with args. +set dummy rpm; 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_db_cv_path_rpm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_rpm"; then + ac_cv_prog_ac_ct_db_cv_path_rpm="$ac_ct_db_cv_path_rpm" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_rpm="rpm" + 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_db_cv_path_rpm=$ac_cv_prog_ac_ct_db_cv_path_rpm +if test -n "$ac_ct_db_cv_path_rpm"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_rpm" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_rpm" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_rpm" = x; then + db_cv_path_rpm="missing_rpm" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_rpm=$ac_ct_db_cv_path_rpm + fi +else + db_cv_path_rpm="$ac_cv_prog_db_cv_path_rpm" +fi + + if test "$db_cv_path_rpm" = missing_rpm; then + { { echo "$as_me:$LINENO: error: No rpm utility found." >&5 +echo "$as_me: error: No rpm utility found." >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# We need a complete path for sh, because some implementations of make +# get upset if SHELL is set to just the command name. +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}sh", so it can be a program name with args. +set dummy ${ac_tool_prefix}sh; 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_path_sh+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$path_sh"; then + ac_cv_prog_path_sh="$path_sh" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_path_sh="${ac_tool_prefix}sh" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +path_sh=$ac_cv_prog_path_sh +if test -n "$path_sh"; then + { echo "$as_me:$LINENO: result: $path_sh" >&5 +echo "${ECHO_T}$path_sh" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_path_sh"; then + ac_ct_path_sh=$path_sh + # Extract the first word of "sh", so it can be a program name with args. +set dummy sh; 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_path_sh+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_path_sh"; then + ac_cv_prog_ac_ct_path_sh="$ac_ct_path_sh" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_path_sh="sh" + 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_path_sh=$ac_cv_prog_ac_ct_path_sh +if test -n "$ac_ct_path_sh"; then + { echo "$as_me:$LINENO: result: $ac_ct_path_sh" >&5 +echo "${ECHO_T}$ac_ct_path_sh" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_path_sh" = x; then + path_sh="missing_sh" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + path_sh=$ac_ct_path_sh + fi +else + path_sh="$ac_cv_prog_path_sh" +fi + +# Extract the first word of "$path_sh", so it can be a program name with args. +set dummy $path_sh; 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_db_cv_path_sh+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $db_cv_path_sh in + [\\/]* | ?:[\\/]*) + ac_cv_path_db_cv_path_sh="$db_cv_path_sh" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_db_cv_path_sh="$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 + + test -z "$ac_cv_path_db_cv_path_sh" && ac_cv_path_db_cv_path_sh="missing_sh" + ;; +esac +fi +db_cv_path_sh=$ac_cv_path_db_cv_path_sh +if test -n "$db_cv_path_sh"; then + { echo "$as_me:$LINENO: result: $db_cv_path_sh" >&5 +echo "${ECHO_T}$db_cv_path_sh" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +if test "$db_cv_path_sh" = missing_sh; then + { { echo "$as_me:$LINENO: error: No sh utility found." >&5 +echo "$as_me: error: No sh utility found." >&2;} + { (exit 1); exit 1; }; } +fi + +# Don't strip the binaries if --enable-debug was specified. +if test "$db_cv_debug" = yes; then + db_cv_path_strip=debug_build_no_strip +else + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_path_strip+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$path_strip"; then + ac_cv_prog_path_strip="$path_strip" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_path_strip="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +path_strip=$ac_cv_prog_path_strip +if test -n "$path_strip"; then + { echo "$as_me:$LINENO: result: $path_strip" >&5 +echo "${ECHO_T}$path_strip" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_path_strip"; then + ac_ct_path_strip=$path_strip + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; 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_path_strip+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_path_strip"; then + ac_cv_prog_ac_ct_path_strip="$ac_ct_path_strip" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_path_strip="strip" + 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_path_strip=$ac_cv_prog_ac_ct_path_strip +if test -n "$ac_ct_path_strip"; then + { echo "$as_me:$LINENO: result: $ac_ct_path_strip" >&5 +echo "${ECHO_T}$ac_ct_path_strip" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_path_strip" = x; then + path_strip="missing_strip" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + path_strip=$ac_ct_path_strip + fi +else + path_strip="$ac_cv_prog_path_strip" +fi + + # Extract the first word of "$path_strip", so it can be a program name with args. +set dummy $path_strip; 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_db_cv_path_strip+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $db_cv_path_strip in + [\\/]* | ?:[\\/]*) + ac_cv_path_db_cv_path_strip="$db_cv_path_strip" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_db_cv_path_strip="$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 + + test -z "$ac_cv_path_db_cv_path_strip" && ac_cv_path_db_cv_path_strip="missing_strip" + ;; +esac +fi +db_cv_path_strip=$ac_cv_path_db_cv_path_strip +if test -n "$db_cv_path_strip"; then + { echo "$as_me:$LINENO: result: $db_cv_path_strip" >&5 +echo "${ECHO_T}$db_cv_path_strip" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi + +if test "$db_cv_test" = "yes"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}kill", so it can be a program name with args. +set dummy ${ac_tool_prefix}kill; 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_db_cv_path_kill+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$db_cv_path_kill"; then + ac_cv_prog_db_cv_path_kill="$db_cv_path_kill" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_db_cv_path_kill="${ac_tool_prefix}kill" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +db_cv_path_kill=$ac_cv_prog_db_cv_path_kill +if test -n "$db_cv_path_kill"; then + { echo "$as_me:$LINENO: result: $db_cv_path_kill" >&5 +echo "${ECHO_T}$db_cv_path_kill" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_db_cv_path_kill"; then + ac_ct_db_cv_path_kill=$db_cv_path_kill + # Extract the first word of "kill", so it can be a program name with args. +set dummy kill; 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_db_cv_path_kill+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_db_cv_path_kill"; then + ac_cv_prog_ac_ct_db_cv_path_kill="$ac_ct_db_cv_path_kill" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_db_cv_path_kill="kill" + 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_db_cv_path_kill=$ac_cv_prog_ac_ct_db_cv_path_kill +if test -n "$ac_ct_db_cv_path_kill"; then + { echo "$as_me:$LINENO: result: $ac_ct_db_cv_path_kill" >&5 +echo "${ECHO_T}$ac_ct_db_cv_path_kill" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_db_cv_path_kill" = x; then + db_cv_path_kill="missing_kill" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + db_cv_path_kill=$ac_ct_db_cv_path_kill + fi +else + db_cv_path_kill="$ac_cv_prog_db_cv_path_kill" +fi + + if test "$db_cv_path_kill" = missing_kill; then + { { echo "$as_me:$LINENO: error: No kill utility found." >&5 +echo "$as_me: error: No kill utility found." >&2;} + { (exit 1); exit 1; }; } + fi +fi + + +# 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_executable_p "$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' + + +# RPM support: change the standard make and install targets +if test "$db_cv_rpm" = "yes"; then + BUILD_TARGET="rpm_build" + + # Check if we are running RPM version 3 or 4. + case "`rpm --version`" in + *version\ 4*) + RPM_BUILD="rpmbuild" + echo "_topdir $CONFIGURATION_PATH" > rpm-macro-defines;; + *version\ 3*) + RPM_BUILD="rpm" + echo "topdir: $CONFIGURATION_PATH" > rpm-macro-defines;; + esac + INSTALL_TARGET="rpm_install" +else + BUILD_TARGET="library_build" + INSTALL_TARGET="library_install" +fi + +# This is where we handle stuff that autoconf can't handle: compiler, +# preprocessor and load flags, libraries that the standard tests don't +# look for. The default optimization is -O. We would like to set the +# default optimization for systems using gcc to -O2, but we can't. By +# the time we know we're using gcc, it's too late to set optimization +# flags. +# +# There are additional libraries we need for some compiler/architecture +# combinations. +# +# Some architectures require DB to be compiled with special flags and/or +# libraries for threaded applications +# +# The makefile CC may be different than the CC used in config testing, +# because the makefile CC may be set to use $(LIBTOOL). +# +# XXX +# Don't override anything if it's already set from the environment. +optimize_def="-O" +case "$host_os" in +aix4.3.*|aix5*) + optimize_def="-O2" + CC=${CC-"xlc_r"} + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + LDFLAGS="$LDFLAGS -Wl,-brtl";; +bsdi3*) optimize_def="-O2" + CC=${CC-"shlicc2"} + LIBS="$LIBS -lipc";; +bsdi*) optimize_def="-O2";; +cygwin*) + optimize_def="-O2" + CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_REENTRANT";; +freebsd*) + optimize_def="-O2" + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + LDFLAGS="$LDFLAGS -pthread";; +gnu*|k*bsd*-gnu|linux*) + optimize_def="-O2" + CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_REENTRANT";; +hpux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT";; +irix*) optimize_def="-O2" + CPPFLAGS="$CPPFLAGS -D_SGI_MP_SOURCE";; +mpeix*) CPPFLAGS="$CPPFLAGS -D_POSIX_SOURCE -D_SOCKET_SOURCE" + LIBS="$LIBS -lsocket -lsvipc";; +osf*) CPPFLAGS="$CPPFLAGS -pthread";; +*qnx*) cat >>confdefs.h <<\_ACEOF +#define HAVE_QNX 1 +_ACEOF + + +;; +solaris*) + CPPFLAGS="$CPPFLAGS -D_REENTRANT";; +esac + +# Set CFLAGS/CXXFLAGS. We MUST set the flags before we call autoconf +# compiler configuration macros, because if we don't, they set CFLAGS +# to no optimization and -g, which isn't what we want. +if test "$db_cv_debug" = "no"; then + CFLAGS=${CFLAGS-$optimize_def} +fi +CXXFLAGS=${CXXFLAGS-"$CFLAGS"} + +# If the user wants a TCL library interface setup for testing, add +# -DCONFIG_TEST to the CFLAGS value. +if test "$db_cv_test" = "yes"; then + cat >>confdefs.h <<\_ACEOF +#define CONFIG_TEST 1 +_ACEOF + + + + + CFLAGS="$CFLAGS -DCONFIG_TEST" + CXXFLAGS="$CXXFLAGS -DCONFIG_TEST" + db_cv_build_tcl_test_objs=TCL_TEST_OBJS +else + db_cv_build_tcl_test_objs= +fi + + + +# If the user wants a debugging environment, add -g to the CFLAGS value. +# +# XXX +# Some compilers can't mix optimizing and debug flags. The only way to +# handle this is to specify CFLAGS in the environment before configuring. +if test "$db_cv_debug" = "yes"; then + cat >>confdefs.h <<\_ACEOF +#define DEBUG 1 +_ACEOF + + + + + CFLAGS="$CFLAGS -g" + CXXFLAGS="$CXXFLAGS -g" + db_cv_build_type=debug +else + db_cv_build_type=release +fi + + +# The default compiler is cc (NOT gcc), the default CFLAGS is as specified +# above, NOT what is set by AC_PROG_CC, as it won't set optimization flags +# for any compiler other than gcc. +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 + for ac_prog in cc gcc + 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_executable_p "$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 cc gcc +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_executable_p "$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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + 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 + 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 +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } + +# 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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: 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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 +#include +#include +#include +/* 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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 + + +# Checks for compiler characteristics. + + + +DB_PROTO1="#undef __P" + +# AC_PROG_CC_STDC only sets ac_cv_prog_cc_stdc if the test fails, so +# check for "no", not "yes". +if test "$ac_cv_prog_cc_stdc" = "no"; then + DB_PROTO2="#define __P(protos) ()" +else + DB_PROTO2="#define __P(protos) protos" +fi + + +{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } +if test "${ac_cv_c_const+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 () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !x[0] && !zero.x; +#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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_const=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_c_const=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + + +if test "$ac_cv_c_const" != "yes"; then + DB_CONST="#define const" +fi + +# Because of shared library building, the ${CC} used for config tests +# may be different than the ${CC} we want to put in the Makefile. +# The latter is known as ${MAKEFILE_CC} in this script. +MAKEFILE_CC="${CC}" +MAKEFILE_CCLINK="${CC}" +MAKEFILE_CXX="nocxx" +MAKEFILE_CXXLINK="nocxx" + +# See if we need the C++ compiler at all. If so, we'd like to find one that +# interoperates with the C compiler we chose. Since we prefered cc over gcc, +# we'll also prefer the vendor's compiler over g++/gcc. If we're wrong, the +# user can set CC and CXX in their environment before running configure. +# +# AC_PROG_CXX sets CXX, but it uses $CXX and $CCC (in that order) as its +# first choices. +if test "$db_cv_cxx" = "yes"; then + if test "$GCC" != "yes"; then + case "$host_os" in + aix*) if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}xlC_r", so it can be a program name with args. +set dummy ${ac_tool_prefix}xlC_r; 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_CCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CCC"; then + ac_cv_prog_CCC="$CCC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CCC="${ac_tool_prefix}xlC_r" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CCC=$ac_cv_prog_CCC +if test -n "$CCC"; then + { echo "$as_me:$LINENO: result: $CCC" >&5 +echo "${ECHO_T}$CCC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CCC"; then + ac_ct_CCC=$CCC + # Extract the first word of "xlC_r", so it can be a program name with args. +set dummy xlC_r; 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_CCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CCC"; then + ac_cv_prog_ac_ct_CCC="$ac_ct_CCC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CCC="xlC_r" + 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_CCC=$ac_cv_prog_ac_ct_CCC +if test -n "$ac_ct_CCC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CCC" >&5 +echo "${ECHO_T}$ac_ct_CCC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CCC" = x; then + CCC="" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CCC=$ac_ct_CCC + fi +else + CCC="$ac_cv_prog_CCC" +fi + + LIBXSO_LIBS="-lC_r $LIBXSO_LIBS" + LIBS="-lC_r $LIBS";; + hpux*) if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}aCC", so it can be a program name with args. +set dummy ${ac_tool_prefix}aCC; 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_CCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CCC"; then + ac_cv_prog_CCC="$CCC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CCC="${ac_tool_prefix}aCC" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CCC=$ac_cv_prog_CCC +if test -n "$CCC"; then + { echo "$as_me:$LINENO: result: $CCC" >&5 +echo "${ECHO_T}$CCC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CCC"; then + ac_ct_CCC=$CCC + # Extract the first word of "aCC", so it can be a program name with args. +set dummy aCC; 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_CCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CCC"; then + ac_cv_prog_ac_ct_CCC="$ac_ct_CCC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CCC="aCC" + 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_CCC=$ac_cv_prog_ac_ct_CCC +if test -n "$ac_ct_CCC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CCC" >&5 +echo "${ECHO_T}$ac_ct_CCC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CCC" = x; then + CCC="" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CCC=$ac_ct_CCC + fi +else + CCC="$ac_cv_prog_CCC" +fi +;; + irix*) 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_CCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CCC"; then + ac_cv_prog_CCC="$CCC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CCC="${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 +CCC=$ac_cv_prog_CCC +if test -n "$CCC"; then + { echo "$as_me:$LINENO: result: $CCC" >&5 +echo "${ECHO_T}$CCC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CCC"; then + ac_ct_CCC=$CCC + # 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_ac_ct_CCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CCC"; then + ac_cv_prog_ac_ct_CCC="$ac_ct_CCC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CCC="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 +ac_ct_CCC=$ac_cv_prog_ac_ct_CCC +if test -n "$ac_ct_CCC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CCC" >&5 +echo "${ECHO_T}$ac_ct_CCC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CCC" = x; then + CCC="" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CCC=$ac_ct_CCC + fi +else + CCC="$ac_cv_prog_CCC" +fi +;; + osf*) if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cxx", so it can be a program name with args. +set dummy ${ac_tool_prefix}cxx; 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_CCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CCC"; then + ac_cv_prog_CCC="$CCC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CCC="${ac_tool_prefix}cxx" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CCC=$ac_cv_prog_CCC +if test -n "$CCC"; then + { echo "$as_me:$LINENO: result: $CCC" >&5 +echo "${ECHO_T}$CCC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CCC"; then + ac_ct_CCC=$CCC + # Extract the first word of "cxx", so it can be a program name with args. +set dummy cxx; 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_CCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CCC"; then + ac_cv_prog_ac_ct_CCC="$ac_ct_CCC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CCC="cxx" + 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_CCC=$ac_cv_prog_ac_ct_CCC +if test -n "$ac_ct_CCC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CCC" >&5 +echo "${ECHO_T}$ac_ct_CCC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CCC" = x; then + CCC="" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CCC=$ac_ct_CCC + fi +else + CCC="$ac_cv_prog_CCC" +fi +;; + solaris*) 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_CCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CCC"; then + ac_cv_prog_CCC="$CCC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CCC="${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 +CCC=$ac_cv_prog_CCC +if test -n "$CCC"; then + { echo "$as_me:$LINENO: result: $CCC" >&5 +echo "${ECHO_T}$CCC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CCC"; then + ac_ct_CCC=$CCC + # 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_ac_ct_CCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CCC"; then + ac_cv_prog_ac_ct_CCC="$ac_ct_CCC" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CCC="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 +ac_ct_CCC=$ac_cv_prog_ac_ct_CCC +if test -n "$ac_ct_CCC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CCC" >&5 +echo "${ECHO_T}$ac_ct_CCC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CCC" = x; then + CCC="" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CCC=$ac_ct_CCC + fi +else + CCC="$ac_cv_prog_CCC" +fi +;; + esac + fi + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + 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_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$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 +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +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_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$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_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# 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); } + +{ 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_cxx_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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CXXFLAGS="" + 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_prog_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +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 + + ###### WORKAROUND: SEE SR #7938 + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_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; } +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +#else +# include +#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; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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 +_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; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +#else +# include +#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; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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 +_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; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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 \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" 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 whether C++ supports the ISO C++ standard includes" >&5 +echo $ECHO_N "checking whether C++ supports the ISO C++ standard includes... $ECHO_C" >&6; } +if test "${db_cv_cxx_have_stdheaders+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +std::ostream *o; 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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 + db_cv_cxx_have_stdheaders=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + db_cv_cxx_have_stdheaders=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + 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 + + +fi +{ echo "$as_me:$LINENO: result: $db_cv_cxx_have_stdheaders" >&5 +echo "${ECHO_T}$db_cv_cxx_have_stdheaders" >&6; } +if test "$db_cv_cxx_have_stdheaders" = yes; then + cxx_have_stdheaders="#define HAVE_CXX_STDHEADERS 1" +fi + MAKEFILE_CXX="${CXX}" + MAKEFILE_CXXLINK="${CXX}" +fi + +# Do some gcc specific configuration. + +{ echo "$as_me:$LINENO: checking whether we are using gcc version 2.96" >&5 +echo $ECHO_N "checking whether we are using gcc version 2.96... $ECHO_C" >&6; } +if test "${db_cv_gcc_2_96+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +db_cv_gcc_2_96=no +if test "$GCC" = "yes"; then + GCC_VERSION=`${MAKEFILE_CC} --version` + case ${GCC_VERSION} in + 2.96*) + db_cv_gcc_2_96=yes;; + esac +fi +fi +{ echo "$as_me:$LINENO: result: $db_cv_gcc_2_96" >&5 +echo "${ECHO_T}$db_cv_gcc_2_96" >&6; } +if test "$db_cv_gcc_2_96" = "yes"; then + CFLAGS=`echo "$CFLAGS" | sed 's/-O2/-O/'` + CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-O2/-O/'` + { echo "$as_me:$LINENO: WARNING: INSTALLED GCC COMPILER HAS SERIOUS BUGS; PLEASE UPGRADE." >&5 +echo "$as_me: WARNING: INSTALLED GCC COMPILER HAS SERIOUS BUGS; PLEASE UPGRADE." >&2;} + { echo "$as_me:$LINENO: WARNING: GCC OPTIMIZATION LEVEL SET TO -O." >&5 +echo "$as_me: WARNING: GCC OPTIMIZATION LEVEL SET TO -O." >&2;} +fi + +{ echo "$as_me:$LINENO: checking whether g++ requires -fhandle-exceptions" >&5 +echo $ECHO_N "checking whether g++ requires -fhandle-exceptions... $ECHO_C" >&6; } +if test "${db_cv_gxx_except+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +db_cv_gxx_except=no; +if test "$GXX" = "yes"; then + GXX_VERSION=`${MAKEFILE_CXX} --version` + case ${GXX_VERSION} in + 1.*|2.[01234567].*|*-1.*|*-2.[01234567].*) + db_cv_gxx_except=yes;; + esac +fi +fi +{ echo "$as_me:$LINENO: result: $db_cv_gxx_except" >&5 +echo "${ECHO_T}$db_cv_gxx_except" >&6; } +if test "$db_cv_gxx_except" = "yes"; then + CXXFLAGS="$CXXFLAGS -fhandle-exceptions" +fi + +# We need the -Kthread/-pthread flag when compiling on SCO/Caldera's UnixWare +# and OpenUNIX releases. We can't make the test until we know which compiler +# we're using. +case "$host_os" in +sysv5UnixWare*|sysv5OpenUNIX8*) + if test "$GCC" == "yes"; then + CPPFLAGS="$CPPFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread" + else + CPPFLAGS="$CPPFLAGS -Kthread" + LDFLAGS="$LDFLAGS -Kthread" + fi;; +esac + +# Export our compiler preferences for the libtool configuration. +export CC CCC +CCC=CXX + +# Libtool configuration. +# Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + +# Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + +{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; } +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +SED=$lt_cv_path_SED + +fi + +{ echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6; } + +{ 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_executable_p "$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_executable_p "$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" + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } +else + { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `"$LD" -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + +{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; } +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' + +{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; } +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/${ac_tool_prefix}nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi +{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6; } +NM="$lt_cv_path_NM" + +{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6; } +fi + +{ echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 +echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6; } +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + # win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='win32_libid' + ;; + +darwin* | rhapsody*) + # this will be overwritten by pass_all, but leave it in just in case + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file=`/System/Library/Frameworks/System.framework/System` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + case $host_cpu in + alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh*) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx | nto-qnx6*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; } +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 7949 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; } +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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 >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 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_cc_needs_belf=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + 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 + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +esac + +need_locks="$enable_libtool_lock" + + +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 to if __STDC__ is defined, since + # 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 +#else +# include +#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; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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 +_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; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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 to if __STDC__ is defined, since + # 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 +#else +# include +#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; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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 +_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; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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 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 +#include +#include +#include + +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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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 + +_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 + +_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 +#include +#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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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 + 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 + + + +for ac_header in dlfcn.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { 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 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header 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 <$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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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 $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header 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 <$ac_header> +_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; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to support@dbsql.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ 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 + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +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 + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 f77 xlf frt pgf77 cf77 fort77 fl32 af77 f90 xlf90 pgf90 pghpf epcf90 gfortran g95 f95 fort xlf95 ifort ifc efc pgf95 lf95 ftn + 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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_F77="$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 +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + { echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 f77 xlf frt pgf77 cf77 fort77 fl32 af77 f90 xlf90 pgf90 pghpf epcf90 gfortran g95 f95 fort xlf95 ifort ifc efc pgf95 lf95 ftn +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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_F77="$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_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +echo "${ECHO_T}$ac_ct_F77" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_F77" && break +done + + if test "x$ac_ct_F77" = x; then + F77="" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + F77=$ac_ct_F77 + fi +fi + + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for Fortran 77 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); } +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; } +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_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); } && + { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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_f77_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; } +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_f77_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_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); } && + { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_prog_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_prog_f77_g=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; } +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= + fi +fi + +G77=`test $ac_compiler_gnu = yes && echo yes` +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 + + + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# find the maximum length of command line arguments +{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; } +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; } +else + { echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6; } +fi + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; } +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGISTW]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6; } +else + { echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6; } +fi + +{ echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6; } +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="ar" + 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_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="false" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; 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_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + 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_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; 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_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + 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_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + 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 autoconf@gnu.org." >&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 autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then + withval=$with_pic; pic_mode="$withval" +else + pic_mode=default +fi + +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +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 + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# +# Check for any special shared library compilation flags. +# +lt_prog_cc_shlib= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + lt_prog_cc_shlib='-belf' + ;; + esac +fi +if test -n "$lt_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_prog_compiler_static" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; } + +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + { echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:10058: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:10062: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux*) + case $CC in + icc|ecc) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + ccc) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic='-Kpic' + lt_prog_compiler_static='-dn' + ;; + + solaris*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:10290: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:10294: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; } + +if test x"$lt_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:10357: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:10361: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6; } + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } + + runpath_var= + allow_undefined_flag= + enable_shared_with_static_runtimes=no + archive_cmds= + archive_expsym_cmds= + old_archive_From_new_cmds= + old_archive_from_expsyms_cmds= + export_dynamic_flag_spec= + whole_archive_flag_spec= + thread_safe_flag_spec= + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + link_all_deplibs=unknown + hardcode_automatic=no + module_cmds= + module_expsym_cmds= + always_export_symbols=no + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an empty executable. + 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 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + 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 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec=' ' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + bsdi4*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + archive_cmds_need_lc=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='-all_load $convenience' + link_all_deplibs=yes + fi + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + ia64*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + hardcode_shlibpath_var=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + *) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld='-rpath $libdir' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag=' -z text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +echo "${ECHO_T}$archive_cmds_need_lc" >&6; } + ;; + esac + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var " || \ + test "X$hardcode_automatic"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6; } + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + ;; + *) + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + ;; + esac +fi + +{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx | nto-qnx6*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +return dlopen (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + { echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; } +if test "${ac_cv_func_shl_load+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. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_shl_load || defined __stub___shl_load +choke me +#endif + +int +main () +{ +return shl_load (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_shl_load=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6; } +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; } +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $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 shl_load (); +int +main () +{ +return shl_load (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_shl_load=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; } +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + { echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; } +if test "${ac_cv_func_dlopen+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. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_dlopen || defined __stub___dlopen +choke me +#endif + +int +main () +{ +return dlopen (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6; } +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +return dlopen (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; } +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $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 dlopen (); +int +main () +{ +return dlopen (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_svld_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; } +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; } +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $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 dld_link (); +int +main () +{ +return dld_link (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_dld_link=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; } +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; } +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; } +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# Report which librarie types wil actually be built +{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6; } + +{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + archive_cmds_need_lc=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + output_verbose_link_cmd='echo' + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' + module_cmds='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='-all_load $convenience' + link_all_deplibs=yes + fi + ;; +esac +{ echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6; } + +{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +{ echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6; } + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler \ + CC \ + LD \ + lt_prog_compiler_wl \ + lt_prog_compiler_pic \ + lt_prog_compiler_static \ + lt_prog_compiler_no_builtin_flag \ + export_dynamic_flag_spec \ + thread_safe_flag_spec \ + whole_archive_flag_spec \ + enable_shared_with_static_runtimes \ + old_archive_cmds \ + old_archive_from_new_cmds \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + exclude_expsyms \ + include_expsyms; do + + case $var in + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" +#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +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 + +CC="$lt_save_CC" + + +# Check whether --with-tags was given. +if test "${with_tags+set}" = set; then + withval=$with_tags; tagnames="$withval" +fi + + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} + else + { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 +echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in + "") ;; + *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 +echo "$as_me: error: invalid tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 +echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} + { (exit 1); exit 1; }; } + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_flag_spec_ld_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_automatic_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +compiler_CXX=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +else + lt_prog_compiler_no_builtin_flag_CXX= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } +else + { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `"$LD" -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } +ld_shlibs_CXX=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_CXX=yes + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty executable. + 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 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + 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 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_CXX=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX=' ' + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs_CXX=no + fi + ;; + + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + archive_cmds_need_lc_CXX=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag_CXX='-flat_namespace -undefined suppress' + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='-all_load $convenience' + link_all_deplibs_CXX=yes + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + freebsd12*) + # C++ shared libraries reported to be fairly broken before switch to ELF + ld_shlibs_CXX=no + ;; + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + freebsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + gnu*) + ;; + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC) + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_CXX='+b $libdir' + hardcode_libdir_separator_CXX=: + ;; + ia64*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + *) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + archive_cmds_need_lc_CXX=no + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + sco*) + archive_cmds_need_lc_CXX=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.0-5 | solaris2.0-5.*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + archive_cmds_need_lc_CXX=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; +esac +{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6; } +test "$ld_shlibs_CXX" = no && can_build_shared=no + +GCC_CXX="$GXX" +LD_CXX="$LD" + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... + +cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + +lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + +{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + icpc) + # Intel C++ + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:14864: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:14868: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; } + +if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:14931: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:14935: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6; } + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6; } +test "$ld_shlibs_CXX" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_CXX=no + else + archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; } + ;; + esac + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var CXX" || \ + test "X$hardcode_automatic_CXX"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 +echo "${ECHO_T}$hardcode_action_CXX" >&6; } + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + ;; + *) + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + ;; + esac +fi + +{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx | nto-qnx6*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +return dlopen (); + ; + 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + { echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; } +if test "${ac_cv_func_shl_load+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. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_shl_load || defined __stub___shl_load +choke me +#endif + +int +main () +{ +return shl_load (); + ; + 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_shl_load=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6; } +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; } +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $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 shl_load (); +int +main () +{ +return shl_load (); + ; + 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_shl_load=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; } +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + { echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; } +if test "${ac_cv_func_dlopen+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. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_dlopen || defined __stub___dlopen +choke me +#endif + +int +main () +{ +return dlopen (); + ; + 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6; } +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +return dlopen (); + ; + 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; } +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $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 dlopen (); +int +main () +{ +return dlopen (); + ; + 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_svld_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; } +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; } +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $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 dld_link (); +int +main () +{ +return dld_link (); + ; + 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_dld_link=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; } +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; } +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; } +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_CXX \ + CC_CXX \ + LD_CXX \ + lt_prog_compiler_wl_CXX \ + lt_prog_compiler_pic_CXX \ + lt_prog_compiler_static_CXX \ + lt_prog_compiler_no_builtin_flag_CXX \ + export_dynamic_flag_spec_CXX \ + thread_safe_flag_spec_CXX \ + whole_archive_flag_spec_CXX \ + enable_shared_with_static_runtimes_CXX \ + old_archive_cmds_CXX \ + old_archive_from_new_cmds_CXX \ + predep_objects_CXX \ + postdep_objects_CXX \ + predeps_CXX \ + postdeps_CXX \ + compiler_lib_search_path_CXX \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_CXX + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_CXX +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_CXX + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_CXX" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +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 + +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld + + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + +archive_cmds_need_lc_F77=no +allow_undefined_flag_F77= +always_export_symbols_F77=no +archive_expsym_cmds_F77= +export_dynamic_flag_spec_F77= +hardcode_direct_F77=no +hardcode_libdir_flag_spec_F77= +hardcode_libdir_flag_spec_ld_F77= +hardcode_libdir_separator_F77= +hardcode_minus_L_F77=no +hardcode_automatic_F77=no +module_cmds_F77= +module_expsym_cmds_F77= +link_all_deplibs_F77=unknown +old_archive_cmds_F77=$old_archive_cmds +no_undefined_flag_F77= +whole_archive_flag_spec_F77= +enable_shared_with_static_runtimes_F77=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +objext_F77=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code=" subroutine t\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +compiler_F77=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6; } + +{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac +{ echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6; } + +{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +{ echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6; } + +test "$ld_shlibs_F77" = no && can_build_shared=no + +GCC_F77="$G77" +LD_F77="$LD" + +lt_prog_compiler_wl_F77= +lt_prog_compiler_pic_F77= +lt_prog_compiler_static_F77= + +{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_static_F77='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_F77=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_F77=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_F77='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + else + lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux*) + case $CC in + icc|ecc) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-static' + ;; + ccc) + lt_prog_compiler_wl_F77='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_F77='-Kpic' + lt_prog_compiler_static_F77='-dn' + ;; + + solaris*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl_F77='-Qoption ld ' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_F77='-Kconform_pic' + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic_F77='-pic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_F77=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_F77"; then + { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:17259: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:17263: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; } + +if test x"$lt_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_F77=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:17326: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:17330: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_F77=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6; } + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } + + runpath_var= + allow_undefined_flag_F77= + enable_shared_with_static_runtimes_F77=no + archive_cmds_F77= + archive_expsym_cmds_F77= + old_archive_From_new_cmds_F77= + old_archive_from_expsyms_cmds_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + thread_safe_flag_spec_F77= + hardcode_libdir_flag_spec_F77= + hardcode_libdir_flag_spec_ld_F77= + hardcode_libdir_separator_F77= + hardcode_direct_F77=no + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=unsupported + link_all_deplibs_F77=unknown + hardcode_automatic_F77=no + module_cmds_F77= + module_expsym_cmds_F77= + always_export_symbols_F77=no + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_F77= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_F77=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + sunos4*) + archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + + if test "$ld_shlibs_F77" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=yes + archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_F77=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_F77=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_F77=yes + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_F77=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_F77='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_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); } && + { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_F77="-z nodefs" + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_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); } && + { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_F77=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_F77=' ' + archive_cmds_need_lc_F77=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_F77=no + ;; + + bsdi4*) + export_dynamic_flag_spec_F77=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_F77=' ' + allow_undefined_flag_F77=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_F77='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_F77=yes + ;; + + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + archive_cmds_need_lc_F77=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag_F77='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_F77='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_F77=no + hardcode_automatic_F77=yes + hardcode_shlibpath_var_F77=unsupported + whole_archive_flag_spec_F77='-all_load $convenience' + link_all_deplibs_F77=yes + fi + ;; + + dgux*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + freebsd1*) + ld_shlibs_F77=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_F77='+b $libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + ;; + ia64*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + *) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + link_all_deplibs_F77=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_F77='-rpath $libdir' + fi + hardcode_libdir_separator_F77=: + ;; + + sco3.2v5*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_F77=' -z text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_shlibpath_var_F77=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs_F77=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_F77='$CC -r -o $output$reload_objs' + hardcode_direct_F77=no + ;; + motorola) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv4.3*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_F77=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_F77='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv5*) + no_undefined_flag_F77=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_F77= + hardcode_shlibpath_var_F77=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + *) + ld_shlibs_F77=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 +echo "${ECHO_T}$ld_shlibs_F77" >&6; } +test "$ld_shlibs_F77" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_F77" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_F77=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_F77 in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_F77 + allow_undefined_flag_F77= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_F77=no + else + archive_cmds_need_lc_F77=yes + fi + allow_undefined_flag_F77=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; } + ;; + esac + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } +hardcode_action_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var F77" || \ + test "X$hardcode_automatic_F77"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 +echo "${ECHO_T}$hardcode_action_F77" >&6; } + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + ;; + *) + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + ;; + esac +fi + +{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx | nto-qnx6*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_F77 \ + CC_F77 \ + LD_F77 \ + lt_prog_compiler_wl_F77 \ + lt_prog_compiler_pic_F77 \ + lt_prog_compiler_static_F77 \ + lt_prog_compiler_no_builtin_flag_F77 \ + export_dynamic_flag_spec_F77 \ + thread_safe_flag_spec_F77 \ + whole_archive_flag_spec_F77 \ + enable_shared_with_static_runtimes_F77 \ + old_archive_cmds_F77 \ + old_archive_from_new_cmds_F77 \ + predep_objects_F77 \ + postdep_objects_F77 \ + predeps_F77 \ + postdeps_F77 \ + compiler_lib_search_path_F77 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_F77 + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_F77 + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_F77 +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_F77 + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_F77 +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_F77 +archive_expsym_cmds=$lt_archive_expsym_cmds_F77 +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_F77 +module_expsym_cmds=$lt_module_expsym_cmds_F77 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_F77 + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_F77 + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_F77 + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_F77 + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_F77 + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_F77 + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_F77 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_F77 + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_F77" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +objext_GCJ=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +compiler_GCJ=$CC + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +archive_cmds_need_lc_GCJ=no + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + { echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:19319: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:19323: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl_GCJ= +lt_prog_compiler_pic_GCJ= +lt_prog_compiler_static_GCJ= + +{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_static_GCJ='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_GCJ=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_GCJ=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_GCJ='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + else + lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux*) + case $CC in + icc|ecc) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-static' + ;; + ccc) + lt_prog_compiler_wl_GCJ='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_GCJ='-Kpic' + lt_prog_compiler_static_GCJ='-dn' + ;; + + solaris*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl_GCJ='-Qoption ld ' + lt_prog_compiler_pic_GCJ='-PIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_GCJ='-Kconform_pic' + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic_GCJ='-pic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_GCJ=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_GCJ"; then + { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:19551: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:19555: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; } + +if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_GCJ=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:19618: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:19622: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_GCJ=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6; } + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } + + runpath_var= + allow_undefined_flag_GCJ= + enable_shared_with_static_runtimes_GCJ=no + archive_cmds_GCJ= + archive_expsym_cmds_GCJ= + old_archive_From_new_cmds_GCJ= + old_archive_from_expsyms_cmds_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + thread_safe_flag_spec_GCJ= + hardcode_libdir_flag_spec_GCJ= + hardcode_libdir_flag_spec_ld_GCJ= + hardcode_libdir_separator_GCJ= + hardcode_direct_GCJ=no + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=unsupported + link_all_deplibs_GCJ=unknown + hardcode_automatic_GCJ=no + module_cmds_GCJ= + module_expsym_cmds_GCJ= + always_export_symbols_GCJ=no + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_GCJ= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_GCJ=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + sunos4*) + archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + + if test "$ld_shlibs_GCJ" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=yes + archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_GCJ=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_GCJ=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_GCJ=yes + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_GCJ=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_GCJ='-berok' + # Determine the default libpath from the value encoded in an empty executable. + 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 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_GCJ="-z nodefs" + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + 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 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; 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_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_GCJ=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_GCJ=' ' + archive_cmds_need_lc_GCJ=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_GCJ=no + ;; + + bsdi4*) + export_dynamic_flag_spec_GCJ=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_GCJ=' ' + allow_undefined_flag_GCJ=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_GCJ='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_GCJ=yes + ;; + + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + archive_cmds_need_lc_GCJ=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_GCJ='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_GCJ=no + hardcode_automatic_GCJ=yes + hardcode_shlibpath_var_GCJ=unsupported + whole_archive_flag_spec_GCJ='-all_load $convenience' + link_all_deplibs_GCJ=yes + fi + ;; + + dgux*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + freebsd1*) + ld_shlibs_GCJ=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + ;; + ia64*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + *) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + link_all_deplibs_GCJ=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + allow_undefined_flag_GCJ=unsupported + archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_GCJ='-rpath $libdir' + fi + hardcode_libdir_separator_GCJ=: + ;; + + sco3.2v5*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_GCJ=' -z text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_shlibpath_var_GCJ=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs_GCJ=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_GCJ='$CC -r -o $output$reload_objs' + hardcode_direct_GCJ=no + ;; + motorola) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4.3*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_GCJ=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_GCJ='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv5*) + no_undefined_flag_GCJ=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_GCJ= + hardcode_shlibpath_var_GCJ=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + *) + ld_shlibs_GCJ=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 +echo "${ECHO_T}$ld_shlibs_GCJ" >&6; } +test "$ld_shlibs_GCJ" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_GCJ" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_GCJ=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_GCJ in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ + allow_undefined_flag_GCJ= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_GCJ=no + else + archive_cmds_need_lc_GCJ=yes + fi + allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; } + ;; + esac + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } +hardcode_action_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var GCJ" || \ + test "X$hardcode_automatic_GCJ"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 +echo "${ECHO_T}$hardcode_action_GCJ" >&6; } + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + ;; + *) + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + ;; + esac +fi + +{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx | nto-qnx6*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +return dlopen (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + { echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; } +if test "${ac_cv_func_shl_load+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. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_shl_load || defined __stub___shl_load +choke me +#endif + +int +main () +{ +return shl_load (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_shl_load=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6; } +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; } +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $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 shl_load (); +int +main () +{ +return shl_load (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_shl_load=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; } +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + { echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; } +if test "${ac_cv_func_dlopen+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. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_dlopen || defined __stub___dlopen +choke me +#endif + +int +main () +{ +return dlopen (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6; } +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +return dlopen (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; } +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $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 dlopen (); +int +main () +{ +return dlopen (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_svld_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; } +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; } +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $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 dld_link (); +int +main () +{ +return dld_link (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_dld_link=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; } +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; } +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; } +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_GCJ \ + CC_GCJ \ + LD_GCJ \ + lt_prog_compiler_wl_GCJ \ + lt_prog_compiler_pic_GCJ \ + lt_prog_compiler_static_GCJ \ + lt_prog_compiler_no_builtin_flag_GCJ \ + export_dynamic_flag_spec_GCJ \ + thread_safe_flag_spec_GCJ \ + whole_archive_flag_spec_GCJ \ + enable_shared_with_static_runtimes_GCJ \ + old_archive_cmds_GCJ \ + old_archive_from_new_cmds_GCJ \ + predep_objects_GCJ \ + postdep_objects_GCJ \ + predeps_GCJ \ + postdeps_GCJ \ + compiler_lib_search_path_GCJ \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_GCJ + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_GCJ + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_GCJ + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_GCJ + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_GCJ +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_GCJ + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_GCJ +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_GCJ +archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_GCJ +module_expsym_cmds=$lt_module_expsym_cmds_GCJ + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_GCJ + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_GCJ + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_GCJ + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_GCJ + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_GCJ + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_GCJ + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_GCJ + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_GCJ + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_GCJ" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + RC) + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +compiler_RC=$CC +lt_cv_prog_compiler_c_o_RC=yes + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_RC \ + CC_RC \ + LD_RC \ + lt_prog_compiler_wl_RC \ + lt_prog_compiler_pic_RC \ + lt_prog_compiler_static_RC \ + lt_prog_compiler_no_builtin_flag_RC \ + export_dynamic_flag_spec_RC \ + thread_safe_flag_spec_RC \ + whole_archive_flag_spec_RC \ + enable_shared_with_static_runtimes_RC \ + old_archive_cmds_RC \ + old_archive_from_new_cmds_RC \ + predep_objects_RC \ + postdep_objects_RC \ + predeps_RC \ + postdeps_RC \ + compiler_lib_search_path_RC \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_RC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_RC + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_RC +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_RC + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_RC + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_RC + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_RC" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +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 + +CC="$lt_save_CC" + + ;; + + *) + { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 +echo "$as_me: error: Unsupported tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 +echo "$as_me: error: unable to update list of available tagged configurations." >&2;} + { (exit 1); exit 1; }; } + fi +fi + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + + + + + + + + + + + + + + + + + + + + +SOFLAGS="-rpath \$(libdir)" +LIBTOOL_PROG="${SHELL} ./libtool" + +# Set SOSUFFIX and friends + + { echo "$as_me:$LINENO: checking SOSUFFIX from libtool" >&5 +echo $ECHO_N "checking SOSUFFIX from libtool... $ECHO_C" >&6; } + module=no + + versuffix="" + release="" + libname=libfoo + eval _SOSUFFIX=\"$shrext\" + if test "X$_SOSUFFIX" = "" ; then + _SOSUFFIX=".so" + if test `$LIBTOOL_PROG --config | grep build_libtool_libs | grep no` 2>/dev/null; then + if test "X$_SOSUFFIX_MESSAGE" = "X"; then + _SOSUFFIX_MESSAGE=yes + { echo "$as_me:$LINENO: WARNING: libtool may not know about this architecture." >&5 +echo "$as_me: WARNING: libtool may not know about this architecture." >&2;} + { echo "$as_me:$LINENO: WARNING: assuming $_SUFFIX suffix for dynamic libraries." >&5 +echo "$as_me: WARNING: assuming $_SUFFIX suffix for dynamic libraries." >&2;} + fi + fi + fi + + SOSUFFIX=$_SOSUFFIX + { echo "$as_me:$LINENO: result: $SOSUFFIX" >&5 +echo "${ECHO_T}$SOSUFFIX" >&6; } + + + + { echo "$as_me:$LINENO: checking MODSUFFIX from libtool" >&5 +echo $ECHO_N "checking MODSUFFIX from libtool... $ECHO_C" >&6; } + module=yes + + versuffix="" + release="" + libname=libfoo + eval _SOSUFFIX=\"$shrext\" + if test "X$_SOSUFFIX" = "" ; then + _SOSUFFIX=".so" + if test `$LIBTOOL_PROG --config | grep build_libtool_libs | grep no` 2>/dev/null; then + if test "X$_SOSUFFIX_MESSAGE" = "X"; then + _SOSUFFIX_MESSAGE=yes + { echo "$as_me:$LINENO: WARNING: libtool may not know about this architecture." >&5 +echo "$as_me: WARNING: libtool may not know about this architecture." >&2;} + { echo "$as_me:$LINENO: WARNING: assuming $_SUFFIX suffix for dynamic libraries." >&5 +echo "$as_me: WARNING: assuming $_SUFFIX suffix for dynamic libraries." >&2;} + fi + fi + fi + + MODSUFFIX=$_SOSUFFIX + { echo "$as_me:$LINENO: result: $MODSUFFIX" >&5 +echo "${ECHO_T}$MODSUFFIX" >&6; } + + + +INSTALLER="\$(LIBTOOL) --mode=install cp -p" + +MAKEFILE_CC="\$(LIBTOOL) --mode=compile ${MAKEFILE_CC}" +MAKEFILE_SOLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CCLINK} -avoid-version" +MAKEFILE_CCLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CCLINK}" +MAKEFILE_CXX="\$(LIBTOOL) --mode=compile ${MAKEFILE_CXX}" +MAKEFILE_XSOLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CXXLINK} -avoid-version" +MAKEFILE_CXXLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CXXLINK}" + +LIBTOOL="\$(SHELL) ./libtool" + +case "$host_os" in +cygwin*) + MAKEFILE_SOLINK="$MAKEFILE_SOLINK -no-undefined" + MAKEFILE_XSOLINK="$MAKEFILE_XSOLINK -no-undefined";; +esac + +# Configure for shared libraries, static libraries, or both. If both are +# configured, build the utilities and example programs with shared versions. +# +# $o is set to ".o" or ".lo", and is the file suffix used in the Makefile +# instead of .o +if test `$LIBTOOL_PROG --config | + grep build_libtool_libs | grep no` 2>/dev/null; then + enable_shared="no" +else + enable_shared="yes" +fi +if test `$LIBTOOL_PROG --config | + grep build_old_libs | grep no` 2>/dev/null; then + enable_static="no" +else + enable_static="yes" +fi + +# C API. +if test "$enable_shared" = "no"; then + DEFAULT_LIB="\$(libdb_version)" + POSTLINK=": " + o=".o" +else + DEFAULT_LIB="\$(libso_target)" + POSTLINK="\$(LIBTOOL) --mode=execute true" + o=".lo" +fi +INSTALL_LIBS="$DEFAULT_LIB" +if test "$enable_static" = "yes"; then + INSTALL_LIBS="$INSTALL_LIBS \$(libdb)" +fi + +# Optional C++ API. +if test "$db_cv_cxx" = "yes"; then + if test "$enable_shared" = "no"; then + DEFAULT_LIB_CXX="\$(libcxx_version)" + fi + if test "$enable_shared" = "yes"; then + DEFAULT_LIB_CXX="\$(libxso_target)" + fi + INSTALL_LIBS="$INSTALL_LIBS $DEFAULT_LIB_CXX" + if test "$enable_static" = "yes"; then + INSTALL_LIBS="$INSTALL_LIBS \$(libcxx)" + fi +fi + + +# MinGW support. +if test "$db_cv_mingw" = "yes"; then + OSDIR=os_win32 + PATH_SEPARATOR="\\\\/:" + + cat >>confdefs.h <<\_ACEOF +#define DBSQL_WIN32 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +else + OSDIR=os + PATH_SEPARATOR="/" +fi + +# Apple's Mac OS/X had to rename shared libraries, so much for standards. +case "$host_os" in + darwin*) + LIBTSO_MODULE="" + LIBTSO_MODSUFFIX=".dylib" + ;; + *) + LIBTSO_MODULE="-module" + LIBTSO_MODSUFFIX=@MODSUFFIX@ + ;; +esac + + +if test "$db_cv_tcl" = "yes"; then + if test `$LIBTOOL_PROG --config | grep build_libtool_libs | grep no` 2>/dev/null; then + { { echo "$as_me:$LINENO: error: Tcl requires shared libraries" >&5 +echo "$as_me: error: Tcl requires shared libraries" >&2;} + { (exit 1); exit 1; }; } + fi + + + if test "${ac_cv_c_tclconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + # First check to see if --with-tclconfig was specified. + if test x"${with_tclconfig}" != x; then + if test -f "${with_tclconfig}/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` + else + { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5 +echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;} + { (exit 1); exit 1; }; } + fi + fi + + # check in a few common install locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in `ls -d /usr/local/lib 2>/dev/null` ; do + if test -f "$i/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i; pwd)` + break + fi + done + fi + + +fi + + + if test x"${ac_cv_c_tclconfig}" = x ; then + TCL_BIN_DIR="# no Tcl configs found" + { { echo "$as_me:$LINENO: error: can't find Tcl configuration definitions" >&5 +echo "$as_me: error: can't find Tcl configuration definitions" >&2;} + { (exit 1); exit 1; }; } + else + TCL_BIN_DIR=${ac_cv_c_tclconfig} + fi + + + + { echo "$as_me:$LINENO: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 +echo $ECHO_N "checking for existence of $TCL_BIN_DIR/tclConfig.sh... $ECHO_C" >&6; } + + if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + { echo "$as_me:$LINENO: result: loading" >&5 +echo "${ECHO_T}loading" >&6; } + . $TCL_BIN_DIR/tclConfig.sh + else + { echo "$as_me:$LINENO: result: file not found" >&5 +echo "${ECHO_T}file not found" >&6; } + fi + + # DBSQL requires at least version 8.4. + if test ${TCL_MAJOR_VERSION} -lt 8 \ + -o ${TCL_MAJOR_VERSION} -eq 8 -a ${TCL_MINOR_VERSION} -lt 4; then + { { echo "$as_me:$LINENO: error: Berkeley DB requires Tcl version 8.4 or better." >&5 +echo "$as_me: error: Berkeley DB requires Tcl version 8.4 or better." >&2;} + { (exit 1); exit 1; }; } + fi + + if test x"$TCL_INCLUDE_SPEC" != x; then + TCL_CFLAGS="$TCL_INCLUDE_SPEC" + fi + + + + + + + if test x"$TCL_INCLUDE_SPEC" != x && test -f "$TCL_INCLUDE_SPEC/tcl.h"; then + TCL_CFLAGS="${TCL_CFLAGS} -I$TCL_INCLUDE_SPEC" + fi + + INSTALL_LIBS="${INSTALL_LIBS} \$(libtso_target)" + + TCL_TCLSH="${TCL_PREFIX}/bin/tclsh${TCL_VERSION}" + + + + + +fi + +# You can disable pieces of functionality to save space. + +# The stat code. +if test "$db_cv_build_statistics" = "yes"; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_STATISTICS 1 +_ACEOF + + + +fi + +# Checks for include files, structures, C types. +{ echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 +echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6; } +if test "${ac_cv_header_stat_broken+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 +#include + +#if defined S_ISBLK && defined S_IFDIR +# if S_ISBLK (S_IFDIR) +You lose. +# endif +#endif + +#if defined S_ISBLK && defined S_IFCHR +# if S_ISBLK (S_IFCHR) +You lose. +# endif +#endif + +#if defined S_ISLNK && defined S_IFREG +# if S_ISLNK (S_IFREG) +You lose. +# endif +#endif + +#if defined S_ISSOCK && defined S_IFREG +# if S_ISSOCK (S_IFREG) +You lose. +# endif +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "You lose" >/dev/null 2>&1; then + ac_cv_header_stat_broken=yes +else + ac_cv_header_stat_broken=no +fi +rm -f conftest* + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5 +echo "${ECHO_T}$ac_cv_header_stat_broken" >&6; } +if test $ac_cv_header_stat_broken = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STAT_MACROS_BROKEN 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; } +if test "${ac_cv_header_time+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 +#include +#include + +int +main () +{ +if ((struct tm *) 0) +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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_header_time=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_time=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then + +cat >>confdefs.h <<\_ACEOF +#define TIME_WITH_SYS_TIME 1 +_ACEOF + +fi + + + + + + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 +echo $ECHO_N "checking for $ac_hdr that defines DIR... $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. */ +#include +#include <$ac_hdr> + +int +main () +{ +if ((DIR *) 0) +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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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 + 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_hdr" | $as_tr_cpp` 1 +_ACEOF + +ac_header_dirent=$ac_hdr; break +fi + +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then + { echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } +if test "${ac_cv_search_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$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 opendir (); +int +main () +{ +return opendir (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dir; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_search_opendir=$ac_res +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_exeext + if test "${ac_cv_search_opendir+set}" = set; then + break +fi +done +if test "${ac_cv_search_opendir+set}" = set; then + : +else + ac_cv_search_opendir=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +else + { echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } +if test "${ac_cv_search_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$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 opendir (); +int +main () +{ +return opendir (); + ; + return 0; +} +_ACEOF +for ac_lib in '' x; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_search_opendir=$ac_res +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_exeext + if test "${ac_cv_search_opendir+set}" = set; then + break +fi +done +if test "${ac_cv_search_opendir+set}" = set; then + : +else + ac_cv_search_opendir=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +fi + + + + +for ac_header in sys/select.h sys/time.h sys/fcntl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { 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 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header 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 <$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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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 $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header 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 <$ac_header> +_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; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to support@dbsql.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ 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 + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +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 for struct stat.st_blksize" >&5 +echo $ECHO_N "checking for struct stat.st_blksize... $ECHO_C" >&6; } +if test "${ac_cv_member_struct_stat_st_blksize+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 +int +main () +{ +static struct stat ac_aggr; +if (ac_aggr.st_blksize) +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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_member_struct_stat_st_blksize=yes +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 +int +main () +{ +static struct stat ac_aggr; +if (sizeof ac_aggr.st_blksize) +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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_member_struct_stat_st_blksize=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_member_struct_stat_st_blksize=no +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 +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_blksize" >&6; } +if test $ac_cv_member_struct_stat_st_blksize = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 +_ACEOF + + +fi + + + +# db.h includes and , not the other default includes +# autoconf usually includes. For that reason, we specify a set of includes +# for all type checking tests. [#5060] +# +# IBM's OS/390 and z/OS releases have types in not also found +# in . Include as well, if it exists. + +db_includes="#include " +if test "${ac_cv_header_inttypes_h+set}" = set; then + { echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6; } +if test "${ac_cv_header_inttypes_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$ac_cv_header_inttypes_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking inttypes.h usability" >&5 +echo $ECHO_N "checking inttypes.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 +_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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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 inttypes.h presence" >&5 +echo $ECHO_N "checking inttypes.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 +_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; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_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: inttypes.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: inttypes.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: inttypes.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: inttypes.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: inttypes.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: inttypes.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: inttypes.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: inttypes.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: inttypes.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: inttypes.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: inttypes.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: inttypes.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: inttypes.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: inttypes.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: inttypes.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: inttypes.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------- ## +## Report this to support@dbsql.org ## +## -------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6; } +if test "${ac_cv_header_inttypes_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_inttypes_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$ac_cv_header_inttypes_h" >&6; } + +fi +if test $ac_cv_header_inttypes_h = yes; then + + inttypes_decl="#include " + db_includes="$db_includes +#include " +fi + + +db_includes="$db_includes +#include " + +# We need to know the sizes of various objects on this system. +# We don't use the SIZEOF_XXX values created by autoconf. +{ echo "$as_me:$LINENO: checking for char" >&5 +echo $ECHO_N "checking for char... $ECHO_C" >&6; } +if test "${ac_cv_type_char+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. */ +$db_includes + +typedef char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_char=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_char=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_char" >&5 +echo "${ECHO_T}$ac_cv_type_char" >&6; } + +{ echo "$as_me:$LINENO: checking size of char" >&5 +echo $ECHO_N "checking size of char... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_char+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_char" = yes; then + # 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. + 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. */ +$db_includes + + typedef char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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_char=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (char) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (char) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$db_includes + + typedef char 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 +#include +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_char=`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 ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (char) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (char) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +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 +else + ac_cv_sizeof_char=0 +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5 +echo "${ECHO_T}$ac_cv_sizeof_char" >&6; } +cat >>confdefs.h <<_ACEOF +#define SIZEOF_CHAR $ac_cv_sizeof_char +_ACEOF + + +{ echo "$as_me:$LINENO: checking for unsigned char" >&5 +echo $ECHO_N "checking for unsigned char... $ECHO_C" >&6; } +if test "${ac_cv_type_unsigned_char+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. */ +$db_includes + +typedef unsigned char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_unsigned_char=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_unsigned_char=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_char" >&5 +echo "${ECHO_T}$ac_cv_type_unsigned_char" >&6; } + +{ echo "$as_me:$LINENO: checking size of unsigned char" >&5 +echo $ECHO_N "checking size of unsigned char... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_unsigned_char+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_unsigned_char" = yes; then + # 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. + 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. */ +$db_includes + + typedef unsigned char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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_unsigned_char=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned char) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (unsigned char) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$db_includes + + typedef unsigned char 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 +#include +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_unsigned_char=`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 ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned char) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (unsigned char) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +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 +else + ac_cv_sizeof_unsigned_char=0 +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_char" >&5 +echo "${ECHO_T}$ac_cv_sizeof_unsigned_char" >&6; } +cat >>confdefs.h <<_ACEOF +#define SIZEOF_UNSIGNED_CHAR $ac_cv_sizeof_unsigned_char +_ACEOF + + +{ echo "$as_me:$LINENO: checking for short" >&5 +echo $ECHO_N "checking for short... $ECHO_C" >&6; } +if test "${ac_cv_type_short+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. */ +$db_includes + +typedef short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_short=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_short=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 +echo "${ECHO_T}$ac_cv_type_short" >&6; } + +{ echo "$as_me:$LINENO: checking size of short" >&5 +echo $ECHO_N "checking size of short... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_short+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_short" = yes; then + # 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. + 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. */ +$db_includes + + typedef short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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_short=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (short) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$db_includes + + typedef short 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 +#include +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_short=`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 ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (short) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +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 +else + ac_cv_sizeof_short=0 +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 +echo "${ECHO_T}$ac_cv_sizeof_short" >&6; } +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SHORT $ac_cv_sizeof_short +_ACEOF + + +{ echo "$as_me:$LINENO: checking for unsigned short" >&5 +echo $ECHO_N "checking for unsigned short... $ECHO_C" >&6; } +if test "${ac_cv_type_unsigned_short+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. */ +$db_includes + +typedef unsigned short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_unsigned_short=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_unsigned_short=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_short" >&5 +echo "${ECHO_T}$ac_cv_type_unsigned_short" >&6; } + +{ echo "$as_me:$LINENO: checking size of unsigned short" >&5 +echo $ECHO_N "checking size of unsigned short... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_unsigned_short+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_unsigned_short" = yes; then + # 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. + 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. */ +$db_includes + + typedef unsigned short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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_unsigned_short=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (unsigned short) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$db_includes + + typedef unsigned short 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 +#include +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_unsigned_short=`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 ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (unsigned short) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +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 +else + ac_cv_sizeof_unsigned_short=0 +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_short" >&5 +echo "${ECHO_T}$ac_cv_sizeof_unsigned_short" >&6; } +cat >>confdefs.h <<_ACEOF +#define SIZEOF_UNSIGNED_SHORT $ac_cv_sizeof_unsigned_short +_ACEOF + + +{ echo "$as_me:$LINENO: checking for int" >&5 +echo $ECHO_N "checking for int... $ECHO_C" >&6; } +if test "${ac_cv_type_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. */ +$db_includes + +typedef 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_int=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 +echo "${ECHO_T}$ac_cv_type_int" >&6; } + +{ echo "$as_me:$LINENO: checking size of int" >&5 +echo $ECHO_N "checking size of int... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_int" = yes; then + # 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. + 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. */ +$db_includes + + typedef 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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_int=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$db_includes + + typedef 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 +#include +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_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 ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +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 +else + ac_cv_sizeof_int=0 +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6; } +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + +{ echo "$as_me:$LINENO: checking for unsigned int" >&5 +echo $ECHO_N "checking for unsigned int... $ECHO_C" >&6; } +if test "${ac_cv_type_unsigned_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. */ +$db_includes + +typedef unsigned 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_unsigned_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_unsigned_int=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_int" >&5 +echo "${ECHO_T}$ac_cv_type_unsigned_int" >&6; } + +{ echo "$as_me:$LINENO: checking size of unsigned int" >&5 +echo $ECHO_N "checking size of unsigned int... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_unsigned_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_unsigned_int" = yes; then + # 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. + 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. */ +$db_includes + + typedef unsigned 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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_unsigned_int=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned int) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (unsigned int) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$db_includes + + typedef unsigned 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 +#include +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_unsigned_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 ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned int) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (unsigned int) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +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 +else + ac_cv_sizeof_unsigned_int=0 +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_unsigned_int" >&6; } +cat >>confdefs.h <<_ACEOF +#define SIZEOF_UNSIGNED_INT $ac_cv_sizeof_unsigned_int +_ACEOF + + +{ echo "$as_me:$LINENO: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6; } +if test "${ac_cv_type_long+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. */ +$db_includes + +typedef long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6; } + +{ echo "$as_me:$LINENO: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_long" = yes; then + # 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. + 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. */ +$db_includes + + typedef long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$db_includes + + typedef long 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 +#include +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=`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 ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +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 +else + ac_cv_sizeof_long=0 +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6; } +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + +{ echo "$as_me:$LINENO: checking for unsigned long" >&5 +echo $ECHO_N "checking for unsigned long... $ECHO_C" >&6; } +if test "${ac_cv_type_unsigned_long+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. */ +$db_includes + +typedef unsigned long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_unsigned_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_unsigned_long=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long" >&5 +echo "${ECHO_T}$ac_cv_type_unsigned_long" >&6; } + +{ echo "$as_me:$LINENO: checking size of unsigned long" >&5 +echo $ECHO_N "checking size of unsigned long... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_unsigned_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_unsigned_long" = yes; then + # 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. + 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. */ +$db_includes + + typedef unsigned long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef unsigned long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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_unsigned_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (unsigned long) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$db_includes + + typedef unsigned long 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 +#include +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_unsigned_long=`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 ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (unsigned long) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +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 +else + ac_cv_sizeof_unsigned_long=0 +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_unsigned_long" >&6; } +cat >>confdefs.h <<_ACEOF +#define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long +_ACEOF + + +{ echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } +if test "${ac_cv_type_size_t+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. */ +$db_includes + +typedef size_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_size_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6; } + +{ echo "$as_me:$LINENO: checking size of size_t" >&5 +echo $ECHO_N "checking size of size_t... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_size_t" = yes; then + # 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. + 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. */ +$db_includes + + typedef size_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef size_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef size_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef size_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef size_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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_size_t=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (size_t) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$db_includes + + typedef size_t 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 +#include +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_size_t=`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 ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (size_t) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +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 +else + ac_cv_sizeof_size_t=0 +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_size_t" >&6; } +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t +_ACEOF + + +{ echo "$as_me:$LINENO: checking for char *" >&5 +echo $ECHO_N "checking for char *... $ECHO_C" >&6; } +if test "${ac_cv_type_char_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. */ +$db_includes + +typedef char * 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_char_p=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_char_p=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_char_p" >&5 +echo "${ECHO_T}$ac_cv_type_char_p" >&6; } + +{ echo "$as_me:$LINENO: checking size of char *" >&5 +echo $ECHO_N "checking size of char *... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_char_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_char_p" = yes; then + # 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. + 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. */ +$db_includes + + typedef char * 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef char * 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef char * 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef char * 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef char * 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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_char_p=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (char *) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (char *) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$db_includes + + typedef char * 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 +#include +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_char_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 ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (char *) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (char *) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +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 +else + ac_cv_sizeof_char_p=0 +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_char_p" >&5 +echo "${ECHO_T}$ac_cv_sizeof_char_p" >&6; } +cat >>confdefs.h <<_ACEOF +#define SIZEOF_CHAR_P $ac_cv_sizeof_char_p +_ACEOF + + +{ echo "$as_me:$LINENO: checking for long double" >&5 +echo $ECHO_N "checking for long double... $ECHO_C" >&6; } +if test "${ac_cv_type_long_double+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. */ +$db_includes + +typedef long double 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_long_double=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_double=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5 +echo "${ECHO_T}$ac_cv_type_long_double" >&6; } + +{ echo "$as_me:$LINENO: checking size of long double" >&5 +echo $ECHO_N "checking size of long double... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_long_double" = yes; then + # 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. + 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. */ +$db_includes + + typedef long double 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef long double 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef long double 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef long double 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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. */ +$db_includes + + typedef long double 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_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_double=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long double) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$db_includes + + typedef long double 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 +#include +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_double=`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 ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long double) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long double) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +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 +else + ac_cv_sizeof_long_double=0 +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_double" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_double" >&6; } +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double +_ACEOF + + + +# We require off_t and size_t, and we don't try to substitute our own +# if we can't find them. +{ echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6; } +if test "${ac_cv_type_off_t+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. */ +$db_includes + +typedef off_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_off_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_off_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6; } +if test $ac_cv_type_off_t = yes; then + : +else + { { echo "$as_me:$LINENO: error: No off_t type." >&5 +echo "$as_me: error: No off_t type." >&2;} + { (exit 1); exit 1; }; } +fi + +{ echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } +if test "${ac_cv_type_size_t+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. */ +$db_includes + +typedef size_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_size_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6; } +if test $ac_cv_type_size_t = yes; then + : +else + { { echo "$as_me:$LINENO: error: No size_t type." >&5 +echo "$as_me: error: No size_t type." >&2;} + { (exit 1); exit 1; }; } +fi + + +# We look for u_char, u_short, u_int, u_long -- if we can't find them, +# we create our own. + +{ echo "$as_me:$LINENO: checking for u_char" >&5 +echo $ECHO_N "checking for u_char... $ECHO_C" >&6; } +if test "${ac_cv_type_u_char+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. */ +$db_includes + +typedef u_char 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_u_char=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_char=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_u_char" >&5 +echo "${ECHO_T}$ac_cv_type_u_char" >&6; } +if test $ac_cv_type_u_char = yes; then + : +else + u_char_decl="typedef unsigned char u_char;" +fi + + + +{ echo "$as_me:$LINENO: checking for u_short" >&5 +echo $ECHO_N "checking for u_short... $ECHO_C" >&6; } +if test "${ac_cv_type_u_short+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. */ +$db_includes + +typedef u_short 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_u_short=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_short=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_u_short" >&5 +echo "${ECHO_T}$ac_cv_type_u_short" >&6; } +if test $ac_cv_type_u_short = yes; then + : +else + u_short_decl="typedef unsigned short u_short;" +fi + + + +{ echo "$as_me:$LINENO: checking for u_int" >&5 +echo $ECHO_N "checking for u_int... $ECHO_C" >&6; } +if test "${ac_cv_type_u_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. */ +$db_includes + +typedef u_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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_u_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_int=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_u_int" >&5 +echo "${ECHO_T}$ac_cv_type_u_int" >&6; } +if test $ac_cv_type_u_int = yes; then + : +else + u_int_decl="typedef unsigned int u_int;" +fi + + + +{ echo "$as_me:$LINENO: checking for u_long" >&5 +echo $ECHO_N "checking for u_long... $ECHO_C" >&6; } +if test "${ac_cv_type_u_long+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. */ +$db_includes + +typedef u_long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_u_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_long=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_u_long" >&5 +echo "${ECHO_T}$ac_cv_type_u_long" >&6; } +if test $ac_cv_type_u_long = yes; then + : +else + u_long_decl="typedef unsigned long u_long;" +fi + + + +{ echo "$as_me:$LINENO: checking for u_int8_t" >&5 +echo $ECHO_N "checking for u_int8_t... $ECHO_C" >&6; } +if test "${ac_cv_type_u_int8_t+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. */ +$db_includes + +typedef u_int8_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_u_int8_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_int8_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_u_int8_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int8_t" >&6; } +if test $ac_cv_type_u_int8_t = yes; then + : +else + + case "1" in + "$ac_cv_sizeof_unsigned_int") + u_int8_decl="typedef unsigned int u_int8_t;";; + "$ac_cv_sizeof_unsigned_char") + u_int8_decl="typedef unsigned char u_int8_t;";; + "$ac_cv_sizeof_unsigned_short") + u_int8_decl="typedef unsigned short u_int8_t;";; + "$ac_cv_sizeof_unsigned_long") + u_int8_decl="typedef unsigned long u_int8_t;";; + *) + { { echo "$as_me:$LINENO: error: No unsigned 1-byte integral type" >&5 +echo "$as_me: error: No unsigned 1-byte integral type" >&2;} + { (exit 1); exit 1; }; };; + esac +fi + + + +{ echo "$as_me:$LINENO: checking for u_int16_t" >&5 +echo $ECHO_N "checking for u_int16_t... $ECHO_C" >&6; } +if test "${ac_cv_type_u_int16_t+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. */ +$db_includes + +typedef u_int16_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_u_int16_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_int16_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_u_int16_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int16_t" >&6; } +if test $ac_cv_type_u_int16_t = yes; then + : +else + + case "2" in + "$ac_cv_sizeof_unsigned_int") + u_int16_decl="typedef unsigned int u_int16_t;";; + "$ac_cv_sizeof_unsigned_char") + u_int16_decl="typedef unsigned char u_int16_t;";; + "$ac_cv_sizeof_unsigned_short") + u_int16_decl="typedef unsigned short u_int16_t;";; + "$ac_cv_sizeof_unsigned_long") + u_int16_decl="typedef unsigned long u_int16_t;";; + *) + { { echo "$as_me:$LINENO: error: No unsigned 2-byte integral type" >&5 +echo "$as_me: error: No unsigned 2-byte integral type" >&2;} + { (exit 1); exit 1; }; };; + esac +fi + + + +{ echo "$as_me:$LINENO: checking for int16_t" >&5 +echo $ECHO_N "checking for int16_t... $ECHO_C" >&6; } +if test "${ac_cv_type_int16_t+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. */ +$db_includes + +typedef int16_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_int16_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_int16_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_int16_t" >&5 +echo "${ECHO_T}$ac_cv_type_int16_t" >&6; } +if test $ac_cv_type_int16_t = yes; then + : +else + + case "2" in + "$ac_cv_sizeof_int") + int16_decl="typedef int int16_t;";; + "$ac_cv_sizeof_char") + int16_decl="typedef char int16_t;";; + "$ac_cv_sizeof_short") + int16_decl="typedef short int16_t;";; + "$ac_cv_sizeof_long") + int16_decl="typedef long int16_t;";; + *) + { { echo "$as_me:$LINENO: error: No signed 2-byte integral type" >&5 +echo "$as_me: error: No signed 2-byte integral type" >&2;} + { (exit 1); exit 1; }; };; + esac +fi + + + +{ echo "$as_me:$LINENO: checking for u_int32_t" >&5 +echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6; } +if test "${ac_cv_type_u_int32_t+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. */ +$db_includes + +typedef u_int32_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_u_int32_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_int32_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6; } +if test $ac_cv_type_u_int32_t = yes; then + : +else + + case "4" in + "$ac_cv_sizeof_unsigned_int") + u_int32_decl="typedef unsigned int u_int32_t;";; + "$ac_cv_sizeof_unsigned_char") + u_int32_decl="typedef unsigned char u_int32_t;";; + "$ac_cv_sizeof_unsigned_short") + u_int32_decl="typedef unsigned short u_int32_t;";; + "$ac_cv_sizeof_unsigned_long") + u_int32_decl="typedef unsigned long u_int32_t;";; + *) + { { echo "$as_me:$LINENO: error: No unsigned 4-byte integral type" >&5 +echo "$as_me: error: No unsigned 4-byte integral type" >&2;} + { (exit 1); exit 1; }; };; + esac +fi + + + +{ echo "$as_me:$LINENO: checking for int32_t" >&5 +echo $ECHO_N "checking for int32_t... $ECHO_C" >&6; } +if test "${ac_cv_type_int32_t+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. */ +$db_includes + +typedef int32_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_int32_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_int32_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 +echo "${ECHO_T}$ac_cv_type_int32_t" >&6; } +if test $ac_cv_type_int32_t = yes; then + : +else + + case "4" in + "$ac_cv_sizeof_int") + int32_decl="typedef int int32_t;";; + "$ac_cv_sizeof_char") + int32_decl="typedef char int32_t;";; + "$ac_cv_sizeof_short") + int32_decl="typedef short int32_t;";; + "$ac_cv_sizeof_long") + int32_decl="typedef long int32_t;";; + *) + { { echo "$as_me:$LINENO: error: No signed 4-byte integral type" >&5 +echo "$as_me: error: No signed 4-byte integral type" >&2;} + { (exit 1); exit 1; }; };; + esac +fi + + + +{ echo "$as_me:$LINENO: checking for long double" >&5 +echo $ECHO_N "checking for long double... $ECHO_C" >&6; } +if test "${ac_cv_type_long_double+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. */ +$db_includes + +typedef long double 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_long_double=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_double=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5 +echo "${ECHO_T}$ac_cv_type_long_double" >&6; } +if test $ac_cv_type_long_double = yes; then + long_double_decl="typedef long double long_double_t;" +else + long_double_decl="typedef long double long_double_t;" +fi + + +# Check for ssize_t -- if none exists, find a signed integral type that's +# the same size as a size_t. + +{ echo "$as_me:$LINENO: checking for ssize_t" >&5 +echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; } +if test "${ac_cv_type_ssize_t+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. */ +$db_includes + +typedef ssize_t 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_ssize_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_ssize_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5 +echo "${ECHO_T}$ac_cv_type_ssize_t" >&6; } +if test $ac_cv_type_ssize_t = yes; then + : +else + + case "$ac_cv_sizeof_size_t" in + "$ac_cv_sizeof_int") + ssize_t_decl="typedef int ssize_t;";; + "$ac_cv_sizeof_char") + ssize_t_decl="typedef char ssize_t;";; + "$ac_cv_sizeof_short") + ssize_t_decl="typedef short ssize_t;";; + "$ac_cv_sizeof_long") + ssize_t_decl="typedef long ssize_t;";; + *) + { { echo "$as_me:$LINENO: error: No signed $ac_cv_sizeof_size_t-byte integral type" >&5 +echo "$as_me: error: No signed $ac_cv_sizeof_size_t-byte integral type" >&2;} + { (exit 1); exit 1; }; };; + esac +fi + + +# Find the largest integral type. + +{ echo "$as_me:$LINENO: checking for unsigned long long" >&5 +echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6; } +if test "${ac_cv_type_unsigned_long_long+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. */ +$db_includes + +typedef unsigned long long 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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_type_unsigned_long_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_unsigned_long_long=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6; } +if test $ac_cv_type_unsigned_long_long = yes; then + db_align_t_decl="typedef unsigned long long db_align_t;" +else + db_align_t_decl="typedef unsigned long db_align_t;" +fi + + +# Find an integral type which is the same size as a pointer. + + + case "$ac_cv_sizeof_char_p" in + "$ac_cv_sizeof_unsigned_int") + db_alignp_t_decl="typedef unsigned int db_alignp_t;";; + "$ac_cv_sizeof_unsigned_char") + db_alignp_t_decl="typedef unsigned char db_alignp_t;";; + "$ac_cv_sizeof_unsigned_short") + db_alignp_t_decl="typedef unsigned short db_alignp_t;";; + "$ac_cv_sizeof_unsigned_long") + db_alignp_t_decl="typedef unsigned long db_alignp_t;";; + *) + { { echo "$as_me:$LINENO: error: No unsigned $ac_cv_sizeof_char_p-byte integral type" >&5 +echo "$as_me: error: No unsigned $ac_cv_sizeof_char_p-byte integral type" >&2;} + { (exit 1); exit 1; }; };; + esac + + +{ echo "$as_me:$LINENO: checking for ANSI C exit success/failure values" >&5 +echo $ECHO_N "checking for ANSI C exit success/failure values... $ECHO_C" >&6; } +if test "${db_cv_exit_defines+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 +int +main () +{ +return (EXIT_SUCCESS); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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 + db_cv_exit_defines=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + db_cv_exit_defines=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $db_cv_exit_defines" >&5 +echo "${ECHO_T}$db_cv_exit_defines" >&6; } +if test "$db_cv_exit_defines" = "yes"; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_EXIT_SUCCESS 1 +_ACEOF + + + +fi + +# Test for various functions/libraries that the test and example programs use: +# sched_yield function +# pthreads, socket and math libraries +{ echo "$as_me:$LINENO: checking for sched_yield" >&5 +echo $ECHO_N "checking for sched_yield... $ECHO_C" >&6; } +if test "${ac_cv_func_sched_yield+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. */ +/* Define sched_yield to an innocuous variant, in case declares sched_yield. + For example, HP-UX 11i declares gettimeofday. */ +#define sched_yield innocuous_sched_yield + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char sched_yield (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef sched_yield + +/* 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 sched_yield (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_sched_yield || defined __stub___sched_yield +choke me +#endif + +int +main () +{ +return sched_yield (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_func_sched_yield=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_sched_yield=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_sched_yield" >&5 +echo "${ECHO_T}$ac_cv_func_sched_yield" >&6; } +if test $ac_cv_func_sched_yield = yes; then + : +else + { echo "$as_me:$LINENO: checking for library containing sched_yield" >&5 +echo $ECHO_N "checking for library containing sched_yield... $ECHO_C" >&6; } +if test "${ac_cv_search_sched_yield+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$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 sched_yield (); +int +main () +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_search_sched_yield=$ac_res +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_exeext + if test "${ac_cv_search_sched_yield+set}" = set; then + break +fi +done +if test "${ac_cv_search_sched_yield+set}" = set; then + : +else + ac_cv_search_sched_yield=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_sched_yield" >&5 +echo "${ECHO_T}$ac_cv_search_sched_yield" >&6; } +ac_res=$ac_cv_search_sched_yield +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + LOAD_LIBS="$LOAD_LIBS -lrt" +fi + +fi + + +# XXX +# We can't check for pthreads in the same way we did the test for sched_yield +# because the Solaris C library includes pthread interfaces which are not +# thread-safe. For that reason we always add -lpthread if we find a pthread +# library. Also we can't depend on any specific call existing (pthread_create, +# for example), as it may be #defined in an include file -- OSF/1 (Tru64) has +# this problem. +{ echo "$as_me:$LINENO: checking for main in -lpthread" >&5 +echo $ECHO_N "checking for main in -lpthread... $ECHO_C" >&6; } +if test "${ac_cv_lib_pthread_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +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 main (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_pthread_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_pthread_main=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_main" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_main" >&6; } +if test $ac_cv_lib_pthread_main = yes; then + LOAD_LIBS="$LOAD_LIBS -lpthread" +fi +ac_cv_lib_pthread=ac_cv_lib_pthread_main + + +# We use sqrt() so we need the math library -lm +{ echo "$as_me:$LINENO: checking for main in -lm" >&5 +echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6; } +if test "${ac_cv_lib_m_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +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 main (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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_lib_m_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_m_main=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5 +echo "${ECHO_T}$ac_cv_lib_m_main" >&6; } +if test $ac_cv_lib_m_main = yes; then + LIBS="$LIBS -lm" +fi +ac_cv_lib_m=ac_cv_lib_m_main + + +# Checks for system functions for which we have replacements. + + + + + + + +for ac_func in getopt memcmp memcpy memmove strdup strndup strerror +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; 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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* 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 $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + case " $LIBOBJS " in + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" + ;; +esac + +fi +done + + + + + + +for ac_func in snprintf localtime_r strcasecmp strncasecmp +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; 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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* 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 $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + case " $LIBOBJS " in + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" + ;; +esac + +fi +done + + + + +for ac_func in srand48_r lrand48_r +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; 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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* 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 $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + case " $LIBOBJS " in + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" + ;; +esac + +fi +done + + + +# Check for system functions we use. + +for ac_func in usleep +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; 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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* 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 $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s 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 + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +# A/UX has a broken getopt(3). +case "$host_os" in +aux*) case " $LIBOBJS " in + *" getopt.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getopt.$ac_objext" + ;; +esac +;; +esac + +# Apple's Mac OS/X complains about long doubles, make it stop. +case "$host_os" in + darwin*) + CFLAGS="$CFLAGS -Wno-long-double -no-cpp-precomp" + ;; +esac + +# We need to add the additional object files into the Makefile with the correct +# suffix. We can't use $LTLIBOBJS itself, because that variable has $U encoded +# in it for automake, and that's not what we want. See SR #7227 for additional +# information. +# +# XXX: I'm not sure this is correct. +REPLACEMENT_OBJS=`echo "$LIBOBJS" | + sed "s,\.[^.]* ,$o ,g;s,\.[^.]*$,$o,"` + +# This is necessary so that .o files in LIBOBJS are also built via +# the ANSI2KNR-filtering rules. +LIBOBJS=`echo "$LIBOBJS" | + sed 's,\.[^.]* ,$U&,g;s,\.[^.]*$,$U&,'` +LTLIBOBJS=`echo "$LIBOBJS" | + sed 's,\.[^.]* ,.lo ,g;s,\.[^.]*$,.lo,'` + + +# Initial output file list. +CREATE_LIST="Makefile + dbsql_int.h:$srcdir/../src/inc/dbsql_int.in + $srcdir/../src/py/setup.py:$srcdir/../src/py/setup.py.in + $srcdir/../test/scr050/Makefile:$srcdir/../test/scr050/Makefile.in" + +# MinGW needs win_db.h. +if test "$db_cv_mingw" = "yes"; then +CREATE_LIST="$CREATE_LIST + win_db.h:$srcdir/win_dbsql.in" +fi + +# Create the dbsql.h file from a source file and a list of global function +# prototypes. +CREATE_LIST="$CREATE_LIST +dbsql.h:$srcdir/../src/dbsql.in" + +if test "$db_cv_rpm" = "yes"; then + CREATE_LIST="$CREATE_LIST db.spec:../dist/dbsql.spec.in" +fi + +ac_config_files="$ac_config_files $CREATE_LIST" + +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 Bourne compatible +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 +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + + +# 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 + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# 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 DBSQL $as_me 0.2.2, which was +generated by GNU Autoconf 2.60. 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, 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 ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +DBSQL config.status 0.2.2 +configured by $0, generated by GNU Autoconf 2.60, + 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 + "dbsql_config.h") CONFIG_HEADERS="$CONFIG_HEADERS dbsql_config.h:config.hin" ;; + "$CREATE_LIST") CONFIG_FILES="$CONFIG_FILES $CREATE_LIST" ;; + + *) { { 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 +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +ADDITIONAL_INCS!$ADDITIONAL_INCS$ac_delim +ADDITIONAL_LANG!$ADDITIONAL_LANG$ac_delim +ADDITIONAL_OBJS!$ADDITIONAL_OBJS$ac_delim +ADDITIONAL_PROGS!$ADDITIONAL_PROGS$ac_delim +BUILD_TARGET!$BUILD_TARGET$ac_delim +CFLAGS!$CFLAGS$ac_delim +CONFIGURATION_ARGS!$CONFIGURATION_ARGS$ac_delim +CONFIGURATION_PATH!$CONFIGURATION_PATH$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +CXX!$CXX$ac_delim +CXXFLAGS!$CXXFLAGS$ac_delim +DB_PATH!$DB_PATH$ac_delim +DB_UNIQUE_NAME!$DB_UNIQUE_NAME$ac_delim +DEFAULT_LIB!$DEFAULT_LIB$ac_delim +DEFAULT_LIB_CXX!$DEFAULT_LIB_CXX$ac_delim +ENCODING!$ENCODING$ac_delim +INSTALLER!$INSTALLER$ac_delim +INSTALL_LIBS!$INSTALL_LIBS$ac_delim +INSTALL_TARGET!$INSTALL_TARGET$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +LIBSO_LIBS!$LIBSO_LIBS$ac_delim +LIBTOOL!$LIBTOOL$ac_delim +LIBTSO_LIBS!$LIBTSO_LIBS$ac_delim +LIBTSO_MODSUFFIX!$LIBTSO_MODSUFFIX$ac_delim +LIBTSO_MODULE!$LIBTSO_MODULE$ac_delim +LIBXSO_LIBS!$LIBXSO_LIBS$ac_delim +LOAD_LIBS!$LOAD_LIBS$ac_delim +MAKEFILE_CC!$MAKEFILE_CC$ac_delim +MAKEFILE_CCLINK!$MAKEFILE_CCLINK$ac_delim +MAKEFILE_CXX!$MAKEFILE_CXX$ac_delim +MAKEFILE_CXXLINK!$MAKEFILE_CXXLINK$ac_delim +MAKEFILE_SOLINK!$MAKEFILE_SOLINK$ac_delim +MAKEFILE_XSOLINK!$MAKEFILE_XSOLINK$ac_delim +OSDIR!$OSDIR$ac_delim +POSTLINK!$POSTLINK$ac_delim +REPLACEMENT_OBJS!$REPLACEMENT_OBJS$ac_delim +RPC_CLIENT_OBJS!$RPC_CLIENT_OBJS$ac_delim +RPM_BUILD!$RPM_BUILD$ac_delim +RPM_POST_INSTALL!$RPM_POST_INSTALL$ac_delim +RPM_POST_UNINSTALL!$RPM_POST_UNINSTALL$ac_delim +SOFLAGS!$SOFLAGS$ac_delim +o!$o$ac_delim +DBSQL_VERSION_MAJOR!$DBSQL_VERSION_MAJOR$ac_delim +DBSQL_VERSION_MINOR!$DBSQL_VERSION_MINOR$ac_delim +DBSQL_VERSION_PATCH!$DBSQL_VERSION_PATCH$ac_delim +DBSQL_VERSION_STRING!$DBSQL_VERSION_STRING$ac_delim +DBSQL_VERSION_UNIQUE_NAME!$DBSQL_VERSION_UNIQUE_NAME$ac_delim +db_cv_path_ar!$db_cv_path_ar$ac_delim +db_cv_path_chmod!$db_cv_path_chmod$ac_delim +db_cv_path_sed!$db_cv_path_sed$ac_delim +db_cv_path_perl!$db_cv_path_perl$ac_delim +db_cv_path_makedepend!$db_cv_path_makedepend$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; 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 +_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 >$CONFIG_STATUS <<_ACEOF +CEOF$ac_eof +_ACEOF + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +db_cv_path_splint!$db_cv_path_splint$ac_delim +db_cv_path_python!$db_cv_path_python$ac_delim +db_cv_path_grep!$db_cv_path_grep$ac_delim +db_cv_path_awk!$db_cv_path_awk$ac_delim +db_cv_path_cp!$db_cv_path_cp$ac_delim +path_ldconfig!$path_ldconfig$ac_delim +db_cv_path_ldconfig!$db_cv_path_ldconfig$ac_delim +db_cv_path_ln!$db_cv_path_ln$ac_delim +db_cv_path_mkdir!$db_cv_path_mkdir$ac_delim +path_ranlib!$path_ranlib$ac_delim +db_cv_path_ranlib!$db_cv_path_ranlib$ac_delim +db_cv_path_rm!$db_cv_path_rm$ac_delim +db_cv_path_rpm!$db_cv_path_rpm$ac_delim +path_sh!$path_sh$ac_delim +db_cv_path_sh!$db_cv_path_sh$ac_delim +path_strip!$path_strip$ac_delim +db_cv_path_strip!$db_cv_path_strip$ac_delim +db_cv_path_kill!$db_cv_path_kill$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +db_cv_build_tcl_test_objs!$db_cv_build_tcl_test_objs$ac_delim +db_cv_build_type!$db_cv_build_type$ac_delim +CC!$CC$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +DB_PROTO1!$DB_PROTO1$ac_delim +DB_PROTO2!$DB_PROTO2$ac_delim +DB_CONST!$DB_CONST$ac_delim +CCC!$CCC$ac_delim +ac_ct_CXX!$ac_ct_CXX$ac_delim +CXXCPP!$CXXCPP$ac_delim +cxx_have_stdheaders!$cxx_have_stdheaders$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +LN_S!$LN_S$ac_delim +ECHO!$ECHO$ac_delim +AR!$AR$ac_delim +RANLIB!$RANLIB$ac_delim +STRIP!$STRIP$ac_delim +CPP!$CPP$ac_delim +F77!$F77$ac_delim +FFLAGS!$FFLAGS$ac_delim +ac_ct_F77!$ac_ct_F77$ac_delim +SOSUFFIX!$SOSUFFIX$ac_delim +MODSUFFIX!$MODSUFFIX$ac_delim +TCL_BIN_DIR!$TCL_BIN_DIR$ac_delim +TCL_LD_FLAGS!$TCL_LD_FLAGS$ac_delim +TCL_LIBS!$TCL_LIBS$ac_delim +TCL_LIB_SPEC!$TCL_LIB_SPEC$ac_delim +TCL_SRC_DIR!$TCL_SRC_DIR$ac_delim +TCL_LIB_FILE!$TCL_LIB_FILE$ac_delim +TCL_CFLAGS!$TCL_CFLAGS$ac_delim +TCL_TCLSH!$TCL_TCLSH$ac_delim +inttypes_decl!$inttypes_decl$ac_delim +u_char_decl!$u_char_decl$ac_delim +u_short_decl!$u_short_decl$ac_delim +u_int_decl!$u_int_decl$ac_delim +u_long_decl!$u_long_decl$ac_delim +u_int8_decl!$u_int8_decl$ac_delim +u_int16_decl!$u_int16_decl$ac_delim +int16_decl!$int16_decl$ac_delim +u_int32_decl!$u_int32_decl$ac_delim +int32_decl!$int32_decl$ac_delim +long_double_decl!$long_double_decl$ac_delim +ssize_t_decl!$ssize_t_decl$ac_delim +db_align_t_decl!$db_align_t_decl$ac_delim +db_alignp_t_decl!$db_alignp_t_decl$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` = 71; 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-2.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 >$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" | sed -f "$tmp/subs-2.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/dist/configure.ac b/dist/configure.ac new file mode 100644 index 0000000..62b33ea --- /dev/null +++ b/dist/configure.ac @@ -0,0 +1,530 @@ +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: configure.ac 7 2007-02-03 13:34:17Z gburd $ + +# Process this file with autoconf to produce a configure script. + +PACKAGE=dbsql +AC_INIT(DBSQL, + __EDIT_DBSQL_VERSION__, + support@dbsql.org, + dbsql-__EDIT_DBSQL_VERSION__) +AC_CONFIG_SRCDIR([../src/clib/memcmp.c]) +AC_CONFIG_HEADERS([dbsql_config.h:config.hin]) + +# Configure setup. +AC_CANONICAL_HOST() +AC_ARG_PROGRAM() + +# Don't build in the top-level or dist directories. +AC_MSG_CHECKING(if building in the top-level or dist directories) +if [ test -d build_unix -o -d aclocal ] ; then + AC_MSG_RESULT(yes) + AC_MSG_ERROR( + [DBSQL should not be built in the top-level or dist directories.]) +fi +AC_MSG_RESULT(no) + +# Substitution variables. +AC_SUBST(ADDITIONAL_INCS) +AC_SUBST(ADDITIONAL_LANG) +AC_SUBST(ADDITIONAL_OBJS) +AC_SUBST(ADDITIONAL_PROGS) +AC_SUBST(BUILD_TARGET) +AC_SUBST(CFLAGS) +AC_SUBST(CONFIGURATION_ARGS) +AC_SUBST(CONFIGURATION_PATH) +AC_SUBST(CPPFLAGS) +AC_SUBST(CXX) +AC_SUBST(CXXFLAGS) +AC_SUBST(DB_PATH) +AC_SUBST(DB_UNIQUE_NAME) +AC_SUBST(DEFAULT_LIB) +AC_SUBST(DEFAULT_LIB_CXX) +AC_SUBST(ENCODING) +AC_SUBST(INSTALLER) +AC_SUBST(INSTALL_LIBS) +AC_SUBST(INSTALL_TARGET) +AC_SUBST(LDFLAGS) +AC_SUBST(LIBS) +AC_SUBST(LIBSO_LIBS) +AC_SUBST(LIBTOOL) +AC_SUBST(LIBTSO_LIBS) +AC_SUBST(LIBTSO_MODSUFFIX) +AC_SUBST(LIBTSO_MODULE) +AC_SUBST(LIBXSO_LIBS) +AC_SUBST(LOAD_LIBS) +AC_SUBST(MAKEFILE_CC) +AC_SUBST(MAKEFILE_CCLINK) +AC_SUBST(MAKEFILE_CXX) +AC_SUBST(MAKEFILE_CXXLINK) +AC_SUBST(MAKEFILE_SOLINK) +AC_SUBST(MAKEFILE_XSOLINK) +AC_SUBST(OSDIR) +AC_SUBST(PATH_SEPARATOR) +AC_SUBST(POSTLINK) +AC_SUBST(REPLACEMENT_OBJS) +AC_SUBST(RPC_CLIENT_OBJS) +AC_SUBST(RPM_BUILD) +AC_SUBST(RPM_POST_INSTALL) +AC_SUBST(RPM_POST_UNINSTALL) +AC_SUBST(SOFLAGS) +AC_SUBST(o) + +# RPM needs the current absolute path. +# RPM needs the list of original arguments, but we don't include the RPM +# option itself. +CONFIGURATION_PATH=${PWD-`pwd`} +CONFIGURATION_ARGS=`echo "$*" | sed -e 's/--with-rpm[[^ ]]*//'` + +# Set the default installation location. +AC_PREFIX_DEFAULT(/usr/local/DBSQL.__EDIT_DBSQL_VERSION_MAJOR__.__EDIT_DBSQL_VERSION_MINOR__) + +# Configure the version information. +AC_SUBST(DBSQL_VERSION_MAJOR) +DBSQL_VERSION_MAJOR="__EDIT_DBSQL_VERSION_MAJOR__" +AC_SUBST(DBSQL_VERSION_MINOR) +DBSQL_VERSION_MINOR="__EDIT_DBSQL_VERSION_MINOR__" +AC_SUBST(DBSQL_VERSION_PATCH) +DBSQL_VERSION_PATCH="__EDIT_DBSQL_VERSION_PATCH__" +AC_SUBST(DBSQL_VERSION_STRING) +DBSQL_VERSION_STRING='"__EDIT_DBSQL_VERSION_STRING__"' +AC_SUBST(DBSQL_VERSION_UNIQUE_NAME) + +# Process all options before using them. +AM_OPTIONS_SET + +# Set some #defines based on configuration options. +if test "$db_cv_diagnostic" = "yes"; then + AC_DEFINE(DIAGNOSTIC) + AH_TEMPLATE(DIAGNOSTIC, + [Define to 1 if you want a version with run-time diagnostic checking.]) +fi +if test "$db_cv_test" = "yes"; then + AC_DEFINE(CONFIG_TEST) + AH_TEMPLATE(CONFIG_TEST, + [Define to 1 if you want to build a version for running the test suite.]) +fi + +# Check for programs used in building and installation. +AM_PROGRAMS_SET +AC_PROG_INSTALL + +# RPM support: change the standard make and install targets +if test "$db_cv_rpm" = "yes"; then + BUILD_TARGET="rpm_build" + + # Check if we are running RPM version 3 or 4. + case "`rpm --version`" in + *version\ 4*) + RPM_BUILD="rpmbuild" + echo "_topdir $CONFIGURATION_PATH" > rpm-macro-defines;; + *version\ 3*) + RPM_BUILD="rpm" + echo "topdir: $CONFIGURATION_PATH" > rpm-macro-defines;; + esac + INSTALL_TARGET="rpm_install" +else + BUILD_TARGET="library_build" + INSTALL_TARGET="library_install" +fi + +# This is where we handle stuff that autoconf can't handle: compiler, +# preprocessor and load flags, libraries that the standard tests don't +# look for. The default optimization is -O. We would like to set the +# default optimization for systems using gcc to -O2, but we can't. By +# the time we know we're using gcc, it's too late to set optimization +# flags. +# +# There are additional libraries we need for some compiler/architecture +# combinations. +# +# Some architectures require DB to be compiled with special flags and/or +# libraries for threaded applications +# +# The makefile CC may be different than the CC used in config testing, +# because the makefile CC may be set to use $(LIBTOOL). +# +# XXX +# Don't override anything if it's already set from the environment. +optimize_def="-O" +case "$host_os" in +aix4.3.*|aix5*) + optimize_def="-O2" + CC=${CC-"xlc_r"} + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + LDFLAGS="$LDFLAGS -Wl,-brtl";; +bsdi3*) optimize_def="-O2" + CC=${CC-"shlicc2"} + LIBS="$LIBS -lipc";; +bsdi*) optimize_def="-O2";; +cygwin*) + optimize_def="-O2" + CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_REENTRANT";; +freebsd*) + optimize_def="-O2" + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + LDFLAGS="$LDFLAGS -pthread";; +gnu*|k*bsd*-gnu|linux*) + optimize_def="-O2" + CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_REENTRANT";; +hpux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT";; +irix*) optimize_def="-O2" + CPPFLAGS="$CPPFLAGS -D_SGI_MP_SOURCE";; +mpeix*) CPPFLAGS="$CPPFLAGS -D_POSIX_SOURCE -D_SOCKET_SOURCE" + LIBS="$LIBS -lsocket -lsvipc";; +osf*) CPPFLAGS="$CPPFLAGS -pthread";; +*qnx*) AC_DEFINE(HAVE_QNX) + AH_TEMPLATE(HAVE_QNX, [Define to 1 if building on QNX.]);; +solaris*) + CPPFLAGS="$CPPFLAGS -D_REENTRANT";; +esac + +# Set CFLAGS/CXXFLAGS. We MUST set the flags before we call autoconf +# compiler configuration macros, because if we don't, they set CFLAGS +# to no optimization and -g, which isn't what we want. +if test "$db_cv_debug" = "no"; then + CFLAGS=${CFLAGS-$optimize_def} +fi +CXXFLAGS=${CXXFLAGS-"$CFLAGS"} + +# If the user wants a TCL library interface setup for testing, add +# -DCONFIG_TEST to the CFLAGS value. +if test "$db_cv_test" = "yes"; then + AC_DEFINE(CONFIG_TEST) + AH_TEMPLATE(CONFIG_TEST, + [Define to 1 if you want a TCL API with test support.]) + + CFLAGS="$CFLAGS -DCONFIG_TEST" + CXXFLAGS="$CXXFLAGS -DCONFIG_TEST" + db_cv_build_tcl_test_objs=TCL_TEST_OBJS +else + db_cv_build_tcl_test_objs= +fi +AC_SUBST(db_cv_build_tcl_test_objs) + + +# If the user wants a debugging environment, add -g to the CFLAGS value. +# +# XXX +# Some compilers can't mix optimizing and debug flags. The only way to +# handle this is to specify CFLAGS in the environment before configuring. +if test "$db_cv_debug" = "yes"; then + AC_DEFINE(DEBUG) + AH_TEMPLATE(DEBUG, [Define to 1 if you want a debugging version.]) + + CFLAGS="$CFLAGS -g" + CXXFLAGS="$CXXFLAGS -g" + db_cv_build_type=debug +else + db_cv_build_type=release +fi +AC_SUBST(db_cv_build_type) + +# The default compiler is cc (NOT gcc), the default CFLAGS is as specified +# above, NOT what is set by AC_PROG_CC, as it won't set optimization flags +# for any compiler other than gcc. +AC_PROG_CC(cc gcc) + +# Checks for compiler characteristics. +AC_SUBST(DB_PROTO1) +AC_SUBST(DB_PROTO2) + +DB_PROTO1="#undef __P" + +# AC_PROG_CC_STDC only sets ac_cv_prog_cc_stdc if the test fails, so +# check for "no", not "yes". +if test "$ac_cv_prog_cc_stdc" = "no"; then + DB_PROTO2="#define __P(protos) ()" +else + DB_PROTO2="#define __P(protos) protos" +fi + +AC_C_CONST +AC_SUBST(DB_CONST) +if test "$ac_cv_c_const" != "yes"; then + DB_CONST="#define const" +fi + +# Because of shared library building, the ${CC} used for config tests +# may be different than the ${CC} we want to put in the Makefile. +# The latter is known as ${MAKEFILE_CC} in this script. +MAKEFILE_CC="${CC}" +MAKEFILE_CCLINK="${CC}" +MAKEFILE_CXX="nocxx" +MAKEFILE_CXXLINK="nocxx" + +# See if we need the C++ compiler at all. If so, we'd like to find one that +# interoperates with the C compiler we chose. Since we prefered cc over gcc, +# we'll also prefer the vendor's compiler over g++/gcc. If we're wrong, the +# user can set CC and CXX in their environment before running configure. +# +# AC_PROG_CXX sets CXX, but it uses $CXX and $CCC (in that order) as its +# first choices. +if test "$db_cv_cxx" = "yes"; then + if test "$GCC" != "yes"; then + case "$host_os" in + aix*) AC_CHECK_TOOL(CCC, xlC_r) + LIBXSO_LIBS="-lC_r $LIBXSO_LIBS" + LIBS="-lC_r $LIBS";; + hpux*) AC_CHECK_TOOL(CCC, aCC);; + irix*) AC_CHECK_TOOL(CCC, CC);; + osf*) AC_CHECK_TOOL(CCC, cxx);; + solaris*) AC_CHECK_TOOL(CCC, CC);; + esac + fi + AC_PROG_CXX + ###### WORKAROUND: SEE SR #7938 + AC_PROG_CXXCPP + ############################### + AC_CXX_HAVE_STDHEADERS + MAKEFILE_CXX="${CXX}" + MAKEFILE_CXXLINK="${CXX}" +fi + +# Do some gcc specific configuration. +AC_GCC_CONFIG1 +AC_GCC_CONFIG2 + +# We need the -Kthread/-pthread flag when compiling on SCO/Caldera's UnixWare +# and OpenUNIX releases. We can't make the test until we know which compiler +# we're using. +case "$host_os" in +sysv5UnixWare*|sysv5OpenUNIX8*) + if test "$GCC" == "yes"; then + CPPFLAGS="$CPPFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread" + else + CPPFLAGS="$CPPFLAGS -Kthread" + LDFLAGS="$LDFLAGS -Kthread" + fi;; +esac + +# Export our compiler preferences for the libtool configuration. +export CC CCC +CCC=CXX + +# Libtool configuration. +AC_PROG_LIBTOOL + +SOFLAGS="-rpath \$(libdir)" +LIBTOOL_PROG="${SHELL} ./libtool" + +# Set SOSUFFIX and friends +SOSUFFIX_CONFIG +MODSUFFIX_CONFIG + +INSTALLER="\$(LIBTOOL) --mode=install cp -p" + +MAKEFILE_CC="\$(LIBTOOL) --mode=compile ${MAKEFILE_CC}" +MAKEFILE_SOLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CCLINK} -avoid-version" +MAKEFILE_CCLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CCLINK}" +MAKEFILE_CXX="\$(LIBTOOL) --mode=compile ${MAKEFILE_CXX}" +MAKEFILE_XSOLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CXXLINK} -avoid-version" +MAKEFILE_CXXLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CXXLINK}" + +LIBTOOL="\$(SHELL) ./libtool" + +case "$host_os" in +cygwin*) + MAKEFILE_SOLINK="$MAKEFILE_SOLINK -no-undefined" + MAKEFILE_XSOLINK="$MAKEFILE_XSOLINK -no-undefined";; +esac + +# Configure for shared libraries, static libraries, or both. If both are +# configured, build the utilities and example programs with shared versions. +# +# $o is set to ".o" or ".lo", and is the file suffix used in the Makefile +# instead of .o +if test `$LIBTOOL_PROG --config | + grep build_libtool_libs | grep no` 2>/dev/null; then + enable_shared="no" +else + enable_shared="yes" +fi +if test `$LIBTOOL_PROG --config | + grep build_old_libs | grep no` 2>/dev/null; then + enable_static="no" +else + enable_static="yes" +fi + +# C API. +if test "$enable_shared" = "no"; then + DEFAULT_LIB="\$(libdb_version)" + POSTLINK=": " + o=".o" +else + DEFAULT_LIB="\$(libso_target)" + POSTLINK="\$(LIBTOOL) --mode=execute true" + o=".lo" +fi +INSTALL_LIBS="$DEFAULT_LIB" +if test "$enable_static" = "yes"; then + INSTALL_LIBS="$INSTALL_LIBS \$(libdb)" +fi + +# Optional C++ API. +if test "$db_cv_cxx" = "yes"; then + if test "$enable_shared" = "no"; then + DEFAULT_LIB_CXX="\$(libcxx_version)" + fi + if test "$enable_shared" = "yes"; then + DEFAULT_LIB_CXX="\$(libxso_target)" + fi + INSTALL_LIBS="$INSTALL_LIBS $DEFAULT_LIB_CXX" + if test "$enable_static" = "yes"; then + INSTALL_LIBS="$INSTALL_LIBS \$(libcxx)" + fi +fi + +dnl # Optional Java API. TODO + +# MinGW support. +if test "$db_cv_mingw" = "yes"; then + OSDIR=os_win32 + PATH_SEPARATOR="\\\\/:" + + AC_DEFINE(DBSQL_WIN32) + AC_DEFINE(STDC_HEADERS) +else + OSDIR=os + PATH_SEPARATOR="/" +fi + +# Apple's Mac OS/X had to rename shared libraries, so much for standards. +case "$host_os" in + darwin*) + LIBTSO_MODULE="" + LIBTSO_MODSUFFIX=".dylib" + ;; + *) + LIBTSO_MODULE="-module" + LIBTSO_MODSUFFIX=@MODSUFFIX@ + ;; +esac + +AM_TCL_LOAD + +# You can disable pieces of functionality to save space. + +# The stat code. +if test "$db_cv_build_statistics" = "yes"; then + AC_DEFINE(HAVE_STATISTICS) + AH_TEMPLATE(HAVE_STATISTICS, + [Define to 1 if building statistics support.]) +fi + +# Checks for include files, structures, C types. +AC_HEADER_STAT +AC_HEADER_TIME +AC_HEADER_DIRENT +AC_CHECK_HEADERS(sys/select.h sys/time.h sys/fcntl.h) +AC_CHECK_MEMBERS([struct stat.st_blksize]) +AM_TYPES + +AC_CACHE_CHECK([for ANSI C exit success/failure values], db_cv_exit_defines, [ +AC_TRY_COMPILE([#include ], return (EXIT_SUCCESS);, + [db_cv_exit_defines=yes], [db_cv_exit_defines=no])]) +if test "$db_cv_exit_defines" = "yes"; then + AC_DEFINE(HAVE_EXIT_SUCCESS) + AH_TEMPLATE(HAVE_EXIT_SUCCESS, + [Define to 1 if you have EXIT_SUCCESS/EXIT_FAILURE #defines.]) +fi + +# Test for various functions/libraries that the test and example programs use: +# sched_yield function +# pthreads, socket and math libraries +AC_CHECK_FUNC(sched_yield,, + AC_SEARCH_LIBS(sched_yield, rt, LOAD_LIBS="$LOAD_LIBS -lrt")) + +# XXX +# We can't check for pthreads in the same way we did the test for sched_yield +# because the Solaris C library includes pthread interfaces which are not +# thread-safe. For that reason we always add -lpthread if we find a pthread +# library. Also we can't depend on any specific call existing (pthread_create, +# for example), as it may be #defined in an include file -- OSF/1 (Tru64) has +# this problem. +AC_HAVE_LIBRARY(pthread, LOAD_LIBS="$LOAD_LIBS -lpthread") + +# We use sqrt() so we need the math library -lm +AC_HAVE_LIBRARY(m, LIBS="$LIBS -lm") + +# Checks for system functions for which we have replacements. +AC_REPLACE_FUNCS(getopt memcmp memcpy memmove strdup strndup strerror) +AC_REPLACE_FUNCS(snprintf localtime_r strcasecmp strncasecmp) +AC_REPLACE_FUNCS(srand48_r lrand48_r) + +# Check for system functions we use. +AC_CHECK_FUNCS(usleep) + +# A/UX has a broken getopt(3). +case "$host_os" in +aux*) AC_LIBOBJ([getopt]);; +esac + +# Apple's Mac OS/X complains about long doubles, make it stop. +case "$host_os" in + darwin*) + CFLAGS="$CFLAGS -Wno-long-double -no-cpp-precomp" + ;; +esac + +# We need to add the additional object files into the Makefile with the correct +# suffix. We can't use $LTLIBOBJS itself, because that variable has $U encoded +# in it for automake, and that's not what we want. See SR #7227 for additional +# information. +# +# XXX: I'm not sure this is correct. +REPLACEMENT_OBJS=`echo "$LIB@&t@OBJS" | + sed "s,\.[[^.]]* ,$o ,g;s,\.[[^.]]*$,$o,"` + +# This is necessary so that .o files in LIBOBJS are also built via +# the ANSI2KNR-filtering rules. +LIB@&t@OBJS=`echo "$LIB@&t@OBJS" | + sed 's,\.[[^.]]* ,$U&,g;s,\.[[^.]]*$,$U&,'` +LTLIBOBJS=`echo "$LIB@&t@OBJS" | + sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'` +AC_SUBST(LTLIBOBJS) + +# Initial output file list. +CREATE_LIST="Makefile + dbsql_int.h:$srcdir/../src/inc/dbsql_int.in + $srcdir/../src/py/setup.py:$srcdir/../src/py/setup.py.in + $srcdir/../test/scr050/Makefile:$srcdir/../test/scr050/Makefile.in" + +# MinGW needs win_db.h. +if test "$db_cv_mingw" = "yes"; then +CREATE_LIST="$CREATE_LIST + win_db.h:$srcdir/win_dbsql.in" +fi + +# Create the dbsql.h file from a source file and a list of global function +# prototypes. +CREATE_LIST="$CREATE_LIST +dbsql.h:$srcdir/../src/dbsql.in" + +if test "$db_cv_rpm" = "yes"; then + CREATE_LIST="$CREATE_LIST db.spec:../dist/dbsql.spec.in" +fi + +AC_CONFIG_FILES($CREATE_LIST) +AC_OUTPUT diff --git a/dist/dbsql.pc.in b/dist/dbsql.pc.in new file mode 100644 index 0000000..fde00eb --- /dev/null +++ b/dist/dbsql.pc.in @@ -0,0 +1,33 @@ +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# + +# Package Information for pkg-config + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: dbsql +Description: A SQL database engine. +Version: @VERSION@ +Libs: -L${libdir} -ldbsql -ldb +Cflags: -I${includedir} diff --git a/dist/dbsql.spec.in b/dist/dbsql.spec.in new file mode 100644 index 0000000..69c6478 --- /dev/null +++ b/dist/dbsql.spec.in @@ -0,0 +1,55 @@ +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# DBSQL @DBSQL_VERSION_MAJOR@.@DBSQL_VERSION_MINOR@.@DBSQL_VERSION_PATCH@ + +Summary: DBSQL - A SQL database library. +Name: dbsql +Version: @DBSQL_VERSION_MAJOR@.@DBSQL_VERSION_MINOR@.@DBSQL_VERSION_PATCH@ +Release: 1 +Copyright: GPL - Freely redistributable, see LICENSE for details. +Source: http://www.dbsql.org/update/@DBSQL_VERSION_MAJOR@.@DBSQL_VERSION_MINOR@.@DBSQL_VERSION_PATCH@/dbsql-@DBSQL_VERSION_MAJOR@.@DBSQL_VERSION_MINOR@.@DBSQL_VERSION_PATCH@.tar.gz +URL: http://www.dbsql.org +Group: System Environment/Libraries +BuildRoot: @CONFIGURATION_PATH@/RPM_INSTALL + +%define _unpackaged_files_terminate_build 0 + +%description +DBSQL is a programmatic toolkit that provides fast, scalable and +reliable SQL implementation. + +%prep +%setup + +%build +cd build_unix +CFLAGS="$RPM_OPT_FLAGS" ../dist/configure @CONFIGURATION_ARGS@ +make library_build + +%install +cd build_unix +make prefix=@CONFIGURATION_PATH@/RPM_INSTALL install + +@RPM_POST_INSTALL@ + +@RPM_POST_UNINSTALL@ + +%changelog diff --git a/dist/dot-gdbinit b/dist/dot-gdbinit new file mode 100644 index 0000000..c835a39 --- /dev/null +++ b/dist/dot-gdbinit @@ -0,0 +1,39 @@ +break __db_loadme +break __db_err +define dd +print __db_dump(dbp, "a", "/tmp/o") +end +define dc +print __db_dump(dbc->dbp, "a", "/tmp/o") +end +break __sm_create +break __sm_create_table +break __sm_create_index +break __sm_close_db +break __sm_checkpoint +break __sm_get_database_name +break __sm_begin_txn +break __sm_commit_txn +break __sm_abort_txn +break __sm_cursor +break __sm_close_cursor +break __sm_moveto +break __sm_next +break __sm_prev +break __sm_key_size +break __sm_data_size +break __sm_key_compare +break __sm_key +break __sm_data +break __sm_first +break __sm_last +break __sm_insert +break __sm_delete +break __sm_drop_table +break __sm_clear_table +break __sm_set_format_version +break __sm_get_format_version +break __sm_set_schema_sig +break __sm_get_schema_sig +break process_input +break __process_sql diff --git a/dist/gen_inc.awk b/dist/gen_inc.awk new file mode 100644 index 0000000..b563f54 --- /dev/null +++ b/dist/gen_inc.awk @@ -0,0 +1,67 @@ +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ + +# This awk script parses C input files looking for lines marked "PUBLIC:" +# and "EXTERN:". (PUBLIC lines are DB internal function prototypes and +# #defines, EXTERN are DB external function prototypes and #defines.) +# +# PUBLIC lines are put into two versions of per-directory include files: +# one file that contains the prototypes, and one file that contains a +# #define for the name to be processed during configuration when creating +# unique names for every global symbol in the DB library. +# +# The EXTERN lines are put into two files: one of which contains prototypes +# which are always appended to the db.h file, and one of which contains a +# #define list for use when creating unique symbol names. +# +# Four arguments: +# e_dfile list of EXTERN #defines +# e_pfile include file that contains EXTERN prototypes +# i_dfile list of internal (PUBLIC) #defines +# i_pfile include file that contains internal (PUBLIC) prototypes +/PUBLIC:/ { + sub("^.*PUBLIC:[ ][ ]*", "") + if ($0 ~ "^#if|^#ifdef|^#ifndef|^#else|^#endif") { + print $0 >> i_pfile + print $0 >> i_dfile + next + } + pline = sprintf("%s %s", pline, $0) + if (pline ~ "\\)\\);") { + sub("^[ ]*", "", pline) + print pline >> i_pfile + pline = "" + } +} + +/EXTERN:/ { + sub("^.*EXTERN:[ ][ ]*", "") + if ($0 ~ "^#if|^#ifdef|^#ifndef|^#else|^#endif") { + print $0 >> e_pfile + print $0 >> e_dfile + next + } + eline = sprintf("%s %s", eline, $0) + if (eline ~ "\\)\\);") { + sub("^[ ]*", "", eline) + print eline >> e_pfile + eline = "" + } +} diff --git a/dist/install-sh b/dist/install-sh new file mode 100644 index 0000000..b41a245 --- /dev/null +++ b/dist/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/dist/ltmain.sh b/dist/ltmain.sh new file mode 100644 index 0000000..3526e4b --- /dev/null +++ b/dist/ltmain.sh @@ -0,0 +1,6290 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +win32_libid () { + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` + if test "X$win32_nmres" = "Ximport" ; then + win32_libid_type="x86 archive import" + else + win32_libid_type="x86 archive static" + fi + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + +# End of Shell function definitions +##################################### + +# Parse our command line options once, thoroughly. +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + tag) + tagname="$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit 1 + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2003 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit 0 + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" + done + exit 0 + ;; + + --debug) + $echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + $echo "host: $host" + if test "$build_libtool_libs" = yes; then + $echo "enable shared libraries" + else + $echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $echo "enable static libraries" + else + $echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + ;; + + --tag) prevopt="--tag" prev=tag ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 + case $nonopt in + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_output= + arg_mode=normal + libobj= + + for arg + do + case "$arg_mode" in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + arg_mode=target + continue + ;; + + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit 1 + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + # Infer tagged configuration to use if any are available and + # if one wasn't chosen via the "--tag" command line option. + # Only attempt this if the compiler in the base compile + # command doesn't match the default compiler. + if test -n "$available_tags" && test -z "$tagname"; then + case $base_compile in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" + case "$base_compile " in + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit 1 +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi + + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + $echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + base_compile="$base_compile $arg" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit 1 + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit 1 + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit 1 + fi + arg=$save_arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # gcc -m* arguments should be passed to the linker via $compiler_flags + # in order to pass architecture information to the linker + # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo + # but this is not reliable with gcc because gcc may use -mfoo to + # select a different linker, different libraries, etc, while + # -Wl,-mfoo simply passes -mfoo to the linker. + -m*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + if test "$with_gcc" = "yes" ; then + compiler_flags="$compiler_flags $arg" + fi + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit 1 + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit 1 + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Infer tagged configuration to use if any are available and + # if one wasn't chosen via the "--tag" command line option. + # Only attempt this if the compiler in the base link + # command doesn't match the default compiler. + if test -n "$available_tags" && test -z "$tagname"; then + case $base_compile in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" + case $base_compile in + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) + # The compiler in $compile_command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit 1 +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test "$status" -ne 0 && test ! -d "$output_objdir"; then + exit $status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplcations in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit 1 + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + if test "$deplibs_check_method" != pass_all; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." + else + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit 1 + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5* ) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against it, someone + # is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="-L$inst_prefix_dir$libdir $add_dir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="-L$inst_prefix_dir$libdir $add_dir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="$absdir" + fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + newlib_search_path="$newlib_search_path $path" + path="" + fi + ;; + *) + path="-L$path" + ;; + esac + + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac + ;; + *) continue ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$deplibs $depdepl" ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext\" + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext\" + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit 1 + else + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $revision in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $age in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + major=`expr $current - $age + 1` + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$xdir"; then + exit $status + fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi + + libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval cmds=\"$module_expsym_cmds\" + else + eval cmds=\"$module_cmds\" + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + fi + + if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$save_output-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$save_output-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$save_output-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadale object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~$rm $delfiles\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit 0 + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$xdir"; then + exit $status + fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi + + reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + prog) + case $host in + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit 0 + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case $0 in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + cwrappersource=`$echo ${objdir}/lt-${output}.c` + cwrapper=`$echo ${output}.exe` + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +#define DIR_SEPARATOR '/' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +#define HAVE_DOS_BASED_FILE_SYSTEM +#ifndef DIR_SEPARATOR_2 +#define DIR_SEPARATOR_2 '\\' +#endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +char * basename (const char *name); +char * fnqualify(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup ((char *) basename (argv[0])); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = fnqualify(argv[0]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +char * +basename (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha (name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return (char *) base; +} + +char * +fnqualify(const char *path) +{ + size_t size; + char *p; + char tmp[LT_PATHMAX + 1]; + + assert(path != NULL); + + /* Is it qualified already? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha (path[0]) && path[1] == ':') + return xstrdup (path); +#endif + if (IS_DIR_SEPARATOR (path[0])) + return xstrdup (path); + + /* prepend the current directory */ + /* doesn't handle '~' */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ + p = XMALLOC(char, size); + sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); + return p; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + $echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + $echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$xdir"; then + exit $status + fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit 1 + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit 1 + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac + # If there is no directory component, then add one. + case $file in + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac + # If there is no directory component, then add one. + case $file in + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $0 --finish$current_libdirs' + else + exit 0 + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit 0 + + $echo "----------------------------------------------------------------------" + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test "$mode" = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + fi + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE. + +Report bugs to ." + exit 0 + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +$echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/dist/s_all b/dist/s_all new file mode 100644 index 0000000..cc9f245 --- /dev/null +++ b/dist/s_all @@ -0,0 +1,33 @@ +#!/bin/sh - +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: s_all 7 2007-02-03 13:34:17Z gburd $ + +sh s_perm # permissions. +sh s_symlink # symbolic links. +sh s_readme # distribution README file. + +# +# The following order is important, s_include must run last. +# +sh s_config # autoconf. +sh s_include # standard include files. +sh s_tags # Tags files. diff --git a/dist/s_config b/dist/s_config new file mode 100644 index 0000000..7db3c2f --- /dev/null +++ b/dist/s_config @@ -0,0 +1,54 @@ +#!/bin/sh -x +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: s_config 7 2007-02-03 13:34:17Z gburd $ +# +# Build the autoconfiguration files. + +trap 'rm -f aclocal.m4 ; exit 0' 0 1 2 3 13 15 + +. ./RELEASE + +echo "autoconf: building aclocal.m4..." +cat aclocal/*.ac > aclocal.m4 + +echo "autoconf: running autoheader to build config.hin..." +rm -f config.hin +autoheader +chmod 444 config.hin + +echo "autoconf: running autoconf to build configure" +rm -f configure +autoconf + +# Edit version information we couldn't pre-compute. +(echo "1,\$s/__EDIT_DBSQL_VERSION_MAJOR__/$DBSQL_VERSION_MAJOR/g" && + echo "1,\$s/__EDIT_DBSQL_VERSION_MINOR__/$DBSQL_VERSION_MINOR/g" && + echo "1,\$s/__EDIT_DBSQL_VERSION_PATCH__/$DBSQL_VERSION_PATCH/g" && + echo "1,\$s/__EDIT_DBSQL_VERSION_STRING__/$DBSQL_VERSION_STRING/g" && + echo "1,\$s/__EDIT_DBSQL_VERSION__/$DBSQL_VERSION/g" && + echo "w" && + echo "q") | ed -s configure + +rm -rf autom4te.cache +chmod 555 configure + +chmod 555 config.guess config.sub install-sh diff --git a/dist/s_include b/dist/s_include new file mode 100644 index 0000000..253f4df --- /dev/null +++ b/dist/s_include @@ -0,0 +1,109 @@ +#!/bin/sh - +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: s_include 7 2007-02-03 13:34:17Z gburd $ +# +# Build the automatically generated function prototype files. + +msgc="/* DO NOT EDIT: automatically built by dist/s_include. */" + +head() +{ + defonly=0 + while : + do case "$1" in + space) + echo ""; shift;; + defonly) + defonly=1; shift;; + *) + name="$1"; break;; + esac + done + + echo "$msgc" + echo "#ifndef $name" + echo "#define $name" + echo "" + if [ $defonly -eq 0 ]; then + echo "#if defined(__cplusplus)" + echo "extern \"C\" {" + echo "#endif" + echo "" + fi +} + +tail() +{ + defonly=0 + while : + do case "$1" in + defonly) + defonly=1; shift;; + *) + name="$1"; break;; + esac + done + + echo "" + if [ $defonly -eq 0 ]; then + echo "#if defined(__cplusplus)" + echo "}" + echo "#endif" + fi + echo "#endif /* !$name */" +} + +# We are building several files: +# 1 external #define file +# 1 external prototype file +# 1 internal #define file +# N internal prototype files +e_dfile=/tmp/__db_c.$$ +e_pfile=/tmp/__db_a.$$ +i_dfile=/tmp/__db_d.$$ +i_pfile=/tmp/__db_b.$$ +trap 'rm -f $e_dfile $e_pfile $i_dfile $i_pfile; exit 0' 0 1 2 3 13 15 + +head defonly space _DBSQL_EXT_DEF_IN_ > $e_dfile +head space _DBSQL_EXT_PROT_IN_ > $e_pfile +head defonly _DBSQL_INT_DEF_IN_ > $i_dfile + +# Process the standard directories, creating per-directory prototype +# files and adding to the external prototype and #define files. +for i in dbsql os clib common ; do + head "_${i}_ext_h_" > $i_pfile + + f="../src/$i/*.c" + [ "$f" = "../src/dbsql/*.c" ] && f="../src/*.c" + awk -f gen_inc.awk \ + -v e_dfile=$e_dfile \ + -v e_pfile=$e_pfile \ + -v i_dfile=$i_dfile \ + -v i_pfile=$i_pfile $f + + tail "_${i}_ext_h_" >> $i_pfile + + f="../src/inc/${i}_ext.h" + cmp $i_pfile $f > /dev/null 2>&1 || + (echo "Building $f" && rm -f $f && cp $i_pfile $f && chmod 444 $f) +done + diff --git a/dist/s_perm b/dist/s_perm new file mode 100644 index 0000000..f91da6f --- /dev/null +++ b/dist/s_perm @@ -0,0 +1,49 @@ +#!/bin/sh - +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: s_perm 7 2007-02-03 13:34:17Z gburd $ + +d=.. +echo 'Updating DBSQL source tree permissions...' + +run() +{ + #echo " $1 ($2)" + if [ -f "$d/$1" ]; then + chmod "$2" "$d/$1" + else + echo "$d/$1: no such file or directory" + exit 1 + fi +} + +run dist/config.guess 555 +run dist/config.sub 555 +run dist/configure 555 +run dist/install-sh 555 +run dist/s_all 555 +run dist/s_config 555 +run dist/s_include 555 +run dist/s_perm 555 +run dist/s_readme 555 +run dist/s_symlink 555 +run dist/s_tags 555 +run dist/s_test 555 diff --git a/dist/s_readme b/dist/s_readme new file mode 100644 index 0000000..dce35ae --- /dev/null +++ b/dist/s_readme @@ -0,0 +1,86 @@ +#!/bin/sh - +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: s_readme 7 2007-02-03 13:34:17Z gburd $ +# +# Build the README. + +echo 'Updating DBSQL README file...' + +d=.. + +t=/tmp/__t +trap 'rm -f $t; exit 0' 0 1 2 3 13 15 + +. ./RELEASE + +cat << END_OF_README>$t +$DBSQL_VERSION_STRING + +This is version $DBSQL_VERSION_MAJOR.$DBSQL_VERSION_MINOR.$DBSQL_VERSION_PATCH of DBSQL. + +To view the release and installation documentation, load the distribution +file docs/index.html into your web browser. + +This work started from the SQLite project (found on the web at +http://www.sqlite.org/). SQLite and all contributions to the SQLite +project have been placed in the public domain by its author, Dr. Richard Hipp. +There was no assertion of copyright at all on the code I used as a starting +point for my work. In fact there are statements that explicitly disclaim +copyright. I am asserting copyright on this work, DBSQL. I believe +that if you examine the extent to which I've changed, updated, and +modified the SQLite code you'll respect my copyright assertion. This +is a new product, heavily inspired by another. + +The goal for DBSQL is to provide a small SQL92 relational database layer +on top of the Berkeley DB database. Berkeley DB is copyright Oracle +Corporation (formerly Sleepycat Software, acquired in Feb 2006) and +licensed under the Sleepycat Public License. That license is compatible +with the GPL for open source use. Recognize that you, as someone using +DBSQL, will need to review the Sleepycat License and the GPL before you +use and redistribute your incorporating work. It is your responsibility +to comply with those licenses as I am in my work on DBSQL itself. My +motivation on a personal level is quite simple, I am in product management +these days and not in the code itself. I believe that product managers +should be engineers at heart with an ability to understand business, +politics, and software sales and support. This is my playground to keep +my engineering skills sharp enough to speak fluent geek. As a former +engineer at Sleepycat I understand and value the Berkeley DB programming +infrasture, design, and methodologies and I have liberally copied and +reused them in this project to improve SQLite in ways that I hope will +be of value to open source users out there. I did this because I see the +value of SQLite to its userbase, it is a perfect example of the 80/20 +rule and the KISS method and I admire those qualities in software. My +hope is that the Berkeley DB database engine will provide some significant +features that SQLite cannot such as replication for high availability +while remaining small enough to live comfortably inside applications, +services, and devices. + +Information and resources pertaining to DBSQL can be found at dbsql.org. + +Commercial licenses without the restrictions found in the GPL can be +purchased for this product. See http://dbsql.org/wiki/CommercialUse + +END_OF_README + +f=../README +cmp $t $f > /dev/null 2>&1 || + (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) diff --git a/dist/s_symlink b/dist/s_symlink new file mode 100644 index 0000000..c0bc00e --- /dev/null +++ b/dist/s_symlink @@ -0,0 +1,44 @@ +#!/bin/sh - +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: s_symlink 7 2007-02-03 13:34:17Z gburd $ + +echo 'Creating DBSQL source tree symbolic links...' + +build() +{ + #echo " $1 -> $2" + (cd ../`dirname $1` && rm -f `basename $1` && ln -s $2 `basename $1`) +} + +build src/tags ../dist/tags +build src/os/tags ../../dist/tags +build src/clib/tags ../../dist/tags +build src/py/tags ../../dist/tags +build test/scr050/tags ../../dist/tags +build build_unix/tags ../dist/tags + +build src/TAGS ../dist/TAGS +build src/os/TAGS ../../dist/TAGS +build src/clib/TAGS ../../dist/TAGS +build src/py/TAGS ../../dist/TAGS +build test/scr050/TAGS ../../dist/tags +build build_unix/TAGS ../dist/TAGS diff --git a/dist/s_tags b/dist/s_tags new file mode 100644 index 0000000..9edaf5b --- /dev/null +++ b/dist/s_tags @@ -0,0 +1,52 @@ +#!/bin/sh - +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: s_tags 7 2007-02-03 13:34:17Z gburd $ +# +# Build tags files. + +files=`echo ../src/*.[ch] \ + ../src/inc/*.h \ + ../src/os/*.[ch] \ + ../src/py/*.[ch] \ + ../test/scr050/*.[ch]` + +f=tags +echo "Building $f" +rm -f $f + +# Figure out what flags this ctags accepts. +flags="" +if ctags -d ../src/api.c 2>/dev/null; then + flags="-d $flags" +fi +if ctags -t ../src/api.c 2>/dev/null; then + flags="-t $flags" +fi +if ctags -w ../src/api.c 2>/dev/null; then + flags="-w $flags" +fi + +ctags $flags $files 2>/dev/null +chmod 444 $f + +etags $files -o TAGS 2>/dev/null +chmod 444 $f diff --git a/dist/s_test b/dist/s_test new file mode 100644 index 0000000..8db3983 --- /dev/null +++ b/dist/s_test @@ -0,0 +1,104 @@ +#!/bin/sh - +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: s_test 7 2007-02-03 13:34:17Z gburd $ +# +# Build the Tcl test files. + +msg1="# Automatically built by dist/s_test; may require local editing." +msg2="# Automatically built by dist/s_test; may require local editing." + +t=/tmp/__t +trap 'rm -f $t; exit 0' 0 1 2 3 13 15 + +. RELEASE + +(echo "$msg1" && \ + echo "" && \ + echo "set tclsh_path @TCL_TCLSH@" && \ + echo "set tcllib .libs/libdbsql_tcl-@DBSQL_VERSION_MAJOR@.@DBSQL_VERSION_MINOR@@LIBTSO_MODSUFFIX@" && \ + echo "" && \ + echo "set src_root @srcdir@/.." && \ + echo "set test_path @srcdir@/../test" && \ + echo "" && \ + echo "global testdir" && \ + echo "set testdir ./TESTDIR" && \ + echo "" && \ + echo "global dict" && \ + echo "global util_path" && \ + echo "" && \ + echo "global is_hp_test" && \ + echo "global is_qnx_test" && \ + echo "global is_windows_test" && \ + echo "" && \ + echo "set KILL \"@db_cv_path_kill@\"") > $t + +f=../test/include.tcl +cmp $t $f > /dev/null 2>&1 || + (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) + +(echo "$msg1" && \ + echo "" && \ + echo "set tclsh_path SET_YOUR_TCLSH_PATH" && \ + echo "set tcllib ./Debug/libdbsql_tcl${DBSQL_VERSION_MAJOR}${DBSQL_VERSION_MINOR}d.dll" && \ + echo "" && \ + echo "set src_root .." && \ + echo "set test_path ../test" && \ + echo "" && \ + echo "global testdir" && \ + echo "set testdir ./TESTDIR" && \ + echo "" && \ + echo "global dict" && \ + echo "global util_path" && \ + echo "" && \ + echo "global is_hp_test" && \ + echo "global is_qnx_test" && \ + echo "global is_windows_test" && \ + echo "" && \ + echo "set KILL ./dbkill.exe") > $t + +f=../build_win32/include.tcl +cmp $t $f > /dev/null 2>&1 || + (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) + +# Build the test directory TESTS file. +(echo $msg2; +cat `egrep -l '^#[ ][ ]*TEST' ../test/*.tcl` | +sed -e '/^#[ ][ ]*TEST/!{' \ + -e 's/.*//' \ + -e '}' | +cat -s | +sed -e '/TEST/{' \ + -e 's/^#[ ][ ]*TEST[ ]*//' \ + -e 's/^ //' \ + -e 'H' \ + -e 'd' \ + -e '}' \ + -e 's/.*//' \ + -e x \ + -e 's/\n/__LINEBREAK__/g' | +sort | +sed -e 's/__LINEBREAK__/\ +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\ +/' \ + -e 's/__LINEBREAK__/\ + /g' | +sed -e 's/^[ ][ ]*$//') > $t + +f=../test/TESTS +cmp $t $f > /dev/null 2>&1 || + (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) diff --git a/dist/splint.rc b/dist/splint.rc new file mode 100644 index 0000000..19a149b --- /dev/null +++ b/dist/splint.rc @@ -0,0 +1,5 @@ +-namechecks ++posixstrictlib ++showallconjs ++showscan ++stats \ No newline at end of file diff --git a/dist/sqlconf b/dist/sqlconf new file mode 100644 index 0000000..cef27b1 --- /dev/null +++ b/dist/sqlconf @@ -0,0 +1,61 @@ +#!/bin/sh - +# +# This is how I normally configure DBSQL when I'm doing daily work. +# +# Note that I'm usually using the latest copy of Mac OS/X for +# devlelopment work, so some of this may be specific to that. +# + +[ -d build_unix ] && { + echo 'You cannot build in the top-level directory.' + exit 1 +} +[ -d aclocal ] && { + echo 'You cannot build in the dist directory.' + exit 1 +} +args="" +#args="--disable-shared $args" +#args="--disable-static $args" +args="--enable-vacuum $args" +args="--enable-datetime $args" +args="--enable-authentication $args" +args="--enable-incore-databases $args" +args="--enable-incore-temp-databases $args" +args="--enable-debug $args" +args="--enable-diagnostic $args" +args="--enable-test $args" +args="--enable-tcl $args" +#args="--enable-sqlite-compat $args" +args="--enable-soundex-sqlfn $args" +args="--enable-posix-mutexes $args" +args="--with-tcl=/usr/lib/tcl8.4 $args" +args="--with-berkeleydb=/usr/local/db $args" +#args="--with-db-uniquename=FOO $args" +#args="LD_TWOLEVEL_NAMESPACE=1 LIBTSO_LIBS=-ltcl8.4 $args" # Mac OS/X + +echo "env $cppflags $ldflags $libs ../dist/configure $args" +env $cppflags $ldflags $libs sh ../dist/configure -C $args + +# (echo "break __db_loadme" && +# echo "break __db_err" && +# echo "define dd" && +# echo 'print __db_dump(dbp, "a", "/tmp/o")' && +# echo "end" && +# echo "define dc" && +# echo 'print __db_dump(dbc->dbp, "a", "/tmp/o")' && +# echo "end") > .gdbinit + +(echo "set environment LD_LIBRARY_PATH=.:.libs" && + echo "dir ../src" && + echo "dir ../src/dbsql" && + echo "dir /usr/local/db/src" && + echo "path /usr/local/db/lib" && + echo "path .") > .gdbinit + +rm -f tags +ln -s ../dist/tags tags +mkdir .libs && /bin/true +ln -s .gdbinit .libs/.gdbinit +ln -s ./.libs/dbsql dbsql-bin && /bin/true + diff --git a/dist/srcfiles.in b/dist/srcfiles.in new file mode 100644 index 0000000..5781dad --- /dev/null +++ b/dist/srcfiles.in @@ -0,0 +1,86 @@ +# DBSQL - A SQL database engine. +# +# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# There are special exceptions to the terms and conditions of the GPL as it +# is applied to this software. View the full text of the exception in file +# LICENSE_EXCEPTIONS in the directory of this software distribution. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# http://creativecommons.org/licenses/GPL/2.0/ +# +# $Id: srcfiles.in 7 2007-02-03 13:34:17Z gburd $ + + +# This is an input file for the s_win32_dsp. It lists the source files in +# the DBSQL tree and notes which are used to build the Win/32 library. +# +# Please keep this list sorted alphabetically! +# +# Each non-blank, non-comment line is of the form +# filename module [ module ...] +# +# The possible modules, including the name of the project (.dsp) file: +# +# app=NAME Linked into application NAME.exe (db_NAME.dsp) +# dynamic File is in the Windows DLL (db_dll.dsp) +# static File is in the Windows static library (db_static.dsp) +# java File is in the Windows Java DLL (db_java.dsp) +# tcl File is in the Windows tcl DLL (db_tcl.dsp) +# testutil File is used for Windows testing (db_test.dsp) + +build_unix/lempar.c dynamic static +build_unix/opcodes.c dynamic static +build_unix/sql_parser.c dynamic static +build_win32/dbkill.cpp testutil +dist/splint.rc +examples/binary_codec.c +src/api.c dynamic static +src/api_table.c dynamic static +src/cg_attach.c dynamic static +src/cg_auth.c dynamic static +src/cg_build.c dynamic static +src/cg_copy.c dynamic static +src/cg_date.c dynamic static +src/cg_delete.c dynamic static +src/cg_expr.c dynamic static +src/cg_insert.c dynamic static +src/cg_pragma.c dynamic static +src/cg_select.c dynamic static +src/cg_trigger.c dynamic static +src/cg_update.c dynamic static +src/cg_vacuum.c dynamic static +src/cg_where.c dynamic static +src/clib/getopt.c app=dbsql +src/clib/memcmp.c dynamic static +src/clib/random.c dynamic static +src/clib/snprintf.c dynamic static +src/clib/strcasecmp.c dynamic static +src/clib/strdup.c dynamic static +src/clib/xvprintf.c dynamic static +src/common/dbsql_alloc.c dynamic static +src/common/dbsql_atof.c dynamic static +src/common/dbsql_atoi.c dynamic static +src/common/dbsql_err.c dynamic static +src/common/hash.c dynamic static +src/common/str.c dynamic static +src/dbsql/dbsql.c app=dbsql +src/dbsql_tclsh.c app=dbsql_tclsh +src/lemon/lemon.c app=lemon +src/lemon/lempar.c app=lemon +src/os/os_jtime.c dynamic static +src/safety.c dynamic static +src/sm.c dynamic static +src/sql_fns.c dynamic static +src/sql_tokenize.c dynamic static +src/vdbe.c dynamic static +src/vdbe_method.c dynamic static diff --git a/dist/win_config.in b/dist/win_config.in new file mode 100644 index 0000000..76812c1 --- /dev/null +++ b/dist/win_config.in @@ -0,0 +1,418 @@ +/* Define to 1 if you want to build a version for running the test suite. */ +/* #undef CONFIG_TEST */ + +/* We use DBSQL_WIN32 much as one would use _WIN32 -- to specify that we're using + an operating system environment that supports Win32 calls and semantics. We + don't use _WIN32 because Cygwin/GCC also defines _WIN32, even though + Cygwin/GCC closely emulates the Unix environment. */ +#define DBSQL_WIN32 1 + +/* Define to 1 if you want a debugging version. */ +/* #undef DEBUG */ +#if defined(_DEBUG) +#if !defined(DEBUG) +#define DEBUG 1 +#endif +#endif + +/* Define to 1 if you want a version that logs read operations. */ +/* #undef DEBUG_ROP */ + +/* Define to 1 if you want a version that logs write operations. */ +/* #undef DEBUG_WOP */ + +/* Define to 1 if you want a version with run-time diagnostic checking. */ +/* #undef DIAGNOSTIC */ + +/* Define to 1 if you have the `clock_gettime' function. */ +/* #undef HAVE_CLOCK_GETTIME */ + +/* Define to 1 if Berkeley DB release includes strong cryptography. */ +#ifndef HAVE_SMALLBUILD +#define HAVE_CRYPTO 1 +#endif + +/* Define to 1 if you have the `directio' function. */ +/* #undef HAVE_DIRECTIO */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_DIRENT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define to 1 if you have EXIT_SUCCESS/EXIT_FAILURE #defines. */ +#define HAVE_EXIT_SUCCESS 1 + +/* Define to 1 if fcntl/F_SETFD denies child access to file descriptors. */ +/* #undef HAVE_FCNTL_F_SETFD */ + +/* Define to 1 if allocated filesystem blocks are not zeroed. */ +#define HAVE_FILESYSTEM_NOTZERO 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `getopt' function. */ +/* #undef HAVE_GETOPT */ + +/* Define to 1 if you have the `getrusage' function. */ +/* #undef HAVE_GETRUSAGE */ + +/* Define to 1 if you have the `gettimeofday' function. */ +/* #undef HAVE_GETTIMEOFDAY */ + +/* Define to 1 if you have the `getuid' function. */ +/* #undef HAVE_GETUID */ + +/* Define to 1 if building Hash access method. */ +#ifndef HAVE_SMALLBUILD +#define HAVE_HASH 1 +#endif + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_INTTYPES_H */ + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +/* #undef HAVE_LIBNSL */ + +/* Define to 1 if you have the `memcmp' function. */ +#define HAVE_MEMCMP 1 + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mlock' function. */ +/* #undef HAVE_MLOCK */ + +/* Define to 1 if you have the `mmap' function. */ +/* #undef HAVE_MMAP */ + +/* Define to 1 if you have the `munlock' function. */ +/* #undef HAVE_MUNLOCK */ + +/* Define to 1 if you have the `munmap' function. */ +/* #undef HAVE_MUNMAP */ + +/* Define to 1 to use the GCC compiler and 68K assembly language mutexes. */ +/* #undef HAVE_MUTEX_68K_GCC_ASSEMBLY */ + +/* Define to 1 to use the AIX _check_lock mutexes. */ +/* #undef HAVE_MUTEX_AIX_CHECK_LOCK */ + +/* Define to 1 to use the GCC compiler and Alpha assembly language mutexes. */ +/* #undef HAVE_MUTEX_ALPHA_GCC_ASSEMBLY */ + +/* Define to 1 to use the GCC compiler and ARM assembly language mutexes. */ +/* #undef HAVE_MUTEX_ARM_GCC_ASSEMBLY */ + +/* Define to 1 to use the Apple/Darwin _spin_lock_try mutexes. */ +/* #undef HAVE_MUTEX_DARWIN_SPIN_LOCK_TRY */ + +/* Define to 1 to use the UNIX fcntl system call mutexes. */ +/* #undef HAVE_MUTEX_FCNTL */ + +/* Define to 1 to use the GCC compiler and PaRisc assembly language mutexes. + */ +/* #undef HAVE_MUTEX_HPPA_GCC_ASSEMBLY */ + +/* Define to 1 to use the msem_XXX mutexes on HP-UX. */ +/* #undef HAVE_MUTEX_HPPA_MSEM_INIT */ + +/* Define to 1 to use the GCC compiler and IA64 assembly language mutexes. */ +/* #undef HAVE_MUTEX_IA64_GCC_ASSEMBLY */ + +/* Define to 1 to use the msem_XXX mutexes on systems other than HP-UX. */ +/* #undef HAVE_MUTEX_MSEM_INIT */ + +/* Define to 1 to use the GCC compiler and PowerPC assembly language mutexes. + */ +/* #undef HAVE_MUTEX_PPC_GCC_ASSEMBLY */ + +/* Define to 1 to use POSIX 1003.1 pthread_XXX mutexes. */ +/* #undef HAVE_MUTEX_PTHREADS */ + +/* Define to 1 to use Reliant UNIX initspin mutexes. */ +/* #undef HAVE_MUTEX_RELIANTUNIX_INITSPIN */ + +/* Define to 1 to use the IBM C compiler and S/390 assembly language mutexes. + */ +/* #undef HAVE_MUTEX_S390_CC_ASSEMBLY */ + +/* Define to 1 to use the GCC compiler and S/390 assembly language mutexes. */ +/* #undef HAVE_MUTEX_S390_GCC_ASSEMBLY */ + +/* Define to 1 to use the SCO compiler and x86 assembly language mutexes. */ +/* #undef HAVE_MUTEX_SCO_X86_CC_ASSEMBLY */ + +/* Define to 1 to use the obsolete POSIX 1003.1 sema_XXX mutexes. */ +/* #undef HAVE_MUTEX_SEMA_INIT */ + +/* Define to 1 to use the SGI XXX_lock mutexes. */ +/* #undef HAVE_MUTEX_SGI_INIT_LOCK */ + +/* Define to 1 to use the Solaris _lock_XXX mutexes. */ +/* #undef HAVE_MUTEX_SOLARIS_LOCK_TRY */ + +/* Define to 1 to use the Solaris lwp threads mutexes. */ +/* #undef HAVE_MUTEX_SOLARIS_LWP */ + +/* Define to 1 to use the GCC compiler and Sparc assembly language mutexes. */ +/* #undef HAVE_MUTEX_SPARC_GCC_ASSEMBLY */ + +/* Define to 1 if mutexes hold system resources. */ +/* #undef HAVE_MUTEX_SYSTEM_RESOURCES */ + +/* Define to 1 if fast mutexes are available. */ +#define HAVE_MUTEX_THREADS 1 + +/* Define to 1 to configure mutexes intra-process only. */ +/* #undef HAVE_MUTEX_THREAD_ONLY */ + +/* Define to 1 to use the CC compiler and Tru64 assembly language mutexes. */ +/* #undef HAVE_MUTEX_TRU64_CC_ASSEMBLY */ + +/* Define to 1 to use the UNIX International mutexes. */ +/* #undef HAVE_MUTEX_UI_THREADS */ + +/* Define to 1 to use the UTS compiler and assembly language mutexes. */ +/* #undef HAVE_MUTEX_UTS_CC_ASSEMBLY */ + +/* Define to 1 to use VMS mutexes. */ +/* #undef HAVE_MUTEX_VMS */ + +/* Define to 1 to use VxWorks mutexes. */ +/* #undef HAVE_MUTEX_VXWORKS */ + +/* Define to 1 to use the MSVC compiler and Windows mutexes. */ +#define HAVE_MUTEX_WIN32 1 + +/* Define to 1 to use the GCC compiler and Windows mutexes. */ +/* #undef HAVE_MUTEX_WIN32_GCC */ + +/* Define to 1 to use the GCC compiler and x86 assembly language mutexes. */ +/* #undef HAVE_MUTEX_X86_GCC_ASSEMBLY */ + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the O_DIRECT flag. */ +/* #undef HAVE_O_DIRECT */ + +/* Define to 1 if you have the `pread' function. */ +/* #undef HAVE_PREAD */ + +/* Define to 1 if you have the `pstat_getdynamic' function. */ +/* #undef HAVE_PSTAT_GETDYNAMIC */ + +/* Define to 1 if you have the `pwrite' function. */ +/* #undef HAVE_PWRITE */ + +/* Define to 1 if building on QNX. */ +/* #undef HAVE_QNX */ + +/* Define to 1 if building Queue access method. */ +#ifndef HAVE_SMALLBUILD +#define HAVE_QUEUE 1 +#endif + +/* Define to 1 if you have the `raise' function. */ +#define HAVE_RAISE 1 + +/* Define to 1 if building replication support. */ +#ifndef HAVE_SMALLBUILD +#define HAVE_REPLICATION 1 +#endif + +/* Define to 1 if building RPC client/server. */ +/* #undef HAVE_RPC */ + +/* Define to 1 if you have the `sched_yield' function. */ +/* #undef HAVE_SCHED_YIELD */ + +/* Define to 1 if you have the `select' function. */ +/* #undef HAVE_SELECT */ + +/* Define to 1 if you have the `shmget' function. */ +/* #undef HAVE_SHMGET */ + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if building statistics support. */ +#define HAVE_STATISTICS 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDINT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +/* #undef HAVE_STRCASECMP */ + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if `st_blksize' is member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BLKSIZE */ + +/* Define to 1 if you have the `sysconf' function. */ +/* #undef HAVE_SYSCONF */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FCNTL_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TIME_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define to 1 if unlink of file with open file descriptors will fail. */ +/* #undef HAVE_UNLINK_WITH_OPEN_FAILURE */ + +/* Define to 1 if building access method verification support. */ +#ifndef HAVE_SMALLBUILD +#define HAVE_VERIFY 1 +#endif + +/* Define to 1 if you have the `vsnprintf' function. */ +#define HAVE_VSNPRINTF 1 + +/* Define to 1 if building VxWorks. */ +/* #undef HAVE_VXWORKS */ + +/* Define to 1 if you have the `yield' function. */ +/* #undef HAVE_YIELD */ + +/* Define to 1 if you have the `_fstati64' function. */ +#define HAVE__FSTATI64 1 + +/* Define to a value if using non-standard mutex alignment. */ +/* #undef MUTEX_ALIGN */ + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "support@dbsql.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "DBSQL" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "DBSQL __EDIT_DBSQL_VERSION__" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "db-__EDIT_DBSQL_VERSION__" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "__EDIT_DBSQL_VERSION__" + +/* Define to 1 if the `S_IS*' macros in do not work properly. */ +/* #undef STAT_MACROS_BROKEN */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +/* #undef TIME_WITH_SYS_TIME */ + +/* Define to 1 to mask harmless unitialized memory read/writes. */ +/* #undef UMRW */ + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* + * Exit success/failure macros. + */ +#ifndef HAVE_EXIT_SUCCESS +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#endif + +/* + * Don't step on the namespace. Other libraries may have their own + * implementations of these functions, we don't want to use their + * implementations or force them to use ours based on the load order. + */ +#ifndef HAVE_GETCWD +#define getcwd __db_Cgetcwd +#endif +#ifndef HAVE_MEMCMP +#define memcmp __db_Cmemcmp +#endif +#ifndef HAVE_MEMCPY +#define memcpy __db_Cmemcpy +#endif +#ifndef HAVE_MEMMOVE +#define memmove __db_Cmemmove +#endif +#ifndef HAVE_RAISE +#define raise __db_Craise +#endif +#ifndef HAVE_SNPRINTF +#define snprintf __db_Csnprintf +#endif +#ifndef HAVE_STRCASECMP +#define strcasecmp __db_Cstrcasecmp +#define strncasecmp __db_Cstrncasecmp +#endif +#ifndef HAVE_STRERROR +#define strerror __db_Cstrerror +#endif +#ifndef HAVE_VSNPRINTF +#define vsnprintf __db_Cvsnprintf +#endif + +#include "win_db.h" + +/* + * Microsoft's compiler _doesn't_ define __STDC__ unless you invoke it with + * arguments turning OFF all vendor extensions. Even more unfortunately, if + * we do that, it fails to parse windows.h!!!!! So, we define __STDC__ here, + * after windows.h comes in. Note: the compiler knows we've defined it, and + * starts enforcing strict ANSI compilance from this point on. + */ +#define __STDC__ 1 diff --git a/dist/win_dbsql.in b/dist/win_dbsql.in new file mode 100644 index 0000000..63d56ae --- /dev/null +++ b/dist/win_dbsql.in @@ -0,0 +1,60 @@ +/*- + * $Id: win_dbsql.in 7 2007-02-03 13:34:17Z gburd $ + * + * The following provides the information necessary to build Berkeley + * DB on native Windows, and other Windows environments such as MinGW. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * To build Tcl interface libraries, the include path must be configured to + * use the directory containing , usually the include directory in + * the Tcl distribution. + */ +#ifdef DB_TCL_SUPPORT +#include +#endif + +#define WIN32_LEAN_AND_MEAN +#include + +/* + * All of the necessary includes have been included, ignore the #includes + * in the Berkeley DB source files. + */ +#define NO_SYSTEM_INCLUDES + +/* + * Win32 has getcwd, snprintf and vsnprintf, but under different names. + */ +#define getcwd(buf, size) _getcwd(buf, size) +#define snprintf _snprintf +#define vsnprintf _vsnprintf + +/* + * Win32 does not define getopt and friends in any header file, so we must. + */ +#if defined(__cplusplus) +extern "C" { +#endif +extern int optind; +extern char *optarg; +extern int getopt(int, char * const *, const char *); +#if defined(__cplusplus) +} +#endif diff --git a/dist/win_exports.in b/dist/win_exports.in new file mode 100644 index 0000000..74ae9cd --- /dev/null +++ b/dist/win_exports.in @@ -0,0 +1,136 @@ +# $Id: win_exports.in 7 2007-02-03 13:34:17Z gburd $ + +# Standard interfaces. + db_create + db_env_create + db_strerror + db_version + db_xa_switch + log_compare + +# Library configuration interfaces. + db_env_set_func_close + db_env_set_func_dirfree + db_env_set_func_dirlist + db_env_set_func_exists + db_env_set_func_free + db_env_set_func_fsync + db_env_set_func_ioinfo + db_env_set_func_malloc + db_env_set_func_map + db_env_set_func_open + db_env_set_func_pread + db_env_set_func_pwrite + db_env_set_func_read + db_env_set_func_realloc + db_env_set_func_rename + db_env_set_func_seek + db_env_set_func_sleep + db_env_set_func_unlink + db_env_set_func_unmap + db_env_set_func_write + db_env_set_func_yield + +# Needed for application-specific logging and recovery routines. + __db_add_recovery + +# These are needed to link the tcl library. + __db_dbm_close + __db_dbm_delete + __db_dbm_fetch + __db_dbm_firstkey + __db_dbm_init + __db_dbm_nextkey + __db_dbm_store + __db_hcreate + __db_hdestroy + __db_hsearch + __db_loadme + __db_ndbm_clearerr + __db_ndbm_close + __db_ndbm_delete + __db_ndbm_dirfno + __db_ndbm_error + __db_ndbm_fetch + __db_ndbm_firstkey + __db_ndbm_nextkey + __db_ndbm_open + __db_ndbm_pagfno + __db_ndbm_rdonly + __db_ndbm_store + __db_panic + __db_r_attach + __db_r_detach + __db_win32_mutex_init + __db_win32_mutex_lock + __db_win32_mutex_unlock + __ham_func2 + __ham_func3 + __ham_func4 + __ham_func5 + __ham_test + __lock_id_set + __os_calloc + __os_closehandle + __os_free + __os_ioinfo + __os_malloc + __os_open + __os_openhandle + __os_read + __os_realloc + __os_strdup + __os_umalloc + __os_write + __txn_id_set + +#These are needed for linking tools or java. + __bam_init_print + __bam_pgin + __bam_pgout + __crdel_init_print + __db_dispatch + __db_dump + __db_err + __db_getlong + __db_getulong + __db_global_values + __db_init_print + __db_inmemdbflags + __db_isbigendian + __db_omode + __db_overwrite + __db_pgin + __db_pgout + __db_pr_callback + __db_prdbt + __db_prfooter + __db_prheader + __db_rpath + __db_stat_pp + __db_stat_print_pp + __db_util_cache + __db_util_interrupted + __db_util_logset + __db_util_siginit + __db_util_sigresend + __db_verify_internal + __dbreg_init_print + __fop_init_print + __ham_get_meta + __ham_init_print + __ham_pgin + __ham_pgout + __ham_release_meta + __log_stat_pp + __os_clock + __os_get_errno + __os_id + __os_set_errno + __os_sleep + __os_ufree + __os_yield + __qam_init_print + __qam_pgin_out + __rep_stat_print + __txn_init_print diff --git a/docs_src/dbsql.1 b/docs_src/dbsql.1 new file mode 100644 index 0000000..d0e5f5c --- /dev/null +++ b/docs_src/dbsql.1 @@ -0,0 +1,203 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH DBSQL 1 "Mon Apr 15 23:49:17 2002" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +dbsql \- A command line interface for DBSQL +.SH SYNOPSIS +.B dbsql +.RI [ options ] " filename " [ SQL ] +.SS SUMMARY +.PP +dbsql is a terminal-based front-end to the DBSQL library. It enables +you to type in queries interactively, issue them to DBSQL and see the +results. Alternatively, you can specify SQL code on the command-line. In +addition it provides a number of meta-commands. + +.SH DESCRIPTION +This manual page documents briefly the +.B dbsql +command. +This manual page was written for the Debian GNU/Linux distribution +because the original program does not have a manual page. +.SS GETTING STARTED +.PP +To start the dbsql program, just type "dbsql" followed by the name +the file that holds the DBSQL database. If the file does not exist, a +new one is created automatically. The dbsql program will then prompt +you to enter SQL. Type in SQL statements (terminated by a semicolon), +press "Enter" and the SQL will be executed. + +For example, to create a new DBSQL database named "ex1" with a single +table named "tbl1", you might do this: +.sp +.nf +$ dbsql ex1 +DBSQL version 2.0.0 +Enter ".help" for instructions +dbsql> create table tbl1(one varchar(10), two smallint); +dbsql> insert into tbl1 values('hello!',10); +dbsql> insert into tbl1 values('goodbye', 20); +dbsql> select * from tbl1; +hello!|10 +goodbye|20 +dbsql> +.sp +.fi + +.SS DBSQL META-COMMANDS +.PP +Most of the time, dbsql just reads lines of input and passes them on +to the DBSQL library for execution. But if an input line begins with +a dot ("."), then that line is intercepted and interpreted by the +dbsql program itself. These "dot commands" are typically used to +change the output format of queries, or to execute certain prepackaged +query statements. + +For a listing of the available dot commands, you can enter ".help" at +any time. For example: +.sp +.nf +.cc | +dbsql> .help +.dump ?TABLE? ... Dump the database in an text format +.echo ON|OFF Turn command echo on or off +.exit Exit this program +.explain ON|OFF Turn output mode suitable for EXPLAIN on or off. + "off" will revert to the output mode that was + previously in effect +.header(s) ON|OFF Turn display of headers on or off +.help Show this message +.indices TABLE Show names of all indices on TABLE +.mode MODE Set mode to one of "line(s)", "column(s)", + "insert", "list", or "html" +.mode insert TABLE Generate SQL insert statements for TABLE +.nullvalue STRING Print STRING instead of nothing for NULL data +.output FILENAME Send output to FILENAME +.output stdout Send output to the screen +.prompt MAIN CONTINUE Replace the standard prompts + "dbsql > " and " ...> " + with the strings MAIN and CONTINUE + CONTINUE is optional. +.quit Exit this program +.read FILENAME Execute SQL in FILENAME +.reindex ?TABLE? Rebuild indices +.schema ?TABLE? Show the CREATE statements +.separator STRING Change separator string for "list" mode +.show Show the current values for the following: + .echo + .explain + .mode + .nullvalue + .output + .separator + .width +.tables ?PATTERN? List names of tables matching a pattern +.timeout MS Try opening locked tables for MS milliseconds +.width NUM NUM ... Set column widths for "column" mode +dbsql> +|cc . +.sp +.fi + +.SH OPTIONS +The program has the following options: +.TP +.BI \-init\ file +Read in and process 'file', which contains "dot commands". +You can use this file to initialize display settings. +.TP +.B \-html +Set output mode to HTML. +.TP +.B \-list +Set output mode to 'list'. +.TP +.B \-line +Set output mode to 'line'. +.TP +.B \-column +Set output mode to 'column'. +.TP +.BI \-separator\ separator +Specify which output field separator for 'list' mode to use. +Default is '|'. +.TP +.BI \-nullvalue\ string +When a null is encountered, print 'string'. Default is no string. +.TP +.B \-[no]header +Turn headers on or off. Default is off. +.TP +.B \-echo +Print commands before execution. + + +.SH OUTPUT MODE +The DBSQL program has different output modes, which define the way +the output (from queries) is formatted. + +In 'list' mode, which is the default, one record per line is output, +each field separated by the separator specified with the +\fB-separator\fP option or \fB.separator\fP command. + +In 'line' mode, each column is output on its own line, records are +separated by blank lines. + +In HTML mode, an XHTML table is generated. + +In 'column' mode, one record per line is output, aligned neatly in colums. + +.SH INIT FILE +dbsql can be initialized using resource files. These can be combined with +command line arguments to set up dbsql exactly the way you want it. +Initialization proceeds as follows: + +o The defaults of + +.sp +.nf +.cc | +mode = LIST +separator = "|" +main prompt = "dbsql> " +continue prompt = " ...> " +|cc . +.sp +.fi + +are established. + +o If a file .dbsqlrc can be found in the user's home directory, it is +read and processed. It should only contain "dot commands". If the +file is not found or cannot be read, processing continues without +notification. + +o If a file is specified on the command line with the -init option, it +is processed in the same manner as .dbsqlrc + +o All other command line options are processed + +o The database is opened and you are now ready to begin. + +.SH SEE ALSO +http://dbsql.org/ +.br +The dbsql-doc package +.SH AUTHOR +This manual page was originally written by Andreas Rottmann +, for the Debian GNU/Linux system (but may be used +by others). diff --git a/docs_src/lemon.html b/docs_src/lemon.html new file mode 100644 index 0000000..6a4d6db --- /dev/null +++ b/docs_src/lemon.html @@ -0,0 +1,892 @@ + + +The Lemon Parser Generator + + +

The Lemon Parser Generator

+ +

Lemon is an LALR(1) parser generator for C or C++. +It does the same job as ``bison'' and ``yacc''. +But lemon is not another bison or yacc clone. It +uses a different grammar syntax which is designed to +reduce the number of coding errors. Lemon also uses a more +sophisticated parsing engine that is faster than yacc and +bison and which is both reentrant and thread-safe. +Furthermore, Lemon implements features that can be used +to eliminate resource leaks, making is suitable for use +in long-running programs such as graphical user interfaces +or embedded controllers.

+ +

This document is an introduction to the Lemon +parser generator.

+ +

Theory of Operation

+ +

The main goal of Lemon is to translate a context free grammar (CFG) +for a particular language into C code that implements a parser for +that language. +The program has two inputs: +

    +
  • The grammar specification. +
  • A parser template file. +
+Typically, only the grammar specification is supplied by the programmer. +Lemon comes with a default parser template which works fine for most +applications. But the user is free to substitute a different parser +template if desired.

+ +

Depending on command-line options, Lemon will generate between +one and three files of outputs. +

    +
  • C code to implement the parser. +
  • A header file defining an integer ID for each terminal symbol. +
  • An information file that describes the states of the generated parser + automaton. +
+By default, all three of these output files are generated. +The header file is suppressed if the ``-m'' command-line option is +used and the report file is omitted when ``-q'' is selected.

+ +

The grammar specification file uses a ``.y'' suffix, by convention. +In the examples used in this document, we'll assume the name of the +grammar file is ``gram.y''. A typical use of Lemon would be the +following command: +

+   lemon gram.y
+
+This command will generate three output files named ``gram.c'', +``gram.h'' and ``gram.out''. +The first is C code to implement the parser. The second +is the header file that defines numerical values for all +terminal symbols, and the last is the report that explains +the states used by the parser automaton.

+ +

Command Line Options

+ +

The behavior of Lemon can be modified using command-line options. +You can obtain a list of the available command-line options together +with a brief explanation of what each does by typing +

+   lemon -?
+
+As of this writing, the following command-line options are supported: +
    +
  • -b +
  • -c +
  • -g +
  • -m +
  • -q +
  • -s +
  • -x +
+The ``-b'' option reduces the amount of text in the report file by +printing only the basis of each parser state, rather than the full +configuration. +The ``-c'' option suppresses action table compression. Using -c +will make the parser a little larger and slower but it will detect +syntax errors sooner. +The ``-g'' option causes no output files to be generated at all. +Instead, the input grammar file is printed on standard output but +with all comments, actions and other extraneous text deleted. This +is a useful way to get a quick summary of a grammar. +The ``-m'' option causes the output C source file to be compatible +with the ``makeheaders'' program. +Makeheaders is a program that automatically generates header files +from C source code. When the ``-m'' option is used, the header +file is not output since the makeheaders program will take care +of generated all header files automatically. +The ``-q'' option suppresses the report file. +Using ``-s'' causes a brief summary of parser statistics to be +printed. Like this: +
+   Parser statistics: 74 terminals, 70 nonterminals, 179 rules
+                      340 states, 2026 parser table entries, 0 conflicts
+
+Finally, the ``-x'' option causes Lemon to print its version number +and then stops without attempting to read the grammar or generate a parser.

+ +

The Parser Interface

+ +

Lemon doesn't generate a complete, working program. It only generates +a few subroutines that implement a parser. This section describes +the interface to those subroutines. It is up to the programmer to +call these subroutines in an appropriate way in order to produce a +complete system.

+ +

Before a program begins using a Lemon-generated parser, the program +must first create the parser. +A new parser is created as follows: +

+   void *pParser = ParseAlloc( malloc );
+
+The ParseAlloc() routine allocates and initializes a new parser and +returns a pointer to it. +The actual data structure used to represent a parser is opaque -- +its internal structure is not visible or usable by the calling routine. +For this reason, the ParseAlloc() routine returns a pointer to void +rather than a pointer to some particular structure. +The sole argument to the ParseAlloc() routine is a pointer to the +subroutine used to allocate memory. Typically this means ``malloc()''.

+ +

After a program is finished using a parser, it can reclaim all +memory allocated by that parser by calling +

+   ParseFree(pParser, free);
+
+The first argument is the same pointer returned by ParseAlloc(). The +second argument is a pointer to the function used to release bulk +memory back to the system.

+ +

After a parser has been allocated using ParseAlloc(), the programmer +must supply the parser with a sequence of tokens (terminal symbols) to +be parsed. This is accomplished by calling the following function +once for each token: +

+   Parse(pParser, hTokenID, sTokenData, pArg);
+
+The first argument to the Parse() routine is the pointer returned by +ParseAlloc(). +The second argument is a small positive integer that tells the parse the +type of the next token in the data stream. +There is one token type for each terminal symbol in the grammar. +The gram.h file generated by Lemon contains #define statements that +map symbolic terminal symbol names into appropriate integer values. +(A value of 0 for the second argument is a special flag to the +parser to indicate that the end of input has been reached.) +The third argument is the value of the given token. By default, +the type of the third argument is integer, but the grammar will +usually redefine this type to be some kind of structure. +Typically the second argument will be a broad category of tokens +such as ``identifier'' or ``number'' and the third argument will +be the name of the identifier or the value of the number.

+ +

The Parse() function may have either three or four arguments, +depending on the grammar. If the grammar specification file request +it, the Parse() function will have a fourth parameter that can be +of any type chosen by the programmer. The parser doesn't do anything +with this argument except to pass it through to action routines. +This is a convenient mechanism for passing state information down +to the action routines without having to use global variables.

+ +

A typical use of a Lemon parser might look something like the +following: +

+   01 ParseTree *ParseFile(const char *zFilename){
+   02    Tokenizer *pTokenizer;
+   03    void *pParser;
+   04    Token sToken;
+   05    int hTokenId;
+   06    ParserState sState;
+   07
+   08    pTokenizer = TokenizerCreate(zFilename);
+   09    pParser = ParseAlloc( malloc );
+   10    InitParserState(&sState);
+   11    while( GetNextToken(pTokenizer, &hTokenId, &sToken) ){
+   12       Parse(pParser, hTokenId, sToken, &sState);
+   13    }
+   14    Parse(pParser, 0, sToken, &sState);
+   15    ParseFree(pParser, free );
+   16    TokenizerFree(pTokenizer);
+   17    return sState.treeRoot;
+   18 }
+
+This example shows a user-written routine that parses a file of +text and returns a pointer to the parse tree. +(We've omitted all error-handling from this example to keep it +simple.) +We assume the existence of some kind of tokenizer which is created +using TokenizerCreate() on line 8 and deleted by TokenizerFree() +on line 16. The GetNextToken() function on line 11 retrieves the +next token from the input file and puts its type in the +integer variable hTokenId. The sToken variable is assumed to be +some kind of structure that contains details about each token, +such as its complete text, what line it occurs on, etc.

+ +

This example also assumes the existence of structure of type +ParserState that holds state information about a particular parse. +An instance of such a structure is created on line 6 and initialized +on line 10. A pointer to this structure is passed into the Parse() +routine as the optional 4th argument. +The action routine specified by the grammar for the parser can use +the ParserState structure to hold whatever information is useful and +appropriate. In the example, we note that the treeRoot field of +the ParserState structure is left pointing to the root of the parse +tree.

+ +

The core of this example as it relates to Lemon is as follows: +

+   ParseFile(){
+      pParser = ParseAlloc( malloc );
+      while( GetNextToken(pTokenizer,&hTokenId, &sToken) ){
+         Parse(pParser, hTokenId, sToken);
+      }
+      Parse(pParser, 0, sToken);
+      ParseFree(pParser, free );
+   }
+
+Basically, what a program has to do to use a Lemon-generated parser +is first create the parser, then send it lots of tokens obtained by +tokenizing an input source. When the end of input is reached, the +Parse() routine should be called one last time with a token type +of 0. This step is necessary to inform the parser that the end of +input has been reached. Finally, we reclaim memory used by the +parser by calling ParseFree().

+ +

There is one other interface routine that should be mentioned +before we move on. +The ParseTrace() function can be used to generate debugging output +from the parser. A prototype for this routine is as follows: +

+   ParseTrace(FILE *stream, char *zPrefix);
+
+After this routine is called, a short (one-line) message is written +to the designated output stream every time the parser changes states +or calls an action routine. Each such message is prefaced using +the text given by zPrefix. This debugging output can be turned off +by calling ParseTrace() again with a first argument of NULL (0).

+ +

Differences With YACC and BISON

+ +

Programmers who have previously used the yacc or bison parser +generator will notice several important differences between yacc and/or +bison and Lemon. +

    +
  • In yacc and bison, the parser calls the tokenizer. In Lemon, + the tokenizer calls the parser. +
  • Lemon uses no global variables. Yacc and bison use global variables + to pass information between the tokenizer and parser. +
  • Lemon allows multiple parsers to be running simultaneously. Yacc + and bison do not. +
+These differences may cause some initial confusion for programmers +with prior yacc and bison experience. +But after years of experience using Lemon, I firmly +believe that the Lemon way of doing things is better.

+ +

Input File Syntax

+ +

The main purpose of the grammar specification file for Lemon is +to define the grammar for the parser. But the input file also +specifies additional information Lemon requires to do its job. +Most of the work in using Lemon is in writing an appropriate +grammar file.

+ +

The grammar file for lemon is, for the most part, free format. +It does not have sections or divisions like yacc or bison. Any +declaration can occur at any point in the file. +Lemon ignores whitespace (except where it is needed to separate +tokens) and it honors the same commenting conventions as C and C++.

+ +

Terminals and Nonterminals

+ +

A terminal symbol (token) is any string of alphanumeric +and underscore characters +that begins with an upper case letter. +A terminal can contain lower class letters after the first character, +but the usual convention is to make terminals all upper case. +A nonterminal, on the other hand, is any string of alphanumeric +and underscore characters than begins with a lower case letter. +Again, the usual convention is to make nonterminals use all lower +case letters.

+ +

In Lemon, terminal and nonterminal symbols do not need to +be declared or identified in a separate section of the grammar file. +Lemon is able to generate a list of all terminals and nonterminals +by examining the grammar rules, and it can always distinguish a +terminal from a nonterminal by checking the case of the first +character of the name.

+ +

Yacc and bison allow terminal symbols to have either alphanumeric +names or to be individual characters included in single quotes, like +this: ')' or '$'. Lemon does not allow this alternative form for +terminal symbols. With Lemon, all symbols, terminals and nonterminals, +must have alphanumeric names.

+ +

Grammar Rules

+ +

The main component of a Lemon grammar file is a sequence of grammar +rules. +Each grammar rule consists of a nonterminal symbol followed by +the special symbol ``::='' and then a list of terminals and/or nonterminals. +The rule is terminated by a period. +The list of terminals and nonterminals on the right-hand side of the +rule can be empty. +Rules can occur in any order, except that the left-hand side of the +first rule is assumed to be the start symbol for the grammar (unless +specified otherwise using the %start directive described below.) +A typical sequence of grammar rules might look something like this: +

+  expr ::= expr PLUS expr.
+  expr ::= expr TIMES expr.
+  expr ::= LPAREN expr RPAREN.
+  expr ::= VALUE.
+
+

+ +

There is one non-terminal in this example, ``expr'', and five +terminal symbols or tokens: ``PLUS'', ``TIMES'', ``LPAREN'', +``RPAREN'' and ``VALUE''.

+ +

Like yacc and bison, Lemon allows the grammar to specify a block +of C code that will be executed whenever a grammar rule is reduced +by the parser. +In Lemon, this action is specified by putting the C code (contained +within curly braces {...}) immediately after the +period that closes the rule. +For example: +

+  expr ::= expr PLUS expr.   { printf("Doing an addition...\n"); }
+
+

+ +

In order to be useful, grammar actions must normally be linked to +their associated grammar rules. +In yacc and bison, this is accomplished by embedding a ``$$'' in the +action to stand for the value of the left-hand side of the rule and +symbols ``$1'', ``$2'', and so forth to stand for the value of +the terminal or nonterminal at position 1, 2 and so forth on the +right-hand side of the rule. +This idea is very powerful, but it is also very error-prone. The +single most common source of errors in a yacc or bison grammar is +to miscount the number of symbols on the right-hand side of a grammar +rule and say ``$7'' when you really mean ``$8''.

+ +

Lemon avoids the need to count grammar symbols by assigning symbolic +names to each symbol in a grammar rule and then using those symbolic +names in the action. +In yacc or bison, one would write this: +

+  expr -> expr PLUS expr  { $$ = $1 + $3; };
+
+But in Lemon, the same rule becomes the following: +
+  expr(A) ::= expr(B) PLUS expr(C).  { A = B+C; }
+
+In the Lemon rule, any symbol in parentheses after a grammar rule +symbol becomes a place holder for that symbol in the grammar rule. +This place holder can then be used in the associated C action to +stand for the value of that symbol.

+ +

The Lemon notation for linking a grammar rule with its reduce +action is superior to yacc/bison on several counts. +First, as mentioned above, the Lemon method avoids the need to +count grammar symbols. +Secondly, if a terminal or nonterminal in a Lemon grammar rule +includes a linking symbol in parentheses but that linking symbol +is not actually used in the reduce action, then an error message +is generated. +For example, the rule +

+  expr(A) ::= expr(B) PLUS expr(C).  { A = B; }
+
+will generate an error because the linking symbol ``C'' is used +in the grammar rule but not in the reduce action.

+ +

The Lemon notation for linking grammar rules to reduce actions +also facilitates the use of destructors for reclaiming memory +allocated by the values of terminals and nonterminals on the +right-hand side of a rule.

+ +

Precedence Rules

+ +

Lemon resolves parsing ambiguities in exactly the same way as +yacc and bison. A shift-reduce conflict is resolved in favor +of the shift, and a reduce-reduce conflict is resolved by reducing +whichever rule comes first in the grammar file.

+ +

Just like in +yacc and bison, Lemon allows a measure of control +over the resolution of paring conflicts using precedence rules. +A precedence value can be assigned to any terminal symbol +using the %left, %right or %nonassoc directives. Terminal symbols +mentioned in earlier directives have a lower precedence that +terminal symbols mentioned in later directives. For example:

+ +

+   %left AND.
+   %left OR.
+   %nonassoc EQ NE GT GE LT LE.
+   %left PLUS MINUS.
+   %left TIMES DIVIDE MOD.
+   %right EXP NOT.
+

+ +

In the preceding sequence of directives, the AND operator is +defined to have the lowest precedence. The OR operator is one +precedence level higher. And so forth. Hence, the grammar would +attempt to group the ambiguous expression +

+     a AND b OR c
+
+like this +
+     a AND (b OR c).
+
+The associativity (left, right or nonassoc) is used to determine +the grouping when the precedence is the same. AND is left-associative +in our example, so +
+     a AND b AND c
+
+is parsed like this +
+     (a AND b) AND c.
+
+The EXP operator is right-associative, though, so +
+     a EXP b EXP c
+
+is parsed like this +
+     a EXP (b EXP c).
+
+The nonassoc precedence is used for non-associative operators. +So +
+     a EQ b EQ c
+
+is an error.

+ +

The precedence of non-terminals is transferred to rules as follows: +The precedence of a grammar rule is equal to the precedence of the +left-most terminal symbol in the rule for which a precedence is +defined. This is normally what you want, but in those cases where +you want to precedence of a grammar rule to be something different, +you can specify an alternative precedence symbol by putting the +symbol in square braces after the period at the end of the rule and +before any C-code. For example:

+ +

+   expr = MINUS expr.  [NOT]
+

+ +

This rule has a precedence equal to that of the NOT symbol, not the +MINUS symbol as would have been the case by default.

+ +

With the knowledge of how precedence is assigned to terminal +symbols and individual +grammar rules, we can now explain precisely how parsing conflicts +are resolved in Lemon. Shift-reduce conflicts are resolved +as follows: +

    +
  • If either the token to be shifted or the rule to be reduced + lacks precedence information, then resolve in favor of the + shift, but report a parsing conflict. +
  • If the precedence of the token to be shifted is greater than + the precedence of the rule to reduce, then resolve in favor + of the shift. No parsing conflict is reported. +
  • If the precedence of the token it be shifted is less than the + precedence of the rule to reduce, then resolve in favor of the + reduce action. No parsing conflict is reported. +
  • If the precedences are the same and the shift token is + right-associative, then resolve in favor of the shift. + No parsing conflict is reported. +
  • If the precedences are the same the the shift token is + left-associative, then resolve in favor of the reduce. + No parsing conflict is reported. +
  • Otherwise, resolve the conflict by doing the shift and + report the parsing conflict. +
+Reduce-reduce conflicts are resolved this way: +
    +
  • If either reduce rule + lacks precedence information, then resolve in favor of the + rule that appears first in the grammar and report a parsing + conflict. +
  • If both rules have precedence and the precedence is different + then resolve the dispute in favor of the rule with the highest + precedence and do not report a conflict. +
  • Otherwise, resolve the conflict by reducing by the rule that + appears first in the grammar and report a parsing conflict. +
+ +

Special Directives

+ +

The input grammar to Lemon consists of grammar rules and special +directives. We've described all the grammar rules, so now we'll +talk about the special directives.

+ +

Directives in lemon can occur in any order. You can put them before +the grammar rules, or after the grammar rules, or in the mist of the +grammar rules. It doesn't matter. The relative order of +directives used to assign precedence to terminals is important, but +other than that, the order of directives in Lemon is arbitrary.

+ +

Lemon supports the following special directives: +

    +
  • %code +
  • %default_destructor +
  • %default_type +
  • %destructor +
  • %extra_argument +
  • %include +
  • %left +
  • %name +
  • %nonassoc +
  • %parse_accept +
  • %parse_failure +
  • %right +
  • %stack_overflow +
  • %stack_size +
  • %start_symbol +
  • %syntax_error +
  • %token_destructor +
  • %token_prefix +
  • %token_type +
  • %type +
+Each of these directives will be described separately in the +following sections:

+ +

The %code directive

+ +

The %code directive is used to specify addition C/C++ code that +is added to the end of the main output file. This is similar to +the %include directive except that %include is inserted at the +beginning of the main output file.

+ +

%code is typically used to include some action routines or perhaps +a tokenizer as part of the output file.

+ +

The %default_destructor directive

+ +

The %default_destructor directive specifies a destructor to +use for non-terminals that do not have their own destructor +specified by a separate %destructor directive. See the documentation +on the %destructor directive below for additional information.

+ +

In some grammers, many different non-terminal symbols have the +same datatype and hence the same destructor. This directive is +a convenience way to specify the same destructor for all those +non-terminals using a single statement.

+ +

The %default_type directive

+ +

The %default_type directive specifies the datatype of non-terminal +symbols that do no have their own datatype defined using a separate +%type directive. See the documentation on %type below for addition +information.

+ +

The %destructor directive

+ +

The %destructor directive is used to specify a destructor for +a non-terminal symbol. +(See also the %token_destructor directive which is used to +specify a destructor for terminal symbols.)

+ +

A non-terminal's destructor is called to dispose of the +non-terminal's value whenever the non-terminal is popped from +the stack. This includes all of the following circumstances: +

    +
  • When a rule reduces and the value of a non-terminal on + the right-hand side is not linked to C code. +
  • When the stack is popped during error processing. +
  • When the ParseFree() function runs. +
+The destructor can do whatever it wants with the value of +the non-terminal, but its design is to deallocate memory +or other resources held by that non-terminal.

+ +

Consider an example: +

+   %type nt {void*}
+   %destructor nt { free($$); }
+   nt(A) ::= ID NUM.   { A = malloc( 100 ); }
+
+This example is a bit contrived but it serves to illustrate how +destructors work. The example shows a non-terminal named +``nt'' that holds values of type ``void*''. When the rule for +an ``nt'' reduces, it sets the value of the non-terminal to +space obtained from malloc(). Later, when the nt non-terminal +is popped from the stack, the destructor will fire and call +free() on this malloced space, thus avoiding a memory leak. +(Note that the symbol ``$$'' in the destructor code is replaced +by the value of the non-terminal.)

+ +

It is important to note that the value of a non-terminal is passed +to the destructor whenever the non-terminal is removed from the +stack, unless the non-terminal is used in a C-code action. If +the non-terminal is used by C-code, then it is assumed that the +C-code will take care of destroying it if it should really +be destroyed. More commonly, the value is used to build some +larger structure and we don't want to destroy it, which is why +the destructor is not called in this circumstance.

+ +

By appropriate use of destructors, it is possible to +build a parser using Lemon that can be used within a long-running +program, such as a GUI, that will not leak memory or other resources. +To do the same using yacc or bison is much more difficult.

+ +

The %extra_argument directive

+ +The %extra_argument directive instructs Lemon to add a 4th parameter +to the parameter list of the Parse() function it generates. Lemon +doesn't do anything itself with this extra argument, but it does +make the argument available to C-code action routines, destructors, +and so forth. For example, if the grammar file contains:

+ +

+    %extra_argument { MyStruct *pAbc }
+

+ +

Then the Parse() function generated will have an 4th parameter +of type ``MyStruct*'' and all action routines will have access to +a variable named ``pAbc'' that is the value of the 4th parameter +in the most recent call to Parse().

+ +

The %include directive

+ +

The %include directive specifies C code that is included at the +top of the generated parser. You can include any text you want -- +the Lemon parser generator copies it blindly. If you have multiple +%include directives in your grammar file the value of the last +%include directive overwrites all the others.The %include directive is very handy for getting some extra #include +preprocessor statements at the beginning of the generated parser. +For example:

+ +

+   %include {#include <unistd.h>}
+

+ +

This might be needed, for example, if some of the C actions in the +grammar call functions that are prototyed in unistd.h.

+ +

The %left directive

+ +The %left directive is used (along with the %right and +%nonassoc directives) to declare precedences of terminal +symbols. Every terminal symbol whose name appears after +a %left directive but before the next period (``.'') is +given the same left-associative precedence value. Subsequent +%left directives have higher precedence. For example:

+ +

+   %left AND.
+   %left OR.
+   %nonassoc EQ NE GT GE LT LE.
+   %left PLUS MINUS.
+   %left TIMES DIVIDE MOD.
+   %right EXP NOT.
+

+ +

Note the period that terminates each %left, %right or %nonassoc +directive.

+ +

LALR(1) grammars can get into a situation where they require +a large amount of stack space if you make heavy use or right-associative +operators. For this reason, it is recommended that you use %left +rather than %right whenever possible.

+ +

The %name directive

+ +

By default, the functions generated by Lemon all begin with the +five-character string ``Parse''. You can change this string to something +different using the %name directive. For instance:

+ +

+   %name Abcde
+

+ +

Putting this directive in the grammar file will cause Lemon to generate +functions named +

    +
  • AbcdeAlloc(), +
  • AbcdeFree(), +
  • AbcdeTrace(), and +
  • Abcde(). +
+The %name directive allows you to generator two or more different +parsers and link them all into the same executable. +

+ +

The %nonassoc directive

+ +

This directive is used to assign non-associative precedence to +one or more terminal symbols. See the section on precedence rules +or on the %left directive for additional information.

+ +

The %parse_accept directive

+ +

The %parse_accept directive specifies a block of C code that is +executed whenever the parser accepts its input string. To ``accept'' +an input string means that the parser was able to process all tokens +without error.

+ +

For example:

+ +

+   %parse_accept {
+      printf("parsing complete!\n");
+   }
+

+ + +

The %parse_failure directive

+ +

The %parse_failure directive specifies a block of C code that +is executed whenever the parser fails complete. This code is not +executed until the parser has tried and failed to resolve an input +error using is usual error recovery strategy. The routine is +only invoked when parsing is unable to continue.

+ +

+   %parse_failure {
+     fprintf(stderr,"Giving up.  Parser is hopelessly lost...\n");
+   }
+

+ +

The %right directive

+ +

This directive is used to assign right-associative precedence to +one or more terminal symbols. See the section on precedence rules +or on the %left directive for additional information.

+ +

The %stack_overflow directive

+ +

The %stack_overflow directive specifies a block of C code that +is executed if the parser's internal stack ever overflows. Typically +this just prints an error message. After a stack overflow, the parser +will be unable to continue and must be reset.

+ +

+   %stack_overflow {
+     fprintf(stderr,"Giving up.  Parser stack overflow\n");
+   }
+

+ +

You can help prevent parser stack overflows by avoiding the use +of right recursion and right-precedence operators in your grammar. +Use left recursion and and left-precedence operators instead, to +encourage rules to reduce sooner and keep the stack size down. +For example, do rules like this: +

+   list ::= list element.      // left-recursion.  Good!
+   list ::= .
+
+Not like this: +
+   list ::= element list.      // right-recursion.  Bad!
+   list ::= .
+
+ +

The %stack_size directive

+ +

If stack overflow is a problem and you can't resolve the trouble +by using left-recursion, then you might want to increase the size +of the parser's stack using this directive. Put an positive integer +after the %stack_size directive and Lemon will generate a parse +with a stack of the requested size. The default value is 100.

+ +

+   %stack_size 2000
+

+ +

The %start_symbol directive

+ +

By default, the start-symbol for the grammar that Lemon generates +is the first non-terminal that appears in the grammar file. But you +can choose a different start-symbol using the %start_symbol directive.

+ +

+   %start_symbol  prog
+

+ +

The %token_destructor directive

+ +

The %destructor directive assigns a destructor to a non-terminal +symbol. (See the description of the %destructor directive above.) +This directive does the same thing for all terminal symbols.

+ +

Unlike non-terminal symbols which may each have a different data type +for their values, terminals all use the same data type (defined by +the %token_type directive) and so they use a common destructor. Other +than that, the token destructor works just like the non-terminal +destructors.

+ +

The %token_prefix directive

+ +

Lemon generates #defines that assign small integer constants +to each terminal symbol in the grammar. If desired, Lemon will +add a prefix specified by this directive +to each of the #defines it generates. +So if the default output of Lemon looked like this: +

+    #define AND              1
+    #define MINUS            2
+    #define OR               3
+    #define PLUS             4
+
+You can insert a statement into the grammar like this: +
+    %token_prefix    TOKEN_
+
+to cause Lemon to produce these symbols instead: +
+    #define TOKEN_AND        1
+    #define TOKEN_MINUS      2
+    #define TOKEN_OR         3
+    #define TOKEN_PLUS       4
+
+ +

The %token_type and %type directives

+ +

These directives are used to specify the data types for values +on the parser's stack associated with terminal and non-terminal +symbols. The values of all terminal symbols must be of the same +type. This turns out to be the same data type as the 3rd parameter +to the Parse() function generated by Lemon. Typically, you will +make the value of a terminal symbol by a pointer to some kind of +token structure. Like this:

+ +

+   %token_type    {Token*}
+

+ +

If the data type of terminals is not specified, the default value +is ``int''.

+ +

Non-terminal symbols can each have their own data types. Typically +the data type of a non-terminal is a pointer to the root of a parse-tree +structure that contains all information about that non-terminal. +For example:

+ +

+   %type   expr  {Expr*}
+

+ +

Each entry on the parser's stack is actually a union containing +instances of all data types for every non-terminal and terminal symbol. +Lemon will automatically use the correct element of this union depending +on what the corresponding non-terminal or terminal symbol is. But +the grammar designer should keep in mind that the size of the union +will be the size of its largest element. So if you have a single +non-terminal whose data type requires 1K of storage, then your 100 +entry parser stack will require 100K of heap space. If you are willing +and able to pay that price, fine. You just need to know.

+ +

Error Processing

+ +

After extensive experimentation over several years, it has been +discovered that the error recovery strategy used by yacc is about +as good as it gets. And so that is what Lemon uses.

+ +

When a Lemon-generated parser encounters a syntax error, it +first invokes the code specified by the %syntax_error directive, if +any. It then enters its error recovery strategy. The error recovery +strategy is to begin popping the parsers stack until it enters a +state where it is permitted to shift a special non-terminal symbol +named ``error''. It then shifts this non-terminal and continues +parsing. But the %syntax_error routine will not be called again +until at least three new tokens have been successfully shifted.

+ +

If the parser pops its stack until the stack is empty, and it still +is unable to shift the error symbol, then the %parse_failed routine +is invoked and the parser resets itself to its start state, ready +to begin parsing a new file. This is what will happen at the very +first syntax error, of course, if there are no instances of the +``error'' non-terminal in your grammar.

+ + + diff --git a/src/TODO b/src/TODO new file mode 100644 index 0000000..cf1e81a --- /dev/null +++ b/src/TODO @@ -0,0 +1,141 @@ +--- Things to fix before 1.0 +* search for TODO and fix in all files +* review use of __os_malloc verses __os_umalloc +* strcasecmp.c: what about UNICODE? +* --enable-sqlite-compat create the sqlite compat api +* --disable-statistics +* command line tools + * dbsql + * --bcp bulk copy from file +* integrate the new 4.3 unique id generation +* replace NDEBUG with DIAGNOSTIC +* ask about optimizations for MySQL, incorporate into DBSQL +* modify types to be less ambiguous int -> u_int32_t +* work bottom up, and top down knitting DB access patterns in +* grep for 'return [0-9]+' and replace with #defines that make more sense +* change all 'return XXX;' statements to be 'return (XXX);' +* replace '(char*)0' with NULL or some such thing +* look for and try to replace (void*) casts +* move dbsql_get_encoding global into DBSQL->[get,set]_encoding() +* rewrite error reporting, get rid of __str_urealloc and err_msgs +* lint, lclint and splint checking +* spell check comments, docs, etc - add standard spell.ok etc stuff +* grep for "Malloc Failed", fix +* replace home grown linked lists(src_list) with macro implementations of same +* dbsql_create_env() should do the following as a default setup: + To minimize the amount of space taken up by the log files, + configure Berkeley DB to have small log files (see the + DbEnv.set_lg_max method), do frequent checkpoints (see the + DbEnv.txn_checkpoint method), and automatically remove log + files (see the DB_LOG_AUTOREMOVE flag to the DbEnv.set_flags + method). -- Keith +* purify - memory leak/buffer overrun check +* profile - gprof(1) - profile run, look for hot spots +* produce and examine a code coverage report +* fix places where I moved local scope vars to function scope vars (as I go) +* consider using a DB_SEQ for 'int priorNewRowid; /* Last generated ROWID */' +* what is the difference between DBSQL_STATUS_ERROR verses DBSQL_RUN_RECOVERY + when should one be used over the other? check usage. +* DBSQL->{sg}et_verbose +* stats? +* How will TRIGGERS work in a multi env setup or worse yet, when replicated? +* add .describe [command] ('.describe select') to dbsql +* add .edit [!n] to open $EDITOR on historical statement +* examine the MySQL command line interface, add best features +* TRUNCATE table [tablename] +* use something similar to readline in shell (but not readline, its GPL) + +--- 1.1 +* cxx +* Java + * JDBC type ??? +* make the data types user definable via codec functions +* ASSOCIATE select_stmt WITH db_database_name [READ ONLY|READ WRITE] + KEY 'printf format expression' VALUE AS 'printf format expression' +* select @@IDENTITY +* SEQUENCE http://otn.oracle.com/products/rdb/pdf/0307_sequences.pdf +* XOpen CLI (==ODBC) implementation +* --enable-regex-like (e.g. 'SELECT * from Person where name like /B(u|i|y)rd/;') + +--- 2.0 +* note that cg_where.c has a WHERE clause limit of 100 search for wc_exprs[101] +* note in cg_where.c that if the 33rd table of a join has an index it won't + be found or used as the bitmask method uses an u_int_32, consider fixing this +* LibSDB interface http://siag.nu/libsdb/ +* --enable-xml + http://www.throwingbeans.org/tech/postgresql_and_xml.html + http://weblog.infoworld.com/udell/2003/03/12.html#a637 + http://www.sqlxml.org/ + http://www.perfectxml.com/SQLXML.asp + http://www.sqlxml.org/faqs.aspx?faq=103 +* 64bit clean http://www.treblig.org/articles/64bits.html +* Create View INFORMATION_SCHEMA_TABLES as + Select * from ( select 'main' as TABLE_CATALOG , 'sqlite' as TABLE_SCHEMA , tbl_name as TABLE_NAME , case when type = 'table' then 'BASE TABLE' when type = 'view' then 'VIEW' end as TABLE_TYPE, sql as TABLE_SOURCE from sqlite_master where type in('table','view') and tbl_name not like 'INFORMATION_SCHEMA_%' union select 'main' as TABLE_CATALOG , 'sqlite' as TABLE_SCHEMA , tbl_name as TABLE_NAME , case when type = 'table' then 'TEMPORARY TABLE' when type = 'view' then 'TEMPORARY VIEW' end as TABLE_TYPE, sql as TABLE_SOURCE from sqlite_temp_master where type in('table','view') and tbl_name not like 'INFORMATION_SCHEMA_%' ) BT order by TABLE_TYPE , TABLE_NAME + +--- 3.0 +* --enable-full-text-searching + CONTAINS full text index, stemming, etc. +* server +* replication + * build in severial replication methods, TCP p2p, TCP broadcast, + UDP broadcast, multicast + * discovery + * on mac, use rendevous + * on UNIX use SLRP + * use kqueues, /dev/poll, rt-signals etc - I think there is a lib that abstracts this + +--- Debugging +* build dbsql_sim - randomly exercises the system hoping to uncover bugs +* build dbsql_perf - measures performance of things relase/release vs baseline +* OSDB http://osdb.sourceforge.net/ + +--- Missing SQL92 features +* TRUNCATE table [tablename] +* ??? + +--- Competition + * http://mindprod.com/jgloss/sql.html + +--- Everything else... +* look at the API of http://www.xtgsystems.com/linux/simdb/doc.php +* http://www.sqlsummit.com/ODBCPORT.HTM +* http://en.wikipedia.org/wiki/ODBC +* dbExpress, is it some ODBC-like API +* http://www.thinksql.co.uk/Main/Documents/Multiversion.html +* http://www.rpbourret.com/xml/XMLDatabaseProds.htm +* http://www.rpbourret.com/xml/XMLAndDatabases.htm + +--- Google AdWords + +MySQL, sql, sql92, sqlite, jet database, ms access, access, sql engine, + + +--- References + +http://www.wiscorp.com/SQLStandards.html +http://www.ocelot.ca/nist.htm +http://www.jcc.com/SQLPages/jccs_sql.htm +http://www.tdan.com/i016hy01.htm +http://www.mimer.com/news.asp?secId=176&itemId=10 +http://www.itl.nist.gov/div897/ctg/sql-testing/sqlman60.htm +http://www.opengroup.org/public/tech/datam/sql.htm +http://www.dwm.uni-hildesheim.de/homes/r_maximi/SQL1998/CLICK_ME_SECOND.html +http://www.iam.unibe.ch/~scg/Archive/Software/FreeDB/FreeDB.list.html +http://www.infres.enst.fr/naw-home/doc/srfsqlhtml_bnf.html +http://www.ontko.com/~rayo/database.html +http://www.ocelot.ca/sites.htm +http://www.sqlcorner.com/ +http://www.codebox.8m.com/sql.htm +http://sqlzoo.net/sql92.html +http://www.opengroup.org/testing/testsuites/nistsql.htm +http://ou800doc.caldera.com/SDK_netapi/CTOC-xtiN.intro.html +http://cui.unige.ch/db-research/Enseignement/analyseinfo/SQL7/BNFindex.html +http://cui.unige.ch/db-research/Enseignement/analyseinfo/SQL92/BNFindex.html +http://cui.unige.ch/db-research/Enseignement/analyseinfo/PLSQL21/BNFindex.html +http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?relational+algebra +http://support.openlinksw.com/support/mac-faq.html + +@misc{ gukal-fast, + author = "Sreenivas Gukal and Edward Omiecinski and Umakishore Ramachandran", + title = "Fast Recovery in Transient-Versioned Databases", + url = "citeseer.nj.nec.com/38354.html" } diff --git a/src/api.c b/src/api.c new file mode 100644 index 0000000..172c1bc --- /dev/null +++ b/src/api.c @@ -0,0 +1,1492 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 DBSQL Group, Inc - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: api.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * Implementation of the programmer public API to the library. + */ + +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "dbsql_int.h" + +DBSQL_GLOBALS __dbsql_global_values; + +/* + * A pointer to this structure is used to communicate information + * from __init_databases into the __init_callback. + */ +typedef struct { + DBSQL *db; /* The database being initialized */ + char **err_msgs; /* Error message stored here */ +} init_data_t; + +/* + * __corrupt_schema -- + * Fill the init_data_t structure with an error message that + * indicates that the database is corrupt. + * + * STATIC: static void __corrupt_schema __P((init_data_t *)); + */ +static void +__corrupt_schema(data) + init_data_t *data; +{ + __str_append(data->err_msgs, "malformed database schema", + (char*)0); +} + +/* + * __init_callback -- + * This is the callback routine for the code that initializes + * the database. See __initXXX() below for additional information. + * + * Each callback contains the following information: + * + * argv[0] = "file-format", "schema-cookie", "table", "index" + * argv[1] = table or index name or meta statement type. + * argv[2] = root page number for table or index. NULL for meta. + * argv[3] = SQL text for a CREATE TABLE or CREATE INDEX statement. + * argv[4] = "1" for temporary files, "0" for main database, + * "2" or more for auxiliary database files. + * + * STATIC: static int __init_callback __P((init_data_t *)); + */ +static int +__init_callback(init, argc, argv, col_name) + void *init; + int argc; + char **argv; + char **col_name; +{ + init_data_t *data = (init_data_t*)init; + parser_t parser; + int nerr = 0; + + DBSQL_ASSERT(argc == 5); + + /* Might happen if EMPTY_RESULT_CALLBACKS are on */ + if (argv == 0) + return 0; + + if (argv[0] == 0) { + __corrupt_schema(data); + return 1; + } + + switch(argv[0][0]) { + case 'v': /* FALLTHROUGH */ + case 'i': /* FALLTHROUGH */ + case 't': + /* CREATE TABLE, CREATE INDEX, or CREATE VIEW statements */ + if (argv[2] == 0 || argv[4] == 0) { + __corrupt_schema(data); + return 1; + } + /* + * Call the parser to process a CREATE TABLE, INDEX or VIEW. + * But because sParse.initFlag is set to 1, no VDBE code is + * generated or executed. All the parser does is build the + * internal data structures that describe the table, index, + * or view. + */ + if(argv[3] && argv[3][0]) { + memset(&parser, 0, sizeof(parser)); + parser.db = data->db; + parser.initFlag = 1; + parser.iDb = atoi(argv[4]); + parser.newTnum = atoi(argv[2]); + parser.useCallback = 1; + __run_sql_parser(&parser, argv[3], data->err_msgs); + } else { + /* + * If the SQL column is blank it means this is an + * index that was created to be the PRIMARY KEY or + * to fulfill a UNIQUE constraint for a CREATE TABLE. + * The index should have already been created when + * we processed the CREATE TABLE. All we have to do + * here is record the root page number for that index. + */ + int dbi; + index_t *index; + + dbi = atoi(argv[4]); + DBSQL_ASSERT(dbi >= 0 && dbi < data->db->nDb); + index = __find_index(data->db, argv[1], + data->db->aDb[dbi].zName); + if (index == 0 || index->tnum != 0) { + /* + * This can occur if there exists an index + * on a TEMP table which has the same name + * as another index on a permanent index. + * Since the permanent table is hidden by + * the TEMP table, we can also safely ignore + * the index on the permanent table. + */ + /* FALLTHRUOUGH */; + } else { + index->tnum = atoi(argv[2]); + } + } + break; + default: + /* This can not happen! */ + nerr = 1; + DBSQL_ASSERT(nerr == 0); /* TODO create a __fatal() */ + } + return nerr; +} + +/* + * __init_db_file -- + * Attempt to read the database schema and initialize internal + * data structures for a single database file. The index of the + * database file is given by 'dbi'. dbi==0 is used for the main + * database. idb==1 should never be used. dbi>=2 is used for + * auxiliary databases. Return one of the DBSQL_ error codes to + * indicate success or failure. + * + * STATIC: static int __init_db_file __P((DBSQL *, int, char **)); + */ +static int +__init_db_file(dbp, dbi, err_msgs) + DBSQL *dbp; + int dbi; + char **err_msgs; +{ + int rc; + int size; + table_t *table; + char *args[6]; + char db_num[30]; + parser_t parser; + init_data_t init_data; + + /* + * The master database table has a structure like this + */ + static char master_schema[] = + "CREATE TABLE " MASTER_NAME "(\n" + " type text,\n" + " name text,\n" + " tbl_name text,\n" + " rootpage integer,\n" + " sql text\n" + ")" + ; + static char temp_master_schema[] = + "CREATE TEMP TABLE " TEMP_MASTER_NAME "(\n" + " type text,\n" + " name text,\n" + " tbl_name text,\n" + " rootpage integer,\n" + " sql text\n" + ")" + ; + + /* + * The following SQL will read the schema from the master tables. + * The rowid for new table entries (including entries in + * master is an increasing integer. So we can play back master + * and all the CREATE statements will appear in the right order. + */ + static char init_script[] = + "SELECT type, name, rootpage, sql, 1 FROM " TEMP_MASTER_NAME " " + "UNION ALL " + "SELECT type, name, rootpage, sql, 0 FROM " MASTER_NAME ""; + + DBSQL_ASSERT(dbi >= 0 && dbi != 1 && dbi < dbp->nDb); + + /* + * Construct the schema tables: master and temp_master + */ + args[0] = "table"; + args[1] = MASTER_NAME; + args[2] = "2"; + args[3] = master_schema; + sprintf(db_num, "%d", dbi); + args[4] = db_num; + args[5] = 0; + init_data.db = dbp; + init_data.err_msgs = err_msgs; + __init_callback(&init_data, 5, args, 0); + table = __find_table(dbp, MASTER_NAME, "main"); + if (table) { + table->readOnly = 1; + } + if (dbi == 0) { + args[1] = TEMP_MASTER_NAME; + args[3] = temp_master_schema; + args[4] = "1"; + __init_callback(&init_data, 5, args, 0); + table = __find_table(dbp, TEMP_MASTER_NAME, "temp"); + if(table){ + table->readOnly = 1; + } + } + + __sm_get_schema_sig(dbp->aDb[dbi].pBt, &dbp->aDb[dbi].schema_sig); + + if (dbi == 0) { + dbp->next_sig = dbp->aDb[dbi].schema_sig; + __sm_get_format_version(dbp->aDb[dbi].pBt, + &dbp->format_version); + if (dbp->format_version == 0) { + /* New, empty database. */ + dbp->format_version = DBSQL_FORMAT_VERSION; + } + } + + /* + * Read the schema information out of the schema tables. + */ + memset(&parser, 0, sizeof(parser)); + parser.db = dbp; + parser.xCallback = __init_callback; + parser.pArg = (void*)&init_data; + parser.initFlag = 1; + parser.useCallback = 1; + if(dbi == 0) { + __run_sql_parser(&parser, init_script, err_msgs); + } else { + char *sql = 0; + __str_append(&sql, "SELECT type, name, rootpage, sql, ", + db_num, " FROM \"", + dbp->aDb[dbi].zName, "\"." MASTER_NAME, + (char*)0); + __run_sql_parser(&parser, sql, err_msgs); + __dbsql_free(dbp, sql); + } + if (parser.rc == ENOMEM) { + __str_append(err_msgs, "out of memory", (char*)0); + parser.rc = DBSQL_NOMEM; + __reset_internal_schema(dbp, 0); + } + if (parser.rc == DBSQL_SUCCESS) { + DB_PROPERTY_SET(dbp, dbi, DBSQL_SCHEMA_LOADED); + if (dbi == 0) + DB_PROPERTY_SET(dbp, 1, DBSQL_SCHEMA_LOADED); + } else { + __reset_internal_schema(dbp, dbi); + } + return parser.rc; +} + +/* + * __init_databases -- + * Initialize all database files - the main database file, the file + * used to store temporary tables, and any additional database files + * created using ATTACH statements. Return a success code. If an + * error occurs, write an error message into *pzErrMsg. + * + * After the database is initialized, the DBSQL_Initialized + * bit is set in the flags field of the dbsql_t structure. An + * attempt is made to initialize the database as soon as it + * is opened. If that fails (perhaps because another process + * has the master table locked) than another attempt + * is made the first time the database is accessed. + * + * PUBLIC: int __init_databases __P((DBSQL *, char**)); + */ +int +__init_databases(dbp, err_msgs) + DBSQL *dbp; + char **err_msgs; +{ + int i = 0; + int rc = DBSQL_SUCCESS; + + DBSQL_ASSERT((dbp->flags & DBSQL_Initialized) == 0); + + for(i = 0; rc == DBSQL_SUCCESS && i < dbp->nDb; i++) { + if (DB_PROPERTY_HAS_VALUE(dbp, i, DBSQL_SCHEMA_LOADED)) + continue; + DBSQL_ASSERT(i != 1); + rc = __init_db_file(dbp, i, err_msgs); + } + if (rc == DBSQL_SUCCESS) { + dbp->flags |= DBSQL_Initialized; + __commit_internal_changes(dbp); + } else { + dbp->flags &= ~DBSQL_Initialized; + } + return rc; +} + +/* + * __sqldb_init -- + * + * PUBLIC: int __sqldb_init __P((dbsql_db_t *, DBSQL *, const char *, int, + * PUBLIC: int, int)); + */ +int +__sqldb_init(p, dbp, name, temp, mem, init_sm) + dbsql_db_t *p; + DBSQL *dbp; + const char *name; + int temp; + int mem; + int init_sm; +{ + int rc = DBSQL_SUCCESS; + + DBSQL_ASSERT(p != 0); + DBSQL_ASSERT(dbp != 0); + + p->dbp = dbp; + + __hash_init(&p->tblHash, DBSQL_HASH_STRING, 0); + __hash_init(&p->idxHash, DBSQL_HASH_STRING, 0); + __hash_init(&p->trigHash, DBSQL_HASH_STRING, 0); + __hash_init(&p->aFKey, DBSQL_HASH_STRING, 1); + + __dbsql_strdup(NULL, name, &p->zName); + + if (init_sm) { + /* Create a Berkeley DB storage manager. */ + if ((rc = __sm_create(dbp, name, temp, mem, &p->pBt)) + != DBSQL_SUCCESS) { + __hash_clear(&p->tblHash); + __hash_clear(&p->idxHash); + __hash_clear(&p->trigHash); + __hash_clear(&p->aFKey); + return rc; + } + } + + return DBSQL_SUCCESS; +} + +/* + * __api_open -- + * An attempt is made to initialize the in-memory data structures that + * hold the database schema. But if this fails (because the schema file + * is locked) then that step is deferred until the first call to + * DBSQL->exec(). + * + * STATIC: int __api_open __P((DBSQL *, const char *, int, char **)); + */ +int +__api_open(dbp, filename, mode, err_msgs) + DBSQL *dbp; + const char *filename; + int mode; /*TODO: argument not used*/ + char **err_msgs; +{ + int rc, i, mem; + + DBSQL_ASSERT(dbp); + DBSQL_ASSERT(err_msgs); + + mem = 0; + *err_msgs = 0; + + if (dbp == 0) + return DBSQL_CANTOPEN; + + dbp->onError = OE_Default; + dbp->priorNewRowid = 0; + dbp->magic = DBSQL_STATUS_BUSY; + dbp->nDb = 2; + + if (__dbsql_calloc(dbp, 2, sizeof(dbsql_db_t), &dbp->aDb) == ENOMEM) + goto no_mem_on_open; + + if (filename[0] == ':' && strcmp(filename, ":memory:") == 0) + mem = 1; + + for (i = 0; i < dbp->nDb; i++) { + rc = __sqldb_init(&dbp->aDb[i], dbp, filename, 0, mem, + (i ? 0 : 1)); + if (rc != DBSQL_SUCCESS) { + __str_append(err_msgs, "unable to open database: ", + filename, (char*)0); + __dbsql_free(dbp, dbp); + __str_urealloc(err_msgs); + return DBSQL_CANTOPEN; + } + } + + dbp->aDb[0].zName = "main"; + dbp->aDb[1].zName = "temp"; + + /* Attempt to read the schema. */ + __hash_init((hash_t*)dbp->aFunc, DBSQL_HASH_STRING, 1); + __register_builtin_funcs(dbp); + rc = __init_databases(dbp, err_msgs); + dbp->magic = DBSQL_STATUS_OPEN; + if (rc == ENOMEM) { + dbp->close(dbp); + goto no_mem_on_open; + } else if (rc != DBSQL_SUCCESS && rc != DBSQL_BUSY) { + dbp->close(dbp); + __str_urealloc(err_msgs); + return DBSQL_CANTOPEN; + } else if (*err_msgs) { + __dbsql_free(dbp, *err_msgs); + *err_msgs = 0; + } + + /* Return a pointer to the newly opened database structure */ + return DBSQL_SUCCESS; + + no_mem_on_open: + __str_append(err_msgs, "out of memory", (char*)0); + __str_urealloc(err_msgs); + return DBSQL_NOMEM; +} + +/* + * __api_last_inserted_rowid -- + * Return the ROWID of the most recent insert + * + * STATIC: static int __api_last_inserted_rowid __P((DBSQL *)); + */ +int +__api_last_inserted_rowid(dbp) + DBSQL *dbp; +{ + return dbp->lastRowid; +} + +/* + * __api_last_change_count -- + * Return the number of changes in the most recent call to __api_exec(). + * + * STATIC: static int __api_last_change_count __P((DBSQL *)); + */ +int +__api_last_change_count(dbp) + DBSQL *dbp; +{ + return dbp->_num_last_changes; +} + +/* + * __api_total_change_count -- + * Return the total number of changes for all calls since database + * open. Essentially the sum of all _num_last_changes. + * + * STATIC: static int __api_total_change_count __P((DBSQL *)); + */ +int +__api_total_change_count(dbp) + DBSQL *dbp; +{ + return dbp->_num_total_changes; +} + +/* + * __api_close -- + * Close this database releasing all associated resources. + * + * STATIC: static int __api_close __P((DBSQL *)); + */ +int +__api_close(dbp) + DBSQL *dbp; +{ + hash_ele_t *i; + int j; + dbp->want_to_close = 1; + + if (__safety_check(dbp) || __safety_on(dbp)) { + /* TODO printf("DID NOT CLOSE\n"); fflush(stdout); */ + return DBSQL_ERROR; + } + dbp->magic = DBSQL_STATUS_CLOSED; + for ( j = 0; j < dbp->nDb; j++) { + if (dbp->aDb[j].pBt) { + __sm_close_db(dbp->aDb[j].pBt); + dbp->aDb[j].pBt = 0; + } + if(j >= 2) { + __dbsql_free(dbp, dbp->aDb[j].zName); + dbp->aDb[j].zName = 0; + } + } + __reset_internal_schema(dbp, 0); + DBSQL_ASSERT(dbp->nDb <= 2); + for (i = __hash_first((hash_t*)dbp->aFunc); i; i = __hash_next(i)){ + func_def_t *func, *next; + for (func = (func_def_t*)__hash_data(i); func; func = next){ + next = func->pNext; + __dbsql_free(dbp, func); + } + } + if (dbp->dbsql_errpfx) + __dbsql_free(dbp, dbp->dbsql_errpfx); + __dbsql_free(dbp, dbp->aDb); + __hash_clear((hash_t*)dbp->aFunc); + __dbsql_free(dbp, dbp); + return DBSQL_SUCCESS; +} + +/* + * __process_sql -- + * This routine does the work of either __api_exec() or __api_prepare(). + * It works like __api_exec() if vm == NULL and it works like + * __api_prepare() otherwise. + * + * STATIC: static int __process_sql __P((DBSQL *, const char *, + * STATIC: dbsql_callback, void *, const char **, + * STATIC: dbsql_stmt_t, char **)) + * + * dbp The database on which the SQL executes + * sql The SQL to be executed + * callback Invoke this callback routine + * arg First argument to callback() + * tail OUT: Next statement after the first + * vm OUT: The virtual machine + * err_msgs OUT: Write error messages here + */ +static int +__process_sql(dbp, sql, callback, arg, tail, vm, err_msgs) + DBSQL *dbp; + const char *sql; + dbsql_callback callback; + void *arg; + const char **tail; + dbsql_stmt_t **vm; + char **err_msgs; +{ + parser_t parser; + + if (err_msgs) + *err_msgs = 0; + if (__safety_on(dbp)) + goto exec_misuse; + if ((dbp->flags & DBSQL_Initialized) == 0) { + int rc, i = 1; + while ((rc = __init_databases(dbp, err_msgs)) == DBSQL_BUSY + && dbp->xBusyCallback + && dbp->xBusyCallback(dbp, dbp->pBusyArg, "", i++) != 0) { + /* EMPTY */; + } + if (rc != DBSQL_SUCCESS) { + __str_urealloc(err_msgs); + __safety_off(dbp); + return rc; + } + if (err_msgs) { + __dbsql_free(dbp, *err_msgs); + *err_msgs = 0; + } + } + /* TODO: in the __meta subdatabase get:'format_version' + if (dbp->file_format < 3) { + __safety_off(dbp); + __str_append(err_msgs, "obsolete database file format", + (char*)0); + return DBSQL_ERROR; + } + */ + if (dbp->pVdbe == 0) + dbp->_num_last_changes = 0; + memset(&parser, 0, sizeof(parser_t)); + parser.db = dbp; + parser.xCallback = callback; + parser.pArg = arg; + parser.useCallback = (vm == 0); + if (dbp->xTrace) + dbp->xTrace(dbp->pTraceArg, sql); +#ifdef NDEBUG + if (F_ISSET(dbp, DBSQL_VdbeTrace)) + parser.trace = stderr; +#endif + __run_sql_parser(&parser, sql, err_msgs); + if (parser.rc == ENOMEM) { + __str_append(err_msgs, "out of memory", (char*)0); + parser.rc = DBSQL_NOMEM; + /* TODO __sm_abort_txn(dbp, ); do we need this? */ + __reset_internal_schema(dbp, 0); + dbp->flags &= ~DBSQL_InTrans; + } + if (parser.rc == DBSQL_DONE) + parser.rc = DBSQL_SUCCESS; + if (parser.rc != DBSQL_SUCCESS && err_msgs && *err_msgs == 0) { + __str_append(err_msgs, dbsql_strerror(parser.rc), + (char*)0); + } + __str_urealloc(err_msgs); + if (parser.rc == DBSQL_SCHEMA) { + __reset_internal_schema(dbp, 0); + } + if (parser.useCallback == 0) { + DBSQL_ASSERT(vm); + *vm = (dbsql_stmt_t*)parser.pVdbe; + if (tail) + *tail = parser.zTail; + } + if (__safety_off(dbp)) + goto exec_misuse; + return parser.rc; + + exec_misuse: + if (err_msgs) { + *err_msgs = 0; + __str_append(err_msgs, dbsql_strerror(DBSQL_MISUSE), + (char*)0); + __str_urealloc(err_msgs); + } + return DBSQL_MISUSE; +} + +/* + * __api_exec -- + * Execute SQL code. Return one of the DBSQL_ success/failure + * codes. + * If the SQL is a query, then for each row in the query result + * the callback() function is called. 'arg' becomes the first + * argument to callback(). If callback is NULL then no callback + * is invoked, even for queries. + * + * STATIC: static int __api_exec __P((DBSQL *, const char *, dbsql_callback, + * STATIC: void *, char **)); + * + * dbp The database on which the SQL executes + * sql The SQL to be executed + * callback Invoke this callback routine + * arg First argument to callback() + * err_msgs Write error messages here + */ +int __api_exec(dbp, sql, callback, arg, err_msgs) + DBSQL *dbp; + const char *sql; + dbsql_callback callback; + void *arg; + char **err_msgs; +{ + return __process_sql(dbp, sql, callback, arg, 0, 0, err_msgs); +} + +/* + * __api_prepare -- + * Compile a single statement of SQL into a virtual machine. Return one + * of the DBSQL_ success/failure codes. + * + * STATIC: static int __api_prepare __P((DBSQL *, const char *, const char **, + * STATIC: dbsql_stmt_t **, char **)); + * + * db The database on which the SQL executes + * sql The SQL to be executed + * tail OUT: Next statement after the first + * stmt OUT: The virtual machine to run this SQL statement + * err_msgs OUT: Write error messages here + */ +int +__api_prepare(dbp, sql, tail, stmt, err_msgs) + DBSQL *dbp; + const char *sql; + const char **tail; + dbsql_stmt_t **stmt; + char **err_msgs; +{ + return __process_sql(dbp, sql, 0, 0, tail, stmt, err_msgs); +} + + +/* + * __api_finalize -- + * The following routine destroys a virtual machine that is created by + * the __api_prepare() routine. + * The integer returned is an DBSQL_ success/failure code that describes + * the result of executing the virtual machine. + * + * STATIC: static int __api_finalize __P((dbsql_stmt_t *, char **)); + * + * stmt The virtual machine for the statement to be destroyed + * err_msgs OUT: Write error messages here + */ +/* + * TODO REMOVE THIS: An error message is + * written into memory obtained from malloc and *pzErrMsg is made to + * point to that error if pzErrMsg is not NULL. The calling routine + * should use __api_freemem() to delete the message when it has finished + * with it. + */ +int +__api_finalize(stmt, err_msgs) + dbsql_stmt_t *stmt; + char **err_msgs; +{ + int rc = __vdbe_finalize((vdbe_t*)stmt, err_msgs); + __str_urealloc(err_msgs); + return rc; +} + +/* + * __api_reset -- + * Terminate the current execution of a virtual machine then + * reset the virtual machine back to its starting state so that it + * can be reused. + * + * STATIC: static int __api_reset __P((dbsql_stmt_t *, char **)); + * + * stmt The virtual machine for the statement to be reset + * err_msgs OUT: Write error messages here + */ +/* TODO REMOVE THIS: Any error message resulting from the prior execution + * is written into *pzErrMsg. A success code from the prior execution + * is returned. + */ +int +__api_reset(stmt, err_msgs) + dbsql_stmt_t *stmt; + char **err_msgs; +{ + int rc = __vdbe_reset((vdbe_t*)stmt, err_msgs); + __vdbe_make_ready((vdbe_t*)stmt, -1, 0, 0, 0); + __str_urealloc(err_msgs); + return rc; +} + +/* + * __default_busy_callback -- + * This routine implements a busy callback that sleeps and tries + * again until a timeout value is reached. The timeout value is + * an integer number of milliseconds passed in as the first + * argument. + * + * STATIC: static int __default_busy_callback __P((DBSQL *, void *, + * STATIC: const char *, int)); + * + * timeout Maximum amount of time to wait + * not_used The name of the table that is busy + * count Number of times table has been busy + */ +static int +__default_busy_callback(dbp, arg, not_used, count) + DBSQL *dbp; + void *arg; + const char *not_used; + int count; +{ +#if defined(__LP64) || defined(__LP64__) + u_int64_t timeout = (u_int64_t)arg; +#else + u_int32_t timeout = (u_int32_)t)arg; +#endif +#if DBSQL_MIN_SLEEP_MS==1 + static const char delays[] = + { 1, 2, 5, 10, 15, 20, 25, 25, 25, 50, 50, 50, 100}; + static const short int totals[] = + { 0, 1, 3, 8, 18, 33, 53, 78, 103, 128, 178, 228, 287}; +# define NDELAY (sizeof(delays)/sizeof(delays[0])) + u_int32_t delay, prior; + + if (count <= NDELAY) { + delay = delays[count - 1]; + prior = totals[count - 1]; + } else { + delay = delays[NDELAY - 1]; + prior = totals[NDELAY - 1] + delay * (count - NDELAY - 1); + } + if (prior + delay > timeout){ + delay = timeout - prior; + if (delay <= 0) + return 0; + } + __os_sleep(dbp, 0, delay); + return 1; +#else + if ((count + 1) * 1000 > timeout) { + return 0; + } + __os_sleep(dbp, 1, 0); + return 1; +#endif +} + +/* + * __api_set_busy_callback -- + * This routine sets the busy callback for the database to the + * given callback function with the given argument. + * + * STATIC: static void __api_set_busy_callback __P((DBSQL *, + * STATIC: int (*)(DBSQL *, void*, const char*, int), void *)); + */ +void +__api_set_busy_callback(dbp, busy, arg) + DBSQL *dbp; + int (*busy)(DBSQL *, void *, const char*, int); + void *arg; +{ + dbp->xBusyCallback = busy; + dbp->pBusyArg = arg; +} + +#ifndef DBSQL_NO_PROGRESS +/* + * __api_set_progress_callback -- + * This routine sets the progress callback for a database to the + * given callback function with the given argument. The progress + * callback will be invoked every num_ops opcodes have been executed. + * + * STATIC: static void __api_set_progress_callback __P((DBSQL *, int, + * STATIC: int (*)(void*), void *)); + */ +void +__api_set_progress_callback(dbp, num_ops, progress, arg) + DBSQL *dbp; + int num_ops; + int (*progress)(void*); + void *arg; +{ + if (num_ops > 0) { + dbp->xProgress = progress; + dbp->nProgressOps = num_ops; + dbp->pProgressArg = arg; + } else { + dbp->xProgress = 0; + dbp->nProgressOps = 0; + dbp->pProgressArg = 0; + } +} +#endif + + +/* + * __api_set_busy_timeout -- + * This routine installs a default busy handler that waits for the + * specified number of milliseconds before returning 0. + * + * STATIC: static void __api_set_busy_timeout __P((DBSQL *, int)); + */ +void +__api_set_busy_timeout(dbp, ms) + DBSQL *dbp; + int ms; +{ +#if defined(__LP64) || defined(__LP64__) + u_int64_t delay = ms; +#else + u_int32_t delay = ms; +#endif + + if (ms > 0) + dbp->set_busycall(dbp, __default_busy_callback, (void*)delay); + else + dbp->set_busycall(dbp, 0, 0); +} + +/* + * __api_interrupt -- + * Cause any pending operation to stop at its earliest opportunity. + * + * PUBLIC: void __api_interrupt __P((DBSQL *)); + */ +void +__api_interrupt(dbp) + DBSQL *dbp; +{ + dbp->flags |= DBSQL_Interrupt; +} + +/* + * dbsql_version -- + * Return the version of the library. + * + * EXTERN: const char *dbsql_version __P((int *, int *, int *)); + */ +const char * +dbsql_version(major, minor, patch) + int *major; + int *minor; + int *patch; +{ + *major = DBSQL_VERSION_MAJOR; + *minor = DBSQL_VERSION_MINOR; + *patch = DBSQL_VERSION_PATCH; + return DBSQL_VERSION_STRING; +} + +/* + * __api_get_encoding -- + * Return the string encoding used by the library. + * + * STATIC: static const char * __api_get_encoding __P((void)); + */ +const char * +__api_get_encoding() +{ + return DBSQL_GLOBAL(encoding); +} + +/* + * __api_create_function -- + * Create new user-defined functions. This routine creates a + * regular scalar function or an aggregate function. + * The function pointers passed (func, step and finalize), implement + * the function or aggregate and how to dispose of its data. + * A scalar function should supply the func callback and NULL for + * step and finalize. An aggregate function should supply step and + * finalize but not func by passing NULL for that parameter. To remove + * a function or aggregate, pass NULL for all three callbacks (func, + * step, and finalize). + * If 'num_arg' is -1 it means that this function will accept any number + * of arguments, including 0. + * + * STATIC: static int __api_create_function __P((DBSQL *, const char *, int, + * STATIC: int, void *, + * STATIC: void (*)(dbsql_func_t *, int, const char**), + * STATIC: void (*)(dbsql_func_t *, int, const char**), + * STATIC: void (*)(dbsql_func_t *))); + * + * dbp Add the function to this database connection + * name Name of the function to add + * num_arg Number of arguments + * encoding The encoding expected by the functions + * user_data User data + * func The function's implementation + * step Step is used by aggregate functions + * finalize When finished with + */ +int +__api_create_function(dbp, name, num_arg, user_data, encoding, func, + step, finalize) + DBSQL *dbp; + const char *name; + int num_arg; + void *user_data; + int encoding;/*TODO: not yet used*/ + void (*func)(dbsql_func_t*, int, const char**); + void (*step)(dbsql_func_t*, int, const char**); + void (*finalize)(dbsql_func_t*); +{ + func_def_t *p; + int name_len; + + if (dbp == NULL || __safety_check(dbp)) + return DBSQL_ERROR; + + if((name == NULL) || + (func && (finalize || step)) || + (!func && (finalize && !step)) || + (!func && (!finalize && step)) || + (num_arg < -1 || num_arg > 127)) + return DBSQL_ERROR; + + name_len = strlen(name); + if (name_len > 255) + return DBSQL_ERROR; + + p = __find_function(dbp, name, name_len, num_arg, 1); + if (p == 0) + return DBSQL_ERROR; + p->xFunc = func; + p->xStep = step; + p->xFinalize = finalize; + p->pUserData = user_data; + + return DBSQL_SUCCESS; +} + +/* + * __api_exec_printf -- + * + * STATIC: static int __api_exec_printf __P((DBSQL *, const char *, + * STATIC: dbsql_callback, void *, char **, ...)); + * STATIC: __attribute__ ((__format__ (__printf__, 2, 5))); + * + * dbp The DBSQL database + * fmt Printf-style format string for the SQL + * callback Callback function + * arg 1st argument to callback function + * err_msgs Error msg written here + * ... Arguments to the format string + */ +static int +#ifdef STDC_HEADERS +__api_exec_printf(DBSQL *dbp, const char *fmt, dbsql_callback callback, + void *arg, char **err_msgs, ...) +#else +__api_exec_printf(dbp, fmt, callback, arg, err_msgs, ...) + DBSQL *dbp; + const char *fmt; + dbsql_callback callback; + void *arg; + char **err_msgs; + va_dcl +#endif +{ + va_list ap; + int rc; + + va_start(ap, err_msgs); + rc = dbp->exec_vprintf(dbp, fmt, callback, arg, err_msgs, ap); + va_end(ap); + return rc; +} + +/* + * __api_exec_vprintf -- + * + * STATIC: static int __api_exec_vprintf __P((DBSQL *, const char *, + * STATIC: dbsql_callback, void *, char **, va_list)); + * + * dbp The DBSQL database + * fmt Printf-style format string for the SQL + * callback Callback function + * arg 1st argument to callback function + * err_msgs Error msg written here + * va_list Args list + */ +static int +__api_exec_vprintf(dbp, fmt, callback, arg, err_msgs, ap) + DBSQL *dbp; + const char *fmt; + dbsql_callback callback; + void *arg; + char **err_msgs; + va_list ap; +{ + char *sql; + int rc; + + sql = xvprintf(dbp, fmt, ap); + rc = dbp->exec(dbp, sql, callback, arg, err_msgs); + __dbsql_free(dbp, sql); + return rc; +} + +/* + * __api_exec_table_printf -- + * + * STATIC: static int __api_exec_table_printf __P((DBSQL *, const char *, + * STATIC: char ***, int *, int *, char **, ...)); + * STATIC: __attribute__ ((__format__ (__printf__, 2, 7))); + * + * dbp The DBSQL database + * fmt Printf-style format string for the SQL + * results The results as an array of arrays of strings. + * num_rows Number of rows returned + * num_cols Number of cols in each row + * err_msgs Error msg written here + * ... Arguments to the format string + */ +static int +#ifdef STDC_HEADERS +__api_exec_table_printf(DBSQL *dbp, const char *fmt, char ***results, + int *num_rows, int *num_cols, char **err_msgs, ...) +#else +__api_exec_printf(dbp, fmt, results, num_rows, num_cols, err_msgs, ...) + DBSQL *dbp; + const char *fmt; + char ***results; + int *num_rows; + int *num_cols; + char **err_msgs; + va_dcl +#endif +{ + va_list ap; + int rc; + + va_start(ap, err_msgs); + rc = dbp->exec_table_printf(dbp, fmt, results, num_rows, num_cols, + err_msgs, ap); + va_end(ap); + return rc; +} + +/* + * __api_exec_table_vprintf -- + * + * STATIC: static int __api_exec_table_vprintf __P((DBSQL *, const char *, + * STATIC: char ***, int *, int *, char **, va_list)); + * + * dbp The DBSQL database + * fmt Printf-style format string for the SQL + * results The results as an array of arrays of strings. + * num_rows Number of rows returned + * num_cols Number of cols in each row + * err_msgs Error msg written here + * ap Arguments to the format string + */ +static int +__api_exec_table_vprintf(dbp, fmt, results, num_rows, num_cols, err_msgs, ap) + DBSQL *dbp; + const char *fmt; + char ***results; + int *num_rows; + int *num_cols; + char **err_msgs; + va_list ap; +{ + char *sql; + int rc; + + sql = xvprintf(dbp, fmt, ap); + rc = dbp->get_table(dbp, sql, results, num_rows, num_cols, err_msgs); + __dbsql_free(dbp, sql); + return rc; +} + +/* + * __api_func_return_type -- + * Change the datatype for all functions with a given name. See the + * header comment for the prototype of this function in dbsql.h for + * additional information. + * + * STATIC: static int __api_func_return_type __P((DBSQL *, const char *, int)); + */ +int +__api_func_return_type(dbp, name, data_type) + DBSQL *dbp; + const char *name; + int data_type; +{ + func_def_t *p = (func_def_t*)__hash_find((hash_t*)dbp->aFunc, name, + strlen(name)); + while(p) { + p->dataType = data_type; + p = p->pNext; + } + return DBSQL_SUCCESS; +} + +/* + * __api_set_trace_callback -- + * Register a trace function. The 'arg' from the previously + * registered trace is returned. + * A NULL trace function means that no tracing is executes. A non-NULL + * trace is a pointer to a function that is invoked at the start of each + * __api_exec(). + * + * STATIC: static void *__api_set_trace_callback __P((DBSQL *, + * STATIC: void (*trace)(void*, const char *), void *)); + */ +void * +__api_set_trace_callback(dbp, trace, arg) + DBSQL *dbp; + void (*trace)(void*,const char*); + void *arg; +{ + void *old = dbp->pTraceArg; + dbp->xTrace = trace; + dbp->pTraceArg = arg; + return old; +} + +/* + * __api_set_commit_callback -- + * Register a function to be invoked when a transaction comments. + * If either function returns non-zero, then the commit becomes a + * rollback. + * + * STATIC: static void *__api_set_commit_callback __P((DBSQL *, + * STATIC: int (*)(void *), void *)); + * + * dbp Attach the hook to this database + * callback Function to invoke on each commit + * arg Argument to the function + */ +void * +__api_set_commit_callback(dbp, callback, arg) + DBSQL *dbp; + int (*callback)(void*); + void *arg; +{ + void *old = dbp->pCommitArg; + dbp->xCommitCallback = callback; + dbp->pCommitArg = arg; + return old; +} + +/* + * __api_get_dbenv -- + * + * STATIC: static DB_ENV *__api_get_dbenv __P((DBSQL *)); + */ +static DB_ENV * +__api_get_dbenv(dbp) + DBSQL *dbp; +{ + return dbp->dbenv; +} + +/* + * __api_set_errcall -- + * Register a function when an error occurs. + * + * STATIC: static void __api_set_errcall __P((DBSQL *, + * STATIC: void (*)(const char *, char *))); + * + * dbp Attach the hook to this database + * callback Function to invoke on each commit + */ +void +__api_set_errcall(dbp, callback) + DBSQL *dbp; + void (*callback)(const char *, char *); +{ + dbp->dbsql_errcall = callback; +} + +/* + * __api_set_errfile -- + * Register a FILE* for use when logging error messages. + * + * STATIC: static void __api_set_errfile __P((DBSQL *, FILE *)); + * + * dbp Attach the hook to this database + * file Open file stream for suitable for writing + */ +void +__api_set_errfile(dbp, file) + DBSQL *dbp; + FILE *file; +{ + dbp->dbsql_errfile = file; +} + +/* + * __api_get_errfile -- + * Get the FILE* registered for error messages. + * + * STATIC: static void __api_get_errfile __P((DBSQL *, FILE **)); + * + * dbp Attach the hook to this database + * file OUT: The file used for error messages + */ +void +__api_get_errfile(dbp, file) + DBSQL *dbp; + FILE **file; +{ + *file = dbp->dbsql_errfile; +} + +/* + * __api_set_errpfx -- + * Set a prefix for use when writting error messages. + * + * STATIC: static void __api_set_errpfx __P((DBSQL *, const char *)); + * + * dbp Attach the hook to this database + * prefix A prefix string + */ +void +__api_set_errpfx(dbp, prefix) + DBSQL *dbp; + const char *prefix; +{ + __dbsql_strdup(dbp, prefix, &dbp->dbsql_errpfx); +} + +/* + * __api_get_errpfx -- + * Get the error prefix. + * + * STATIC: static void __api_get_errpfx __P((DBSQL *, char **)); + * + * dbp Attach the hook to this database + * prefix OUT: The prefix string + */ +void +__api_get_errpfx(dbp, prefix) + DBSQL *dbp; + const char **prefix; +{ + *prefix = dbp->dbsql_errpfx; +} + +/* + * dbsql_create_env -- + * Create a basic DB_ENV and then a DBSQL manager within it. + * + * EXTERN: int dbsql_create_env __P((DBSQL **dbp, const char *, + * EXTERN: const char *, int, u_int32_t flags)); + */ +int +dbsql_create_env(dbpp, dir, crypt, mode, flags) + DBSQL **dbpp; + const char *dir; + const char *crypt; + int mode; + u_int32_t flags; +{ + int rc; + DB_ENV *dbenv; + int dir_p = 0; + int file_p = 0; + int env_open_flags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | + DB_INIT_TXN | DB_CREATE; + + /* Setup the DB_ENV with that directory as DB_HOME */ + if ((rc = db_env_create(&dbenv, 0)) != 0) { + __dbsql_err(NULL, db_strerror(rc)); + return DBSQL_CANTOPEN; + } + + /* Check for a directory to house the database. */ + if (dir == 0 || dir[0] == '\0') { + /* When dir is NULL, place all resources in memory. */ + env_open_flags |= DB_PRIVATE; + dbenv->set_flags(dbenv, DB_TXN_NOT_DURABLE, 1); + } else { + if (__os_exists(dir, &dir_p) == 0) { + if (dir_p) { + char buf[1024]; + snprintf(buf, 1024, "%s%s%s", dir, + PATH_SEPARATOR, dir); + if (__os_exists(buf, &dir_p) == 0) + env_open_flags = DB_JOINENV; + } else { + __dbsql_err(NULL, + "Environment must be a directory."); + return DBSQL_INVALID_NAME; + } + } else { /* TODO __db_omode("rwxrwxrwx"):mode) != 0) */ + if (mkdir(dir, mode == 0 ? 0777 : mode) != 0) + return errno; + } + } + + if (LF_ISSET(DBSQL_THREAD)) + env_open_flags |= DB_THREAD; + + if ((rc = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT)) != 0) { + __dbsql_err(NULL, db_strerror(rc)); + dbenv->close(dbenv, 0); + return DBSQL_CANTOPEN; + } + + if ((rc = dbenv->set_cachesize(dbenv, 0, 256 * 1024, 0)) != 0) { + __dbsql_err(NULL, db_strerror(rc)); + dbenv->close(dbenv, 0); + return DBSQL_CANTOPEN; + } + + if (crypt && crypt[0]) { + if ((rc = dbenv->set_encrypt(dbenv, crypt, + DB_ENCRYPT_AES)) != 0) { + __dbsql_err(NULL, db_strerror(rc)); + dbenv->close(dbenv, 0); + return DBSQL_CANTOPEN; + } + } + + if ((rc = dbenv->open(dbenv, dir, env_open_flags, mode)) != 0) { + __dbsql_err(NULL, db_strerror(rc)); + dbenv->close(dbenv, 0); + return DBSQL_CANTOPEN; + } + +#ifdef DEBUG + dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR | + DB_VERB_DEADLOCK | DB_VERB_RECOVERY, 1); +#endif + + return dbsql_create(dbpp, dbenv, flags); +} + +/* + * dbsql_create -- + * Create a new sql database. Construct a DBSQL structure to hold + * the state of this database and return a pointer. + * + * EXTERN: int dbsql_create __P((DBSQL **, DB_ENV *, u_int32_t)); + */ +int +dbsql_create(dbpp, dbenv, flags) + DBSQL **dbpp; + DB_ENV *dbenv; + u_int32_t flags; +{ + DBSQL *dbp; + DBSQL_ASSERT(dbpp != 0); + + if (dbenv == NULL) + return EINVAL; /* TODO better error message */ + + /* + * Does the library expect data to be encoded as UTF-8 + * or iso8859? The following global constant always + * lets us know. + * TODO: Make this configurable as a flag and part of the meta + * database. + */ +#if DBSQL_UTF8_ENCODING + DBSQL_GLOBAL(encoding) = "UTF-8"; +#else + DBSQL_GLOBAL(encoding) = "iso8859"; +#endif + + if (__dbsql_calloc(NULL, 1, sizeof(*dbp) + sizeof(hash_t), &dbp) + == ENOMEM) + return DBSQL_NOMEM; + + dbp->aFunc = dbp + sizeof(hash_t); + + srand48_r(1, &dbp->rand); /* seed our random number generator TODO */ + + if (LF_ISSET(DBSQL_THREAD)) + F_SET(dbp, DBSQL_Threaded); + if (LF_ISSET(DBSQL_DURABLE_TEMP)) + F_SET(dbp, DBSQL_DurableTemp); + + dbp->dbenv = dbenv; + dbp->encoding = __api_get_encoding; + dbp->open = __api_open; + dbp->close = __api_close; + dbp->rowid = __api_last_inserted_rowid; + dbp->last_change_count = __api_last_change_count; + dbp->total_change_count = __api_total_change_count; + dbp->interrupt = __api_interrupt; + dbp->set_errcall = __api_set_errcall; + dbp->set_errfile = __api_set_errfile; + dbp->get_errfile = __api_get_errfile; + dbp->set_errpfx = __api_set_errpfx; + dbp->get_errpfx = __api_get_errpfx; + dbp->get_dbenv = __api_get_dbenv; + dbp->set_tracecall = __api_set_trace_callback; +#ifndef DBSQL_NO_PROGRESS + dbp->set_progresscall = __api_set_progress_callback; +#endif + dbp->set_commitcall = __api_set_commit_callback; + dbp->set_busycall = __api_set_busy_callback; + dbp->set_timeout = __api_set_busy_timeout; + dbp->get_table = __api_get_table; + dbp->free_table = __api_free_table; + dbp->exec_printf = __api_exec_printf; + dbp->exec_vprintf = __api_exec_vprintf; + dbp->exec_table_printf = __api_exec_table_printf; + dbp->exec_table_vprintf = __api_exec_table_vprintf; + dbp->exec = __api_exec; + dbp->create_function = __api_create_function; + dbp->func_return_type = __api_func_return_type; + dbp->set_authorizer = __api_set_authorizer; + dbp->prepare = __api_prepare; + dbp->step = __api_step; + dbp->finalize = __api_finalize; + dbp->reset = __api_reset; + dbp->bind = __api_bind; + *dbpp = dbp; + return DBSQL_SUCCESS; +} diff --git a/src/api_table.c b/src/api_table.c new file mode 100644 index 0000000..2ab17ac --- /dev/null +++ b/src/api_table.c @@ -0,0 +1,279 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: api_table.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains the __api_get_table() and __api_free_table() + * interface routines. These are just wrappers around the main + * interface routine of DBSQL->exec(). + * + * These routines are in a separate files so that they will not be linked + * if they are not used. + */ +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#endif + +#include "dbsql_int.h" + +/* + * This structure is used to pass data from __get_table() through + * to the user's callback function. + */ +typedef struct table_result { + char **result; + char *err_msgs; + u_int32_t num_result; + u_int32_t num_alloc; + u_int32_t num_row; + u_int32_t num_col; + u_int32_t num_data; + u_int32_t rc; +} table_result_t; + +/* + * __get_table_cb -- + * This routine is called once for each row in the result table. Its job + * is to fill in the table_result_t structure appropriately, allocating + * new memory as necessary. + * + * STATIC: static int __get_table_cb __P((void *, int, char **, char **)); + */ +static int +__get_table_cb(arg, ncol, argv, colv) + void *arg; + int ncol; + char **argv; + char **colv; +{ + int rc; + table_result_t *p = (table_result_t*)arg; + int need; + int i; + char *z; + + /* + * Make sure there is enough space in p->result to hold everything + * we need to remember from this invocation of the callback. + */ + if (p->num_row == 0 && argv != 0) { + need = ncol * 2; + } else { + need = ncol; + } + if (p->num_data + need >= p->num_alloc) { + p->num_alloc = (p->num_alloc * 2) + need + 1; + rc = __dbsql_realloc(NULL, sizeof(char*) * p->num_alloc, + &p->result); + if (rc == ENOMEM) { + p->rc = DBSQL_NOMEM; + return DBSQL_ERROR; + } + } + + /* + * If this is the first row, then generate an extra row containing + * the names of all columns. + */ + if (p->num_row==0) { + p->num_col = ncol; + for (i = 0; i < ncol; i++) { + if (colv[i] == 0) { + z = 0; + } else { + int rc = __dbsql_malloc(NULL, + strlen(colv[i]) + 1, &z); + if (rc == ENOMEM) { + p->rc = DBSQL_NOMEM; + return DBSQL_ERROR; + } + strcpy(z, colv[i]); + } + p->result[p->num_data++] = z; + } + } else if (p->num_col != ncol) { + __str_append(&p->err_msgs, + "DBSQL->get_table() called with two or more " + "incompatible queries", (char*)0); + p->rc = DBSQL_ERROR; + return DBSQL_ERROR; + } + + /* + * Copy over the row data. + */ + if (argv != 0) { + for (i = 0; i < ncol; i++) { + if (argv[i] == 0) { + z = 0; + } else { + if (__dbsql_malloc(NULL, strlen(argv[i]) + 1, + &z) == ENOMEM) { + p->rc = DBSQL_NOMEM; + return DBSQL_ERROR; + } + strcpy(z, argv[i]); + } + p->result[p->num_data++] = z; + } + p->num_row++; + } + return DBSQL_SUCCESS; +} + +/* + * __api_get_table -- + * Query the database. But instead of invoking a callback for each row, + * __dbsql_malloc() space to hold the result and return the entire results + * at the conclusion of the call. + * The result that is written to ***results is held in memory obtained + * from __dbsql_malloc(). But the caller cannot free this memory directly + * Instead, the entire table should be passed to DBSQL->free_table() when + * the calling procedure is finished using it. + * + * PUBLIC: int __api_get_table __P((DBSQL *, const char *, char ***, int *, + * PUBLIC: int *, char **)); + * + * dbp The database on which the SQL executes + * sql The SQL to be executed + * results Write the result table here + * nrows Write the number of rows in the result here + * ncols Write the number of columns of result here + * err_msgs Write error messages here + */ +int +__api_get_table(dbp, sql, results, nrows, ncols, err_msgs) + DBSQL *dbp; + const char *sql; + char ***results; + int *nrows; + int *ncols; + char **err_msgs; +{ + int rc; + table_result_t res; + + DBSQL_ASSERT(results); + DBSQL_ASSERT(ncols); + DBSQL_ASSERT(nrows); + + *results = 0; + *ncols = 0; + *nrows = 0; + res.err_msgs = 0; + res.num_result = 0; + res.num_row = 0; + res.num_col = 0; + res.num_data = 1; + res.num_alloc = 20; + res.rc = DBSQL_SUCCESS; + + if (__dbsql_calloc(dbp, res.num_alloc, sizeof(char*), + &res.result) == ENOMEM) + return DBSQL_NOMEM; + rc = dbp->exec(dbp, sql, __get_table_cb, &res, err_msgs); + if (rc == DBSQL_ABORT) { + /* !!! + * We set this here because we're about to call free_table, but we + * have to set it again below because a realloc may have moved the + * memory around + */ + res.result[0] = res.result[1] + res.num_data; + dbp->free_table(&res.result[1]); + if (res.err_msgs) { + if(err_msgs) { + __dbsql_ufree(dbp, *err_msgs); + *err_msgs = res.err_msgs; + __str_urealloc(err_msgs); + } else { + __dbsql_free(dbp, res.err_msgs); + } + } + return res.rc; + } + __dbsql_free(dbp, res.err_msgs); + if (rc != DBSQL_SUCCESS) { + dbp->free_table(&res.result[1]); + return rc; + } + if (res.num_alloc > res.num_data) { + if(__dbsql_realloc(dbp, sizeof(char*) * (res.num_data + 1), + &res.result) == ENOMEM) { + dbp->free_table(&res.result[1]); + return DBSQL_NOMEM; + } + res.num_alloc = res.num_data + 1; + } + /* !!! + * free_table() will need to know when to stop freeing results. We use result[0] + * as a pointer to the last allocated row to be free'd. The number of rows to + * be free'd is 'result[0] - (&result[1])'. + */ + res.result[0] = res.result[1] + res.num_data; + *results = &res.result[1]; + if (ncols) + *ncols = res.num_col; + if (nrows) + *nrows = res.num_row; + return rc; +} + +/* + * __api_free_table -- + * This routine frees the space the DBSQL->get_table() __dbsql_malloc'ed. + * There are two things to be free'd, (a) each row (results[0..n]) and then (b) the + * array 'results'. The number of rows to be free'd is 'result[-1] - (&result[0])'. + * + * PUBLIC: void __api_free_table __P((char **)); + * + * result Result returned from from __api_get_table() + */ +void +__api_free_table(results) + char **results; +{ + char *last_result; + + DBSQL_ASSERT(results); + + /* If this test is false then the result set is empty, only free (b) */ + if (*(results - 1) != *results) { + /* !!! + * The address of the last results row is the value of the first element of + * the results array we created in get_table() but recall that we passed + * the address of the second element (&results[1]) to the user and so + * we need to read the memory of what used to be 'results[0]' which is + * now '*(results - 1)'. + */ + last_result = *(results - 1); + while (*results <= last_result) { + if (*results != NULL) + __dbsql_ufree(NULL, *results); + results++; + } + } + __dbsql_ufree(NULL, results); +} diff --git a/src/cg_attach.c b/src/cg_attach.c new file mode 100644 index 0000000..0e5dc67 --- /dev/null +++ b/src/cg_attach.c @@ -0,0 +1,394 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_attach.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains C code routines that are called by the parser + * to handle ATTACH and DETACH statements. + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +/* + * __attach -- + * This routine is called by the parser to process an ATTACH statement: + * + * ATTACH DATABASE filename AS dbname + * + * The 'file' and 'db' arguments are the tokens that define the + * 'file' and 'db' in the ATTACH statement. + * + * PUBLIC: void __attach __P((parser_t *, token_t *, token_t *)); + */ +void +__attach(parser, file, db) + parser_t *parser; + token_t *file; + token_t *db; +{ + int rc, i; + dbsql_db_t *new; + char *filename, *databasename; + DBSQL *dbp; + vdbe_t *v; + + v = __parser_get_vdbe(parser); + __vdbe_add_op(v, OP_Halt, 0, 0); + if (parser->explain) + return; + dbp = parser->db; + if (dbp->format_version < 1) { + __error_msg(parser, "cannot attach auxiliary databases to an " + "older format master database", 0); + parser->rc = DBSQL_ERROR; + return; + } + if (dbp->nDb >= (MAX_ATTACHED + 2)) { + __error_msg(parser, "too many attached databases - max %d", + MAX_ATTACHED); + parser->rc = DBSQL_ERROR; + return; + } + + filename = 0; + __str_nappend(&filename, file->z, file->n, NULL); + if (filename == 0) + return; + __str_unquote(filename); +#ifndef DBSQL_NO_AUTH + if (__auth_check(parser, DBSQL_ATTACH, filename, 0, 0) != + DBSQL_SUCCESS) { + __dbsql_free(dbp, filename); + return; + } +#endif /* DBSQL_NO_AUTH */ + + databasename = 0; + __str_nappend(&databasename, db->z, db->n, NULL); + if (databasename == 0) + return; + __str_unquote(databasename); + for (i = 0; i < dbp->nDb; i++) { + if (dbp->aDb[i].zName && strcasecmp( + dbp->aDb[i].zName, databasename) == 0) { + __error_msg(parser, "database %z is already in use", + databasename); + parser->rc = DBSQL_ERROR; + __dbsql_free(dbp, filename); + return; + } + } + + if (__dbsql_realloc(dbp, (sizeof(dbp->aDb[0]) * + (dbp->nDb + 1)), &dbp->aDb) == ENOMEM) + return; + new = &dbp->aDb[(dbp->nDb++)]; + memset(new, 0, sizeof(*new)); + if (__sqldb_init(new, dbp, filename, 0, 0, 1) != 0) { + __error_msg(parser, "unable to open database: %s", filename); + } + new->zName = databasename; + __dbsql_free(dbp, filename); + dbp->flags &= ~DBSQL_Initialized; + if (parser->nErr) + return; + if (rc == DBSQL_SUCCESS) { + rc = __init_databases(parser->db, &parser->zErrMsg); + } + if (rc) { + i = dbp->nDb - 1; + DBSQL_ASSERT(i >= 2); + if (dbp->aDb[i].pBt) { + __sm_close_db(dbp->aDb[i].pBt); + dbp->aDb[i].pBt = 0; + } + __reset_internal_schema(dbp, 0); + parser->nErr++; + parser->rc = DBSQL_ERROR; + } +} + +/* + * __detach -- + * This routine is called by the parser to process a DETACH statement: + * + * DETACH DATABASE db + * + * The db argument is the name of the database in the DETACH statement. + * + * PUBLIC: void __detach __P((parser_t *, token_t *)); + */ +void +__detach(parser, db) + parser_t *parser; + token_t *db; +{ + int i; + DBSQL *dbp; + vdbe_t *v = __parser_get_vdbe(parser); + __vdbe_add_op(v, OP_Halt, 0, 0); + if (parser->explain) + return; + dbp = parser->db; + for (i = 0; i < dbp->nDb; i++) { + if (dbp->aDb[i].pBt == 0 || + dbp->aDb[i].zName == 0) + continue; + if (strlen(dbp->aDb[i].zName) != db->n) + continue; + if (strncasecmp(dbp->aDb[i].zName, db->z, db->n) == 0) + break; + } + if (i >= dbp->nDb) { + __error_msg(parser, "no such database: %T", db); + return; + } + if (i < 2) { + __error_msg(parser, "cannot detach database %T", db); + return; + } +#ifndef DBSQL_NO_AUTH + if (__auth_check(parser, DBSQL_DETACH, dbp->aDb[i].zName, 0, 0) != + DBSQL_SUCCESS) { + return; + } +#endif /* DBSQL_NO_AUTH */ + __sm_close_db(dbp->aDb[i].pBt); + dbp->aDb[i].pBt = 0; + __dbsql_free(dbp, dbp->aDb[i].zName); + __reset_internal_schema(dbp, i); + dbp->nDb--; + if (i < dbp->nDb) { + dbp->aDb[i] = dbp->aDb[dbp->nDb]; + memset(&dbp->aDb[dbp->nDb], 0, sizeof(dbp->aDb[0])); + __reset_internal_schema(dbp, i); + } +} + +/* + * __ref_normalizer_ctx_init -- + * Initialize a ref_normalizer_ctx_t structure. This routine must be + * called prior to passing the structure to one of the + * __ref_normalize_XXX() routines below. The return value indicates + * whether or not normalization is required. TRUE means we do need to + * fix the database references, FALSE means we do not. + * + * PUBLIC: int __ref_normalizer_ctx_init __P((ref_normalizer_ctx_t *, + * PUBLIC: parser_t *, int, const char *, + * PUBLIC: const token_t *)); + * + * normctx The normalizer to be initialized + * parser Error messages will be written here + * dbnum This is the database that must must be used + * type "view", "trigger", or "index" + * name Name of the view, trigger, or index + */ +int +__ref_normalizer_ctx_init(normctx, parser, dbnum, type, name) + ref_normalizer_ctx_t *normctx; + parser_t *parser; + int dbnum; + const char *type; + const token_t *name; +{ + DBSQL *dbp; + + if (dbnum < 0 || dbnum == 1) + return 0; + dbp = parser->db; + DBSQL_ASSERT(dbp->nDb > dbnum); + normctx->pParse = parser; + normctx->zDb = dbp->aDb[dbnum].zName; + normctx->zType = type; + normctx->pName = name; + return 1; +} + +/* + * __ref_normalize_src_list -- + * The following set of routines walk through the parse tree and assign + * a specific database to all table references where the database name + * was left unspecified in the original SQL statement. The normctx + * structure must have been initialized by a prior call to + * __ref_normalizer_ctx_init(). + * + * These routines are used to make sure that an index, trigger, or + * view in one database does not refer to objects in a different database. + * (Exception: indices, triggers, and views in the TEMP database are + * allowed to refer to anything.) If a reference is explicitly made + * to an object in a different database, an error message is added to + * parser->zErrMsg and these routines return non-zero. If everything + * checks out, these routines return 0. + * + * PUBLIC: int __ref_normalize_src_list __P((ref_normalizer_ctx_t *, + * PUBLIC: src_list_t *)); + * + * normctx Context of the normalization + * src_list The source list to check and modify + */ +int __ref_normalize_src_list(normctx, src_list) + ref_normalizer_ctx_t *normctx; + src_list_t *src_list; +{ + int i; + const char *db; + DBSQL *dbp = normctx->pParse->db; + + if (src_list == 0) + return 0; + db = normctx->zDb; + for (i = 0; i < src_list->nSrc; i++) { + if (src_list->a[i].zDatabase == 0) { + __dbsql_strdup(dbp, db, &src_list->a[i].zDatabase); + } else if (strcasecmp(src_list->a[i].zDatabase, db) != 0) { + char *name; + __dbsql_strndup(dbp, normctx->pName->z, &name, + normctx->pName->n); + __error_msg(normctx->pParse, "%s %z cannot reference " + "objects in database %s", normctx->zType, + name, src_list->a[i].zDatabase); + return 1; + } + if (__ref_normalize_select(normctx, src_list->a[i].pSelect)) + return 1; + if (__ref_normalize_expr(normctx, src_list->a[i].pOn)) + return 1; + } + return 0; +} + +/* + * __ref_normalize_select -- + * + * PUBLIC: int __ref_normalize_select __P((ref_normalizer_ctx_t *, + * PUBLIC: select_t *)); + * + * normctx Context of the normalization + * select The SELECT statement to be fixed to one + * database + */ +int +__ref_normalize_select(normctx, select) + ref_normalizer_ctx_t *normctx; + select_t *select; +{ + while (select) { + if (__ref_normalize_expr_list(normctx, select->pEList)) { + return 1; + } + if (__ref_normalize_src_list(normctx, select->pSrc)) { + return 1; + } + if (__ref_normalize_expr(normctx, select->pWhere)) { + return 1; + } + if (__ref_normalize_expr(normctx, select->pHaving)) { + return 1; + } + select = select->pPrior; + } + return 0; +} + + +/* + * __ref_normalize_expr -- + * + * PUBLIC: int __ref_normalize_expr __P((ref_normalizer_ctx_t *, + * PUBLIC: expr_t *)); + * + * normctx Context of the normalization + * expr The expr_t to be fixed to one database + */ +int __ref_normalize_expr(normctx, expr) + ref_normalizer_ctx_t *normctx; + expr_t *expr; +{ + while (expr) { + if (__ref_normalize_select(normctx, expr->pSelect)) { + return 1; + } + if (__ref_normalize_expr_list(normctx, expr->pList)) { + return 1; + } + if (__ref_normalize_expr(normctx, expr->pRight)) { + return 1; + } + expr = expr->pLeft; + } + return 0; +} + +/* + * __ref_normalize_expr_list -- + * + * PUBLIC: int __ref_normalize_expr_list __P((ref_normalizer_ctx_t *, + * PUBLIC: expr_list_t *)); + * + * normctx Context of the normalization + * expr The expression to be fixed to one database + */ +int +__ref_normalize_expr_list(normctx, list) + ref_normalizer_ctx_t *normctx; + expr_list_t *list; +{ + int i; + if (list == 0) + return 0; + for (i = 0; i < list->nExpr; i++) { + if (__ref_normalize_expr(normctx, list->a[i].pExpr)) { + return 1; + } + } + return 0; +} + +/* + * __ref_normalize_trigger_step -- + * + * PUBLIC: int __ref_normalize_trigger_step __P((ref_normalizer_ctx_t *, + * PUBLIC: trigger_step_t *)); + * + * normctx Context of the normalization + * expr The trigger step to be fixed to one database + */ +int __ref_normalize_trigger_step(normctx, step) + ref_normalizer_ctx_t *normctx; + trigger_step_t *step; +{ + while (step) { + if (__ref_normalize_select(normctx, step->pSelect)) { + return 1; + } + if (__ref_normalize_expr(normctx, step->pWhere)) { + return 1; + } + if (__ref_normalize_expr_list(normctx, step->pExprList)) { + return 1; + } + step = step->pNext; + } + return 0; +} diff --git a/src/cg_auth.c b/src/cg_auth.c new file mode 100644 index 0000000..c5f9009 --- /dev/null +++ b/src/cg_auth.c @@ -0,0 +1,285 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_auth.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains code used to implement the __api_set_auth_callback() + * API. This facility is an optional feature of the library. Embedded + * systems that do not need this facility may omit it by reconfiguring + * with '--disable-auth'. Then recompile the entire library. + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +#ifndef DBSQL_OMIT_AUTHORIZATION + +/* + * Set or clear the access authorization function. + * The access authorization function is be called during the compilation + * phase to verify that the user has read and/or write access permission + * on various fields of the database. The first argument to the auth + * function is a copy of the 3rd argument to this routine. The second + * argument to the auth function is one of these constants: + * + * DBSQL_COPY + * DBSQL_CREATE_INDEX + * DBSQL_CREATE_TABLE + * DBSQL_CREATE_TEMP_INDEX + * DBSQL_CREATE_TEMP_TABLE + * DBSQL_CREATE_TEMP_TRIGGER + * DBSQL_CREATE_TEMP_VIEW + * DBSQL_CREATE_TRIGGER + * DBSQL_CREATE_VIEW + * DBSQL_DELETE + * DBSQL_DROP_INDEX + * DBSQL_DROP_TABLE + * DBSQL_DROP_TEMP_INDEX + * DBSQL_DROP_TEMP_TABLE + * DBSQL_DROP_TEMP_TRIGGER + * DBSQL_DROP_TEMP_VIEW + * DBSQL_DROP_TRIGGER + * DBSQL_DROP_VIEW + * DBSQL_INSERT + * DBSQL_PRAGMA + * DBSQL_READ + * DBSQL_SELECT + * DBSQL_TRANSACTION + * DBSQL_UPDATE + * + * The third and fourth arguments to the auth function are the name of + * the table and the column that are being accessed. The auth function + * should return either DBSQL_SUCCESS, DBSQL_DENY, or DBSQL_IGNORE. If + * DBSQL_SUCCESS is returned, it means that access is allowed. DBSQL_DENY + * means that the SQL statement will never-run - the dbsql_exec() call + * will return with an error. DBSQL_IGNORE means that the SQL statement + * should run but attempts to read the specified column will return NULL + * and attempts to write the column will be ignored. + * + * Setting the auth function to NULL disables this hook. The default + * setting of the auth function is NULL. + * + * PUBLIC: int __api_set_authorizer __P((DBSQL *, + * PUBLIC: int (*auth)(void*,int,const char*, const char*,const char*, + * PUBLIC: const char*), void *)); + */ +int __api_set_authorizer(dbp, auth, arg) + DBSQL *dbp; + int (*auth)(void*,int,const char*,const char*,const char*,const char*); + void *arg; +{ + dbp->auth = auth; + dbp->pAuthArg = arg; + return DBSQL_SUCCESS; +} + +/* + * __auth_bad_return_code -- + * Write an error message into pParse->zErrMsg that explains that the + * user-supplied authorization function returned an illegal value. + * + * STATIC: static void __auth_bad_return_code __P((parser_t *, int)); + */ +static void +__auth_bad_return_code(parser, rc) + parser_t *parser; + int rc; +{ + char buf[20]; + sprintf(buf, "(%d)", rc); + __str_append(&parser->zErrMsg, "illegal return value ", + buf, " from the authorization function - ", + "should be DBSQL_SUCCESS, DBSQL_IGNORE, or DBSQL_DENY", + (char*)0); + parser->nErr++; + parser->rc = DBSQL_MISUSE; +} + +/* + * __auth_read -- + * The 'expr' should be a TK_COLUMN expression. The table referred to + * is in 'tab_list' or else it is the NEW or OLD table of a trigger. + * Check to see if it is OK to read this particular column. + * + * If the auth function returns DBSQL_IGNORE, change the TK_COLUMN + * instruction into a TK_NULL. If the auth function returns DBSQL_DENY, + * then generate an error. + * + * PUBLIC: void __auth_read __P((parser_t *, expr_t *, src_list_t *)); + * + * parser The parser context + * expr The expression to check authorization on + * tab_list All table that expr might refer to + */ +void +__auth_read(parser, expr, tab_list) + parser_t *parser; + expr_t *expr; + src_list_t *tab_list; +{ + int rc; + DBSQL *dbp = parser->db; + table_t *table; /* The table being read */ + const char *col; /* Name of the column of the table */ + int src; /* Index in tab_list->a[] of table being read */ + const char *databasename; /* Name of database being accessed */ + trigger_stack_t *stack; /* The stack of current triggers */ + + if (dbp->auth == 0) + return; + DBSQL_ASSERT(expr->op == TK_COLUMN); + for (src = 0; src < tab_list->nSrc; src++) { + if (expr->iTable == tab_list->a[src].iCursor) + break; + } + if (src >= 0 && src < tab_list->nSrc) { + table = tab_list->a[src].pTab; + } else { + /* + * This must be an attempt to read the NEW or OLD pseudo-tables + * of a trigger. + */ + stack = parser->trigStack; + DBSQL_ASSERT(stack != 0); + DBSQL_ASSERT(expr->iTable == stack->newIdx || + expr->iTable == stack->oldIdx); + table = stack->pTab; + } + if (table == 0) + return; + if (expr->iColumn >= 0) { + DBSQL_ASSERT(expr->iColumn < table->nCol); + col = table->aCol[expr->iColumn].zName; + } else if (table->iPKey >= 0) { + DBSQL_ASSERT(table->iPKey < table->nCol); + col = table->aCol[table->iPKey].zName; + } else { + col = "ROWID"; + } + DBSQL_ASSERT(expr->iDb < dbp->nDb); + databasename = dbp->aDb[expr->iDb].zName; + rc = dbp->auth(dbp->pAuthArg, DBSQL_READ, table->zName, + col, databasename, parser->zAuthContext); + if (rc == DBSQL_IGNORE) { + expr->op = TK_NULL; + } else if (rc == DBSQL_DENY) { + if (dbp->nDb > 2 || expr->iDb != 0) { + __str_append(&parser->zErrMsg,"access to ", + databasename, ".", table->zName, ".", + col, " is prohibited", (char*)0); + } else { + __str_append(&parser->zErrMsg,"access to ", + table->zName, ".", col, " is prohibited", + (char*)0); + } + parser->nErr++; + parser->rc = DBSQL_AUTH; + } else if (rc != DBSQL_SUCCESS) { + __auth_bad_return_code(parser, rc); + } +} + +/* + * __auth_check -- + * Do an authorization check using the code and arguments given. Return + * either DBSQL_SUCCESS (zero) or DBSQL_IGNORE or DBSQL_DENY. If + * DBSQL_DENY is returned, then the error count and error message in + * parser are modified appropriately. + * + * PUBLIC: int __auth_check __P((parser_t *, int, const char *, const char *, + * PUBLIC: const char *)); + */ +int +__auth_check(parser, code, arg1, arg2, arg3) + parser_t *parser; + int code; + const char *arg1; + const char *arg2; + const char *arg3; +{ + int rc; + DBSQL *dbp = parser->db; + + if (dbp->auth == 0) { + return DBSQL_SUCCESS; + } + rc = dbp->auth(dbp->pAuthArg, code, arg1, arg2, arg3, + parser->zAuthContext); + if (rc == DBSQL_DENY) { + __str_append(&parser->zErrMsg, "not authorized", + (char*)0); + parser->rc = DBSQL_AUTH; + parser->nErr++; + } else if (rc != DBSQL_SUCCESS && rc != DBSQL_IGNORE) { + rc = DBSQL_DENY; + __auth_bad_return_code(parser, rc); + } + return rc; +} + +/* + * __auth_context_push -- + * Push an authorization context. After this routine is called, the + * arg3 argument to authorization callbacks will be context until + * popped. Or if parser==0, this routine is a no-op. + * + * PUBLIC: void __auth_context_push __P((parser_t *, auth_context_t *, + * PUBLIC: const char *)); + */ +void __auth_context_push(parser, authctx, context) + parser_t *parser; + auth_context_t *authctx; + const char *context; +{ + authctx->pParse = parser; + if (parser) { + authctx->zAuthContext = parser->zAuthContext; + parser->zAuthContext = context; + } +} + +/* + * __auth_context_pop -- + * Pop an authorization context that was previously pushed + * by __auth_context_push. + * + * PUBLIC: void __auth_context_pop __P((auth_context_t *)); + */ +void +__auth_context_pop(authctx) + auth_context_t *authctx; +{ + if (authctx->pParse) { + authctx->pParse->zAuthContext = authctx->zAuthContext; + authctx->pParse = 0; + } +} + +#else + +/* TODO what is the difference between DBSQL_OMIT_AUTHORIZATION and + DBSQL_NO_AUTH? Which one should be used here? Setup a test case for this.*/ + +# define __auth_check(a,b,c,d,e) DBSQL_SUCCESS + +#endif /* !defined(DBSQL_OMIT_AUTHORIZATION) */ diff --git a/src/cg_build.c b/src/cg_build.c new file mode 100644 index 0000000..6b897ea --- /dev/null +++ b/src/cg_build.c @@ -0,0 +1,2797 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_build.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains C code routines that are called by the SQLite parser + * when syntax rules are reduced. The routines in this file handle the + * following kinds of SQL syntax: + * + * CREATE TABLE + * DROP TABLE + * CREATE INDEX + * DROP INDEX + * creating ID lists + * BEGIN TRANSACTION + * COMMIT + * ROLLBACK + * PRAGMA + * + */ + +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "dbsql_int.h" + + +/* + * __parse_begin -- + * This routine is called when a new SQL statement is beginning to + * be parsed. Check to see if the schema for the database needs + * to be read from the DBSQL_MASTER and DBSQL_TEMP_MASTER tables. + * If it does, then read it. + * + * PUBLIC: void __parse_begin __P((parser_t *, int)); + */ +void +__parse_begin(parser, explain_flag) + parser_t *parser; + int explain_flag; +{ + DBSQL *dbp = parser->db; + int i; + parser->explain = explain_flag; + if ((dbp->flags & DBSQL_Initialized) == 0 && parser->initFlag == 0) { + int rc = __init_databases(dbp, &parser->zErrMsg); + if (rc != DBSQL_SUCCESS) { + parser->rc = rc; + parser->nErr++; + } + } + for (i = 0; i < dbp->nDb; i++) { + DB_PROPERTY_CLEAR(dbp, i, DBSQL_SCHEMA_LOCKED); + if (!dbp->aDb[i].inTrans ) { + DB_PROPERTY_CLEAR(dbp, i, DBSQL_COOKIE); + } + } + parser->nVar = 0; +} + +/* + * __null_callback -- + * This is a fake callback procedure used when dbsql_exec() is + * invoked with a NULL callback pointer. If we pass a NULL callback + * pointer into __vdbe_exec() it will return at every OP_Callback, + * which we do not want it to do. So we substitute a pointer to this + * procedure in place of the NULL. + * + * STATIC: static int __null_callback __P((void *, int , char **, char **)); + */ +static int +__null_callback(not_used, n, a, b) + void *not_used; + int n; + char **a; + char **b; +{ + return 0; +} + +/* + * __parse_exec -- + * This routine is called after a single SQL statement has been + * parsed and we want to execute the VDBE code to implement + * that statement. Prior action routines should have already + * constructed VDBE code to do the work of the SQL statement. + * This routine just has to execute the VDBE code. + * Note that if an error occurred, it might be the case that + * no VDBE code was generated. + * + * PUBLIC: void __parse_exec __P((parser_t *)); + */ +void +__parse_exec(parser) + parser_t *parser; +{ + int rc = DBSQL_SUCCESS; + DBSQL *dbp = parser->db; + vdbe_t *v = parser->pVdbe; + int (*callback)(void*,int,char**,char**); + + if (parser->rc == ENOMEM) + return; + callback = parser->xCallback; + if (callback == 0 && parser->useCallback) + callback = __null_callback; + if (v && parser->nErr==0) { + FILE *trace; + if ((dbp->flags & DBSQL_VdbeTrace) != 0) { + trace = stdout; + } else { + trace = 0; + } + __vdbe_trace(v, trace); + __vdbe_make_ready(v, parser->nVar, callback, parser->pArg, + parser->explain); + if (parser->useCallback) { + if (parser->explain) { + rc = __vdbe_list(v); + dbp->next_sig = dbp->aDb[0].schema_sig; + } else { + __vdbe_exec(v); + } + rc = __vdbe_finalize(v, &parser->zErrMsg); + if (rc) + parser->nErr++; + parser->pVdbe = 0; + parser->rc = rc; + if (rc) + parser->nErr++; + } else { + parser->rc = parser->nErr ? DBSQL_ERROR : DBSQL_DONE; + } + parser->colNamesSet = 0; + } else if (parser->useCallback == 0) { + parser->rc = DBSQL_ERROR; + } + parser->nTab = 0; + parser->nMem = 0; + parser->nSet = 0; + parser->nAgg = 0; + parser->nVar = 0; +} + +/* + * __find_table -- + * Locate the in-memory structure that describes + * a particular database table given the name + * of that table and (optionally) the name of the database + * containing the table. Return NULL if not found. + * If 'database' is 0, all databases are searched for the + * table and the first matching table is returned. (No checking + * for duplicate table names is done.) The search order is + * TEMP first, then MAIN, then any auxiliary databases added + * using the ATTACH command. + * NOTE: See also __locate_table(). + * + * PUBLIC: table_t *__find_table __P((DBSQL *, const char *, + * PUBLIC: const char *)); + */ +table_t * +__find_table(dbp, name, database) + DBSQL *dbp; + const char *name; + const char *database; +{ + table_t *p = 0; + int i; + for (i = 0; i < dbp->nDb; i++) { + int j = (i < 2) ? i^1 : i; /* Search TEMP before MAIN */ + if (database != 0 && + strcasecmp(database, dbp->aDb[j].zName)) + continue; + p = __hash_find(&dbp->aDb[j].tblHash, name, strlen(name) + 1); + if (p) + break; + } + return p; +} + +/* + * __locate_table -- + * Locate the in-memory structure that describes + * a particular database table given the name + * of that table and (optionally) the name of the database + * containing the table. Return NULL if not found. + * Also leave an error message in parser->err_msgs. + * The difference between this routine and __find_table() + * is that this routine leaves an error message in parser->err_msgs + * where __find_table() does not. + * + * PUBLIC: table_t *__locate_table __P((parser_t *, const char *, + * PUBLIC: const char *)); + */ +table_t * +__locate_table(parser, name, database) + parser_t *parser; + const char *name; + const char *database; +{ + table_t *p; + + p = __find_table(parser->db, name, database); + if (p == 0) { + if (database) { + __error_msg(parser, "no such table: %s.%s", + database, name); + } else if (__find_table(parser->db, name, 0) != 0) { + __error_msg(parser, "table \"%s\" is not in " + "database \"%s\"", name, database); + } else { + __error_msg(parser, "no such table: %s", name); + } + } + return p; +} + +/* + * __find_index -- + * Locate the in-memory structure that describes + * a particular index given the name of that index + * and the name of the database that contains the index. + * Return NULL if not found. + * If 'database' is 0, all databases are searched for the + * table and the first matching index is returned. (No checking + * for duplicate index names is done.) The search order is + * TEMP first, then MAIN, then any auxiliary databases added + * using the ATTACH command. + * + * PUBLIC: index_t *__find_index __P((DBSQL *, const char *, + * PUBLIC: const char *)); + */ +index_t * +__find_index(dbp, name, database) + DBSQL *dbp; + const char *name; + const char *database; +{ + index_t *p = 0; + int i; + for (i = 0; i < dbp->nDb; i++) { + int j = (i < 2) ? i^1 : i; /* Search TEMP before MAIN */ + if (database && + strcasecmp(database, dbp->aDb[j].zName)) + continue; + p = __hash_find(&dbp->aDb[j].idxHash, name, strlen(name)+1); + if (p) + break; + } + return p; +} + +/* + * __delete_index + * Remove the given index from the index hash table, and __dbsql_free + * its memory structures. + * The index is removed from the database hash tables but + * it is not unlinked from the table_t that it indexes. + * Unlinking from the table_t must be done by the calling function. + * + * STATIC: static void __delete_index __P((DBSQL *, index_t *)); + */ +static void +__delete_index(dbp, index) + DBSQL *dbp; + index_t *index; +{ + index_t *old; + + DBSQL_ASSERT(dbp != 0 && index->zName != 0); + old = __hash_insert(&dbp->aDb[index->iDb].idxHash, index->zName, + strlen(index->zName) + 1, 0); + if (old != 0 && old != index) { + __hash_insert(&dbp->aDb[index->iDb].idxHash, old->zName, + strlen(old->zName) + 1, old); + } + __dbsql_free(dbp, index); +} + +/* + * __unlink_and_delete_index -- + * Unlink the given index from its table, then remove + * the index from the index hash table and __dbsql_free its memory + * structures. + * + * PUBLIC: void __unlink_and_delete_index __P((DBSQL *, index_t *)); + */ +void +__unlink_and_delete_index(dbp, index) + DBSQL *dbp; + index_t *index; +{ + if (index->pTable->pIndex == index) { + index->pTable->pIndex = index->pNext; + } else { + index_t *i = index->pTable->pIndex; + while (i && i->pNext != index) { + index = index->pNext; + } + if (i && i->pNext == index) { + i->pNext = index->pNext; + } + } + __delete_index(dbp, index); +} + +/* + * __reset_internal_schema -- + * Erase all schema information from the in-memory hash tables of + * database connection. This routine is called to reclaim memory + * before the connection closes. It is also called during a rollback + * if there were schema changes during the transaction. + * If idb <= 0 then reset the internal schema tables for all database + * files. If idb > =2 then reset the internal schema for only the + * single file indicated. + * + * PUBLIC: void __reset_internal_schema __P((DBSQL *, int)); + */ +void +__reset_internal_schema(dbp, idb) + DBSQL *dbp; + int idb; +{ + hash_ele_t *ele; + hash_t temp1; + hash_t temp2; + int i, j; + + DBSQL_ASSERT(idb >= 0 && idb < dbp->nDb); + dbp->flags &= ~DBSQL_Initialized; + for (i = idb; i < dbp->nDb; i++) { + dbsql_db_t *d = &dbp->aDb[i]; + temp1 = d->tblHash; + temp2 = d->trigHash; + __hash_init(&d->trigHash, DBSQL_HASH_STRING, 0); + __hash_clear(&d->aFKey); + __hash_clear(&d->idxHash); + for (ele = __hash_first(&temp2); ele; ele = __hash_next(ele)) { + trigger_t *trigger = __hash_data(ele); + __vdbe_delete_trigger(trigger); + } + __hash_clear(&temp2); + __hash_init(&d->tblHash, DBSQL_HASH_STRING, 0); + for (ele = __hash_first(&temp1); ele; ele = __hash_next(ele)) { + table_t *t = __hash_data(ele); + __vdbe_delete_table(dbp, t); + } + __hash_clear(&temp1); + DB_PROPERTY_CLEAR(dbp, i, DBSQL_SCHEMA_LOADED); + if (idb > 0) + return; + } + DBSQL_ASSERT(idb == 0); + dbp->flags &= ~DBSQL_InternChanges; + + /* + * If one or more of the auxiliary database files has been + * closed, then remove then from the auxiliary database + * list. We take the opportunity to do this here since we + * have just deleted all of the schema hash tables and + * therefore do not have to make any changes to any of those + * tables. + */ + for (i = j = 2; i < dbp->nDb; i++) { + if (dbp->aDb[i].pBt == 0) { + __dbsql_free(dbp, dbp->aDb[i].zName); + dbp->aDb[i].zName = 0; + continue; + } + if (j < i) { + dbp->aDb[j] = dbp->aDb[i]; + } + j++; + } + memset(&dbp->aDb[j], 0, ((dbp->nDb - j) * sizeof(dbp->aDb[j]))); + dbp->nDb = j; +} + +/* + * __rollback_internal_changes -- + * This routine is called whenever a rollback occurs. If there were + * schema changes during the transaction, then we have to reset the + * internal hash tables and reload them from disk. + * + * PUBLIC: void __rollback_internal_changes __P((DBSQL *)); + */ +void +__rollback_internal_changes(dbp) + DBSQL *dbp; +{ + if (dbp->flags & DBSQL_InternChanges) { + __reset_internal_schema(dbp, 0); + } +} + +/* + * __commit_internal_changes -- + * This routine is called when a commit occurs. + * + * PUBLIC: void __commit_internal_changes __P((DBSQL *)); + */ +void +__commit_internal_changes(dbp) + DBSQL *dbp; +{ + dbp->aDb[0].schema_sig = dbp->next_sig; + dbp->flags &= ~DBSQL_InternChanges; +} + +/* + * __vdbe_delete_table -- + * Remove the memory data structures associated with the given + * table_t. No changes are made to disk by this routine. + * This routine just deletes the data structure. It does not unlink + * the table data structure from the hash table. Nor does it remove + * foreign keys from the aFKey hash table. But it does destroy + * memory structures of the indices and foreign keys associated with + * the table. + * Indices associated with the table are unlinked from the "db" + * data structure if db!=NULL. If db==NULL, indices attached to + * the table are deleted, but it is assumed they have already been + * unlinked. + * + * PUBLIC: void __vdbe_delete_table __P((DBSQL *, table_t *)); + */ +void +__vdbe_delete_table(dbp, table) + DBSQL *dbp; + table_t *table; +{ + int i; + index_t *index, *next; + foreign_key_t *fkey, *next_fkey; + + if (table == 0) + return; + + /* + * Delete all indices associated with this table. + */ + for (index = table->pIndex; index; index = next) { + next = index->pNext; + DBSQL_ASSERT(index->iDb == table->iDb || + (table->iDb == 0 && index->iDb == 1)); + __delete_index(dbp, index); + } + + /* + * Delete all foreign keys associated with this table. The keys + * should have already been unlinked from the dbp->aFKey hash table + */ + for (fkey = table->pFKey; fkey; fkey = next_fkey) { + next_fkey = fkey->pNextFrom; + DBSQL_ASSERT(table->iDb < dbp->nDb); + DBSQL_ASSERT(__hash_find(&dbp->aDb[table->iDb].aFKey, + fkey->zTo, strlen(fkey->zTo) + 1) != fkey); + __dbsql_free(dbp, fkey); + } + + /* + * Delete the table_t structure itself. + */ + for (i = 0; i < table->nCol; i++) { + __dbsql_free(dbp, table->aCol[i].zName); + __dbsql_free(dbp, table->aCol[i].zDflt); + __dbsql_free(dbp, table->aCol[i].zType); + } + __dbsql_free(dbp, table->zName); + __dbsql_free(dbp, table->aCol); + __select_delete(table->pSelect); + __dbsql_free(dbp, table); +} + +/* + * __unlink_and_delete_table -- + * Unlink the given table from the hash tables and the delete the + * table structure with all its indices and foreign keys. + * + * STATIC: static void __unlink_and_delete_table __P((DBSQL, table_t *)); + */ +static void +__unlink_and_delete_table(dbp, table) + DBSQL *dbp; + table_t *table; +{ + table_t *old; + foreign_key_t *f1, *f2; + int i = table->iDb; + DBSQL_ASSERT(dbp != 0); + old = __hash_insert(&dbp->aDb[i].tblHash, table->zName, + strlen(table->zName) + 1, 0); + DBSQL_ASSERT(old == 0 || old == table); + for (f1 = table->pFKey; f1; f1 = f1->pNextFrom) { + int n_to = strlen(f1->zTo) + 1; + f2 = __hash_find(&dbp->aDb[i].aFKey, f1->zTo, n_to); + if (f2 == f1) { + __hash_insert(&dbp->aDb[i].aFKey, f1->zTo, n_to, + f1->pNextTo); + } else { + while (f2 && f2->pNextTo != f1) { + f2 = f2->pNextTo; + } + if (f2) { + f2->pNextTo = f1->pNextTo; + } + } + } + __vdbe_delete_table(dbp, table); +} + +/* + * __table_name_from_token -- + * Construct the name of a user table or index from a token. + * Space to hold the name is obtained from __dbsql_calloc() and must + * be freed by the calling function. + * + * PUBLIC: char *__table_name_from_token __P((token_t *)); + */ +char * +__table_name_from_token(name) + token_t *name; +{ + char *n; + __dbsql_strndup(NULL, name->z, &n, name->n); + __str_unquote(n); + return n; +} + +/* + * __open_master_table -- + * Generate code to open the appropriate master table. The table + * opened will be DBSQL_MASTER for persistent tables and + * DBSQL_TEMP_MASTER for temporary tables. The table is opened + * on cursor 0. + * + * PUBLIC: void __open_master_table __P((vdbe_t *, int)); + */ +void +__open_master_table(vdbe_t *v, int isTemp){ + __vdbe_add_op(v, OP_Integer, isTemp, 0); + __vdbe_add_op(v, OP_OpenWrite, 0, 2); +} + +/* + * __start_table -- + * Begin constructing a new table representation in memory. This is + * the first of several action routines that get called in response + * to a CREATE TABLE statement. In particular, this routine is called + * after seeing tokens "CREATE" and "TABLE" and the table name. The + * 'start' token is the CREATE and 'name' is the table name. The 'temp' + * flag is true if the table should be stored in the auxiliary database + * instead of in the main database. This is normally the case + * when the "TEMP" or "TEMPORARY" keyword occurs in between + * CREATE and TABLE. + * The new table record is initialized and put in parser->pNewTable. + * As more of the CREATE TABLE statement is parsed, additional action + * routines will be called to add more information to this record. + * At the end of the CREATE TABLE statement, the + * __ending_create_table_paren() routine is called to complete the + * construction of the new table record. + * + * PUBLIC: void __start_table __P((parser_t *, token_t *, token_t *, + * PUBLIC: int, int)); + * + * parser Parser context + * start The "CREATE" token + * name Name of table or view to create + * temp True if this is a TEMP table + * view True if this is a VIEW + */ +void __start_table(parser, start, name, temp, view) + parser_t *parser; + token_t *start; + token_t *name; + int temp; + int view; +{ + table_t *table; + index_t *idx; + char *n; + DBSQL *dbp = parser->db; + vdbe_t *v; + int idb; + + parser->sFirstToken = *start; + n = __table_name_from_token(name); + if (n == 0) + return; + if (parser->iDb == 1) + temp = 1; +#ifndef DBSQL_NO_AUTH + DBSQL_ASSERT((temp & 1) == temp); + { + int code; + char *db_name = temp ? "temp" : "main"; + if (__auth_check(parser, DBSQL_INSERT, SCHEMA_TABLE(temp), 0, + db_name)) { + __dbsql_free(dbp, n); + return; + } + if (view) { + if (temp) { + code = DBSQL_CREATE_TEMP_VIEW; + } else { + code = DBSQL_CREATE_VIEW; + } + } else { + if (temp) { + code = DBSQL_CREATE_TEMP_TABLE; + } else { + code = DBSQL_CREATE_TABLE; + } + } + if (__auth_check(parser, code, n, 0, db_name)) { + __dbsql_free(dbp, n); + return; + } + } +#endif + + + /* + * Before trying to create a temporary table, make sure the DB for + * holding temporary tables is open. + */ + if (temp && dbp->aDb[1].pBt == 0 && !parser->explain) { + int rc = __sm_create(dbp, dbp->aDb[0].zName, 1, + (F_ISSET(dbp, DBSQL_DurableTemp) == 0), + &dbp->aDb[1].pBt); + if (rc != DBSQL_SUCCESS) { + __str_append(&parser->zErrMsg, + "unable to open a temporary database " + "file for storing temporary tables", + (char*)0); + parser->nErr++; + return; + } + if (dbp->flags & DBSQL_InTrans) { /* TODO */ + rc = __sm_begin_txn(dbp->aDb[1].pBt); + if (rc != DBSQL_SUCCESS) { + __str_nappend(&parser->zErrMsg, + "unable to get a write lock on " + "the temporary database file", + NULL); + parser->nErr++; + return; + } + } + } + + /* + * Make sure the new table name does not collide with an existing + * index or table name. Issue an error message if it does. + * + * If we are re-reading the master table because of a schema + * change and a new permanent table is found whose name collides with + * an existing temporary table, that is not an error. + */ + table = __find_table(dbp, n, 0); + idb = temp ? 1 : parser->iDb; + if (table != 0 && (table->iDb == idb || !parser->initFlag)) { + __str_nappend(&parser->zErrMsg, "table ", 0, name->z, + name->n, " already exists", 0, NULL); + __dbsql_free(dbp, n); + parser->nErr++; + return; + } + if ((idx = __find_index(dbp, n, 0)) != 0 && + (idx->iDb == 0 || !parser->initFlag)) { + __str_append(&parser->zErrMsg, + "there is already an index named ", + n, (char*)0); + __dbsql_free(dbp, n); + parser->nErr++; + return; + } + if (__dbsql_calloc(dbp, 1, sizeof(table_t), &table) == ENOMEM) { + __dbsql_free(dbp, n); + return; + } + table->zName = n; + table->nCol = 0; + table->aCol = 0; + table->iPKey = -1; + table->pIndex = 0; + table->iDb = idb; + if (parser->pNewTable) + __vdbe_delete_table(dbp, parser->pNewTable); + parser->pNewTable = table; + + /* + * Begin generating the code that will insert the table record into + * the DBSQL_MASTER table. Note in particular that we must go ahead + * and allocate the record number for the table entry now. Before any + * PRIMARY KEY or UNIQUE keywords are parsed. Those keywords will + * cause indices to be created and the table record must come before + * the indices. Hence, the record number for the table must be + * allocated now. + */ + if (!parser->initFlag && (v = __parser_get_vdbe(parser)) != 0) { + __vdbe_prepare_write(parser, 0, temp); + if (!temp) { + __vdbe_add_op(v, OP_Integer, dbp->format_version, 0); + __vdbe_add_op(v, OP_SetFormatVersion, + DBSQL_FORMAT_VERSION, 0); + } + __open_master_table(v, temp); + __vdbe_add_op(v, OP_NewRecno, 0, 0); + __vdbe_add_op(v, OP_Dup, 0, 0); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_add_op(v, OP_PutIntKey, 0, 0); + } +} + +/* + * __add_column -- + * Add a new column to the table currently being constructed. + * The parser calls this routine once for each column declaration + * in a CREATE TABLE statement. __start_table() gets called + * first to get things going. Then this routine is called for each + * column. + * + * PUBLIC: void __add_column __P((parser_t *, token_t *)); + */ +void +__add_column(parser, name) + parser_t *parser; + token_t *name; +{ + table_t *table; + int i; + char *n = 0; + column_t *col; + DBSQL *dbp = parser->db; + + if ((table = parser->pNewTable) == 0) + return; + __str_nappend(&n, name->z, name->n, NULL); + if (n == 0) + return; + __str_unquote(n); + for (i = 0; i < table->nCol; i++) { + if (strcasecmp(n, table->aCol[i].zName) == 0) { + __str_append(&parser->zErrMsg, + "duplicate column name: ", n, (char*)0); + parser->nErr++; + __dbsql_free(dbp, n); + return; + } + } + if ((table->nCol & 0x7) == 0) { /* TODO ?? 0x7 ?? */ + if (__dbsql_realloc(dbp, + (table->nCol + 8) * sizeof(table->aCol[0]), + &table->aCol) == ENOMEM) + return; + } + col = &table->aCol[table->nCol]; + memset(col, 0, sizeof(table->aCol[0])); + col->zName = n; + col->sortOrder = DBSQL_SO_NUM; + table->nCol++; +} + +/* __add_not_null -- + * This routine is called by the parser while in the middle of + * parsing a CREATE TABLE statement. A "NOT NULL" constraint has + * been seen on a column. This routine sets the notNull flag on + * the column currently under construction. + * + * PUBLIC: void __add_not_null __P((parser_t *, int)); + */ +void +__add_not_null(parser, on_error) + parser_t *parser; + int on_error; +{ + table_t *table; + int i; + if ((table = parser->pNewTable) == 0) + return; + i = table->nCol - 1; + if (i >= 0) + table->aCol[i].notNull = on_error; +} + +/* + * __add_colum_type -- + * This routine is called by the parser while in the middle of + * parsing a CREATE TABLE statement. The 'first' token is the first + * token in the sequence of tokens that describe the type of the + * column currently under construction. pLast is the last token + * in the sequence. Use this information to construct a string + * that contains the typename of the column and store that string + * in 'type'. + * + * PUBLIC: void __add_column_type __P((parser_t *, token_t *, token_t *)); + */ +void +__add_column_type(parser, first, last) + parser_t *parser; + token_t *first; + token_t *last; +{ + table_t *table; + int i, j; + int n; + char *z, **pz; + column_t *col; + + if ((table = parser->pNewTable) == 0) + return; + i = table->nCol - 1; + if (i < 0) + return; + col = &table->aCol[i]; + pz = &col->zType; + n = last->n + P_TO_UINT32(last->z) - P_TO_UINT32(first->z); + __str_nappend(pz, first->z, n, NULL); + z = *pz; + if (z == 0) + return; + for(i = j = 0; z[i]; i++) { + int c = z[i]; + if (isspace(c)) + continue; + z[j++] = c; + } + z[j] = 0; + col->sortOrder = __collate_type(z, n); +} + +/* + * __add_default_value -- + * The given token is the default value for the last column added to + * the table currently under construction. If 'minus' is true, it + * means the value token was preceded by a minus sign. + * This routine is called by the parser while in the middle of + * parsing a CREATE TABLE statement. + * + * PUBLIC: void __add_default_value __P((parser_t *, token_t *, int)); + */ +void +__add_default_value(parser, val, minus) + parser_t *parser; + token_t *val; + int minus; +{ + table_t *table; + int i; + char **pz; + if ((table = parser->pNewTable) == 0) + return; + i = table->nCol - 1; + if (i < 0) + return; + pz = &table->aCol[i].zDflt; + if (minus) { + __str_nappend(pz, "-", 1, val->z, val->n, NULL); + } else { + __str_nappend(pz, val->z, val->n, NULL); + } + __str_unquote(*pz); +} + +/* + * __add_primary_key -- + * + * Designate the PRIMARY KEY for the table. 'list' is a list of names + * of columns that form the primary key. If 'list' is NULL, then the + * most recently added column of the table is the primary key. + * A table can have at most one primary key. If the table already has + * a primary key (and this is the second primary key) then create an + * error. + * If the PRIMARY KEY is on a single column whose datatype is INTEGER, + * then we will try to use that column as the row id. + * Set the table_t.iPKey field of the table under construction to be + * the index of the INTEGER PRIMARY KEY column. table_t.iPKey is set + * to -1 if there is no INTEGER PRIMARY KEY. + * If the key is not an INTEGER PRIMARY KEY, then create a unique + * index for the key. No index is created for INTEGER PRIMARY KEYs. + * TODO REMOVE THIS Exception: + * For backwards compatibility with older databases, do not do this + * if the file format version number is less than 1. + * + * PUBLIC: void __add_primary_key __P((parser_t *, id_list_t *, int)); + */ +void +__add_primary_key(parser, list, on_error) + parser_t *parser; + id_list_t *list; + int on_error; +{ + table_t *table = parser->pNewTable; + char *type = 0; + int col = -1, i; + + if (table == 0) + goto primary_key_exit; + if (table->hasPrimKey) { + __str_append(&parser->zErrMsg, "table \"", + table->zName, "\" has more than one primary key", + (char*)0); + parser->nErr++; + goto primary_key_exit; + } + table->hasPrimKey = 1; + if (list == 0) { + col = table->nCol - 1; + table->aCol[col].isPrimKey = 1; + } else { + for (i = 0; i < list->nId; i++) { + for (col = 0; col < table->nCol; col++) { + if (strcasecmp(list->a[i].zName, + table->aCol[col].zName) == 0) + break; + } + if (col < table->nCol) + table->aCol[col].isPrimKey = 1; + } + if (list->nId > 1) + col = -1; + } + if (col >= 0 && col < table->nCol) { + type = table->aCol[col].zType; + } + if (type && strcasecmp(type, "INTEGER") == 0) { + table->iPKey = col; + table->keyConf = on_error; + } else { + __create_index(parser, 0, 0, list, on_error, 0, 0); + list = 0; + } + +primary_key_exit: + __id_list_delete(list); + return; +} + +/* + * __collate_type -- + * Return the appropriate collating type given a type name. + * The collation type is text (DBSQL_SO_TEXT) if the type + * name contains the character stream "text" or "blob" or + * "clob". Any other type name is collated as numeric + * (DBSQL_SO_NUM). + * + * PUBLIC: int __collate_type __P((const char *, int)); + */ +int +__collate_type(type, ntype) + const char *type; + int ntype; +{ + int i; + for (i = 0; i < ntype - 1; i++) { + switch(type[i]) { + case 'b': /* FALLTHROUGH */ + case 'B': + if (i < ntype - 3 && + strncasecmp(&type[i], "blob", 4) == 0) { + return DBSQL_SO_TEXT; + } + break; + case 'c': /* FALLTHROUGH */ + case 'C': + if (i < ntype - 3 && + (strncasecmp(&type[i],"char",4) == 0 || + strncasecmp(&type[i],"clob",4) == 0)) { + return DBSQL_SO_TEXT; + } + break; + case 'x': /* FALLTHROUGH */ + case 'X': + if (i >= 2 && + strncasecmp(&type[i - 2], + "text", 4) == 0) { + return DBSQL_SO_TEXT; + } + break; + default: + break; + } + } + return DBSQL_SO_NUM; +} + +/* + * __add_collate_type -- + * This routine is called by the parser while in the middle of + * parsing a CREATE TABLE statement. A "COLLATE" clause has + * been seen on a column. This routine sets the column_t.sortOrder on + * the column currently under construction. + * + * PUBLIC: void __add_collate_type __P((parser_t *, int)); + */ +void +__add_collate_type(parser, type) + parser_t *parser; + int type; +{ + table_t *table; + int i; + if ((table = parser->pNewTable) == 0) + return; + i = table->nCol - 1; + if (i >= 0) + table->aCol[i].sortOrder = type; +} + +/* + * __change_schema_signature + * Come up with a new random value for the schema signature. Make sure + * the new value is different from the old. + * The schema signature is used to determine when the schema for the + * database changes. After each schema change, the signature value + * changes. When a process first reads the schema it records the + * signature. Thereafter, whenever it goes to access the database, + * it checks the signature to make sure the schema has not changed + * since it was last read. + * !!! + * This plan is not completely bullet-proof. It is possible for + * the schema to change multiple times and for the cookie to be + * set back to prior value. But schema changes are infrequent + * and the probability of hitting the same cookie value is only + * 1 chance in 2^32. So we're safe enough. + * + * PUBLIC: void __change_schema_signature __P((DBSQL *, vdbe_t *)); + */ +void __change_schema_signature(dbp, v) + DBSQL *dbp; + vdbe_t *v; +{ + if (dbp->next_sig == dbp->aDb[0].schema_sig) { + u_int8_t n; + rand8_r(&dbp->rand, &n); + dbp->next_sig = dbp->aDb[0].schema_sig + n + 1; + dbp->flags |= DBSQL_InternChanges; + __vdbe_add_op(v, OP_Integer, dbp->next_sig, 0); + __vdbe_add_op(v, OP_SetSchemaSignature, 0, 0); + } +} + +/* + * __ident_length -- + * Measure the number of characters needed to output the given + * identifier. The number returned includes any quotes used + * but does not include the null terminator. + * + * PUBLIC static int __indent_length __P((const char *)); + */ +static int +__ident_length(z) + const char *z; +{ + int n; + int need_quote = 0; + for (n = 0; *z; n++, z++) { + if (*z == '\'') { + n++; + need_quote = 1; + } + } + return (n + (need_quote * 2)); +} + +/* + * __ident_put -- + * Write an identifier onto the end of the given string. Add + * quote characters as needed. + * + * STATIC: static void __ident_put __P((char *, int *, char *)); + */ +static void +__ident_put(z, idx, ident) + char *z; + int *idx; + char *ident; +{ + int i, j, need_quote; + i = *idx; + for (j = 0; ident[j]; j++) { + if (!isalnum(ident[j]) && ident[j] != '_') + break; + } + need_quote = (ident[j] != 0 || + isdigit(ident[0]) || + __get_keyword_code(ident, j) != TK_ID); + if (need_quote) + z[i++] = '\''; + for (j = 0; ident[j]; j++) { + z[i++] = ident[j]; + if (ident[j] == '\'') + z[i++] = '\''; + } + if (need_quote) + z[i++] = '\''; + z[i] = 0; + *idx = i; +} + +/* + * __gen_create_table_stmt -- + * Generate a CREATE TABLE statement appropriate for the given + * table. Memory to hold the text of the statement is obtained + * from __dbsql_calloc() and must be freed by the calling function. + * + * STATIC: static char *__gen_create_table_stmt __P((table_t *)); + */ +static char * +__gen_create_table_stmt(table) + table_t *table; +{ + int i, k, n; + char *stmt; + char *sep, *sep2, *end; + + n = 0; + for (i = 0; i < table->nCol; i++) { + n += __ident_length(table->aCol[i].zName); + } + n += __ident_length(table->zName); + if (n < 40) { + sep = ""; + sep2 = ","; + end = ")"; + } else { + sep = "\n "; + sep2 = ",\n "; + end = "\n)"; + } + n += 35 + (6 * table->nCol); + if (__dbsql_malloc(NULL, n, &stmt) == ENOMEM) + return 0; + strcpy(stmt, table->iDb == 1 ? "CREATE TEMP TABLE " : "CREATE TABLE "); + k = strlen(stmt); + __ident_put(stmt, &k, table->zName); + stmt[k++] = '('; + for (i = 0; i < table->nCol; i++) { + strcpy(&stmt[k], sep); + k += strlen(&stmt[k]); + sep = sep2; + __ident_put(stmt, &k, table->aCol[i].zName); + } + strcpy(&stmt[k], end); + return stmt; +} + +/* + * __ending_create_table_paren -- + * This routine is called to report the final ")" that terminates + * a CREATE TABLE statement. + * The table structure that other action routines have been building + * is added to the internal hash tables, assuming no errors have + * occurred. + * An entry for the table is made in the master table on disk, + * unless this is a temporary table or initFlag==1. When initFlag==1, + * it means we are reading the master table because we just + * connected to the database or because the master table has + * recently changed, so the entry for this table already exists in + * the master table. We do not want to create it again. + * If the 'select' argument is not NULL, it means that this routine + * was called to create a table generated from a + * "CREATE TABLE ... AS SELECT ..." statement. The column names of + * the new table will match the result set of the SELECT. + * + * PUBLIC: void __ending_create_table_paren __P((parser_t *, token_t *, + * PUBLIC: select_t *)); + */ +void +__ending_create_table_paren(parser, end, select) + parser_t *parser; + token_t *end; + select_t *select; +{ + table_t *table; + DBSQL *dbp = parser->db; + + if ((end == 0 && select == 0) || parser->nErr || parser->rc == ENOMEM) + return; + + table = parser->pNewTable; + if (table == 0) + return; + + /* + * If the table is generated from a SELECT, then construct the + * list of columns and the text of the table. + */ + if (select) { + table_t *sel_table = __select_result_set(parser, 0, select); + if (sel_table == 0) + return; + DBSQL_ASSERT(table->aCol == 0); + table->nCol = sel_table->nCol; + table->aCol = sel_table->aCol; + sel_table->nCol = 0; + sel_table->aCol = 0; + __vdbe_delete_table(0, sel_table); + } + + /* + * If the initFlag is 1 it means we are reading the SQL off the + * "master" or "temp_master" table on the disk. + * So do not write to the disk again. Extract the root page number + * for the table from the parser->newTnum field. + * TODO: I couldn't find 'sqliteOpenCb' anywhere... cruft? + * (The page number should have been put there by the sqliteOpenCb + * routine.) + */ + if (parser->initFlag) { + table->tnum = parser->newTnum; + } + + /* + * If not initializing, then create a record for the new table + * in the DBSQL_MASTER table of the database. The record number + * for the new table entry should already be on the stack. + * If this is a TEMPORARY table, write the entry into the auxiliary + * file instead of into the main database file. + */ + if (!parser->initFlag) { + int n; + vdbe_t *v; + + v = __parser_get_vdbe(parser); + if (v == 0) + return; + if (table->pSelect == 0) { + /* A regular table */ + __vdbe_add_op(v, OP_CreateTable, 0, table->iDb); + __vdbe_change_p3(v, -1, (char *)&table->tnum, + P3_POINTER); + } else { + /* A view */ + __vdbe_add_op(v, OP_Integer, 0, 0); + } + table->tnum = 0; + __vdbe_add_op(v, OP_Pull, 1, 0); + __vdbe_add_op(v, OP_String, 0, 0); + if (table->pSelect == 0) { + __vdbe_change_p3(v, -1, "table", P3_STATIC); + } else { + __vdbe_change_p3(v, -1, "view", P3_STATIC); + } + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, table->zName, P3_STATIC); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, table->zName, P3_STATIC); + __vdbe_add_op(v, OP_Dup, 4, 0); + __vdbe_add_op(v, OP_String, 0, 0); + if (select) { + char *z = __gen_create_table_stmt(table); + n = z ? strlen(z) : 0; + __vdbe_change_p3(v, -1, z, n); + __dbsql_free(dbp, z); + } else { + DBSQL_ASSERT(end != 0); + n = P_TO_UINT32(end->z) - + P_TO_UINT32(parser->sFirstToken.z) + 1; + __vdbe_change_p3(v, -1, parser->sFirstToken.z, n); + } + __vdbe_add_op(v, OP_MakeRecord, 5, 0); + __vdbe_add_op(v, OP_PutIntKey, 0, 0); + if (!table->iDb) { + __change_schema_signature(dbp, v); + } + __vdbe_add_op(v, OP_Close, 0, 0); + if (select) { + __vdbe_add_op(v, OP_Integer,table->iDb, 0); + __vdbe_add_op(v, OP_OpenWrite, 1, 0); + parser->nTab = 2; + __select(parser, select, SRT_Table, 1, 0, 0, 0); + } + __vdbe_conclude_write(parser); + } + + /* + * Add the table to the in-memory representation of the database. + */ + if (parser->explain == 0 && parser->nErr == 0) { + table_t *old; + foreign_key_t *fkey; + old = __hash_insert(&dbp->aDb[table->iDb].tblHash, + table->zName, strlen(table->zName) + 1, table); + if (old) { + /* Malloc must have failed inside __hash_insert() */ + DBSQL_ASSERT(table == old); + return; + } + for (fkey = table->pFKey; fkey; fkey = fkey->pNextFrom) { + int nto = strlen(fkey->zTo) + 1; + fkey->pNextTo = + __hash_find(&dbp->aDb[table->iDb].aFKey, + fkey->zTo, nto); + __hash_insert(&dbp->aDb[table->iDb].aFKey, fkey->zTo, + nto, fkey); + } + parser->pNewTable = 0; + dbp->nTable++; + dbp->flags |= DBSQL_InternChanges; + } +} + +/* + * __create_view -- + * The parser calls this routine in order to create a new VIEW + * + * PUBLIC: void __create_view __P((parser_t *, token_t *, token_t *, + * PUBLIC: select_t *, int)); + * + * parser The parsing context + * begin The CREATE token that begins the statement + * name The token that holds the name of the view + * select A SELECT statement to produce the new view + * temp TRUE for a TEMPORARY view + */ +void __create_view(parser, begin, name, select, temp) + parser_t *parser; + token_t *begin; + token_t *name; + select_t *select; + int temp; +{ + table_t *table; + const char *z; + token_t end; + ref_normalizer_ctx_t normctx; + + __start_table(parser, begin, name, temp, 1); + table = parser->pNewTable; + if (table == 0 || parser->nErr) { + __select_delete(select); + return; + } + if (__ref_normalizer_ctx_init(&normctx, parser, table->iDb, "view", + name) && + __ref_normalize_select(&normctx, select)) { + __select_delete(select); + return; + } + + /* + * Make a copy of the entire SELECT statement that defines the view. + * This will force all the expr_t.token.z values to be dynamically + * allocated rather than point to the input string - which means that + * they will persist after the current dbsql_exec() call returns. + */ + table->pSelect = __select_dup(select); + __select_delete(select); + if (!parser->initFlag) { + __view_get_column_names(parser, table); + } + + /* + * Locate the end of the CREATE VIEW statement. Make 'end' point to + * the end. + */ + end = parser->sLastToken; + if (end.z[0] != 0 && end.z[0] != ';') { + end.z += end.n; + } + end.n = 0; + z = end.z; + while (z-- >= begin->z) { + if (*z == ';' || isspace(*z)) + break; + } + end.z = z; + end.n = 1; + + /* + * Use __ending_create_table_paren() to add the view to the + * DBSQL_MASTER table + */ + __ending_create_table_paren(parser, &end, 0); + return; +} + +/* + * __view_get_column_names -- + * The table_t structure pTable is really a VIEW. Fill in the names of + * the columns of the view in the pTable structure. Return the number + * of errors. If an error is seen leave an error message in + * parser->zErrMsg. + * + * PUBLIC: int __view_get_column_names __P((parser_t *, table_t *)); + */ +int +__view_get_column_names(parser, table) + parser_t *parser; + table_t *table; +{ + expr_list_t *elist; + select_t *sel; + table_t *sel_table; + int nerr = 0; + + DBSQL_ASSERT(table); + + /* + * A positive nCol means the columns names for this view are + * already known. + */ + if (table->nCol > 0) + return 0; + + /* + * A negative nCol is a special marker meaning that we are currently + * trying to compute the column names. If we enter this routine with + * a negative nCol, it means two or more views form a loop, like this: + * + * CREATE VIEW one AS SELECT * FROM two; + * CREATE VIEW two AS SELECT * FROM one; + * + * Actually, this error is caught previously and so the following test + * should always fail. But we will leave it in place just to be safe. + */ + if (table->nCol < 0) { + __str_append(&parser->zErrMsg, "view ", + table->zName, " is circularly defined", (char*)0); + parser->nErr++; + return 1; + } + + /* + * If we get this far, it means we need to compute the table names. + */ + /* If nCol == 0, then 'table' must be a VIEW */ + DBSQL_ASSERT(table->pSelect); + sel = table->pSelect; + + /* + * Note that the call to __select_result_set() will expand any + * "*" elements in this list. But we will need to restore the list + * back to its original configuration afterwards, so we save a copy of + * the original in elist. + */ + elist = sel->pEList; + sel->pEList = __expr_list_dup(elist); + if (sel->pEList == 0) { + sel->pEList = elist; + return 1; /* Malloc failed */ + } + table->nCol = -1; + sel_table = __select_result_set(parser, 0, sel); + if (sel_table) { + DBSQL_ASSERT(table->aCol == 0); + table->nCol = sel_table->nCol; + table->aCol = sel_table->aCol; + sel_table->nCol = 0; + sel_table->aCol = 0; + __vdbe_delete_table(0, sel_table); + DB_PROPERTY_SET(parser->db, table->iDb, DBSQL_UNRESET_VIEWS); + } else { + table->nCol = 0; + nerr++; + } + __select_unbind(sel); + __expr_list_delete(sel->pEList); + sel->pEList = elist; + return nerr; +} + +/* + * __view_reset_column_names -- + * + * Clear the column names from the VIEW 'table'. + * This routine is called whenever any other table or view is modified. + * The view passed into this routine might depend directly or indirectly + * on the modified or deleted table so we need to clear the old column + * names so that they will be recomputed. + * + * STATIC: static void __view_reset_column_names __P((table_t *)); + */ +static void +__view_reset_column_names(table) + table_t *table; +{ + int i; + if (table == 0 || table->pSelect==0 ) return; + if (table->nCol == 0) + return; + for (i = 0; i < table->nCol; i++) { + __dbsql_free(NULL, table->aCol[i].zName); + __dbsql_free(NULL, table->aCol[i].zDflt); + __dbsql_free(NULL, table->aCol[i].zType); + } + __dbsql_free(NULL, table->aCol); + table->aCol = 0; + table->nCol = 0; +} + +/* + * __view_reset_all -- + * Clear the column names from every VIEW in database idx. + * + * STATIC: static void __view_reset_all __P((DBSQL *, int)); + */ +static void +__view_reset_all(dbp, idx) + DBSQL *dbp; + int idx; +{ + hash_ele_t *i; + if (!DB_PROPERTY_HAS_VALUE(dbp, idx, DBSQL_UNRESET_VIEWS)) + return; + for (i = __hash_first(&dbp->aDb[idx].tblHash); i; + i = __hash_next(i)) { + table_t *t = __hash_data(i); + if (t->pSelect ) { + __view_reset_column_names(t); + } + } + DB_PROPERTY_CLEAR(dbp, idx, DBSQL_UNRESET_VIEWS); +} + +/* + * __table_from_token -- + * Given a token, look up a table with that name. If not found, leave + * an error for the parser to find and return NULL. + * + * PUBLIC: table_t *__table_from_token __P((parser_t *, token_t *)); + */ +table_t * +__table_from_token(parser, token) + parser_t *parser; + token_t *token; +{ + char *name; + table_t *table; + name = __table_name_from_token(token); + if (name == 0) + return 0; + table = __find_table(parser->db, name, 0); + __dbsql_free(parser->db, name); + if (table == 0) { + __str_nappend(&parser->zErrMsg, "no such table: ", + 0, token->z, token->n, NULL); + parser->nErr++; + } + return table; +} + +/* + * __drop_table -- + * This routine is called to do the work of a DROP TABLE statement. + * pName is the name of the table to be dropped. + * TODO: Its likely that with DB we can do this much quiker as we'll + * likely have each sql database in its own DB database. + * + * PUBLIC: void __drop_table __P((parser_t *, token_t *name, int)); + */ +void +__drop_table(parser, name, view) + parser_t *parser; + token_t *name; + int view; +{ + table_t *table; + vdbe_t *v; + int base; + DBSQL *dbp = parser->db; + int idb; + + if (parser->nErr || parser->rc == ENOMEM) + return; + table = __table_from_token(parser, name); + if (table == 0) + return; + idb = table->iDb; + DBSQL_ASSERT(idb >= 0 && idb < dbp->nDb); +#ifndef DBSQL_NO_AUTH + { + int code; + const char *auth_table = SCHEMA_TABLE(table->iDb); + const char *auth_db_name = dbp->aDb[table->iDb].zName; + if (__auth_check(parser, DBSQL_DELETE, auth_table, 0, + auth_db_name)) { + return; + } + if (view) { + if (idb == 1) { + code = DBSQL_DROP_TEMP_VIEW; + } else { + code = DBSQL_DROP_VIEW; + } + } else { + if (idb == 1) { + code = DBSQL_DROP_TEMP_TABLE; + } else { + code = DBSQL_DROP_TABLE; + } + } + if (__auth_check(parser, code, table->zName, 0, + auth_db_name)) { + return; + } + if (__auth_check(parser, DBSQL_DELETE, table->zName, 0, + auth_db_name)) { + return; + } + } +#endif + if (table->readOnly) { + __str_append(&parser->zErrMsg, "table ", table->zName, + " may not be dropped", (char*)0); + parser->nErr++; + return; + } + if (view && table->pSelect == 0) { + __str_append(&parser->zErrMsg, + "use DROP TABLE to delete table ", table->zName, + (char*)0); + parser->nErr++; + return; + } + if (!view && table->pSelect) { + __str_append(&parser->zErrMsg, + "use DROP VIEW to delete view ", table->zName, + (char*)0); + parser->nErr++; + return; + } + + /* + * Generate code to remove the table from the master table + * on disk. + */ + v = __parser_get_vdbe(parser); + if (v) { + static vdbe_op_t drop_table[] = { + { OP_Rewind, 0, ADDR(8), 0}, + { OP_String, 0, 0, 0}, /* 1 */ + { OP_MemStore, 1, 1, 0}, + { OP_MemLoad, 1, 0, 0}, /* 3 */ + { OP_Column, 0, 2, 0}, + { OP_Ne, 0, ADDR(7), 0}, + { OP_Delete, 0, 0, 0}, + { OP_Next, 0, ADDR(3), 0}, /* 7 */ + }; + index_t *idx; + trigger_t *trigger; + __vdbe_prepare_write(parser, 0, table->iDb); + + /* + * Drop all triggers associated with the table being dropped. + */ + trigger = table->pTrigger; + while (trigger) { + DBSQL_ASSERT(trigger->iDb == table->iDb || + trigger->iDb == 1); + __drop_trigger_ptr(parser, trigger, 1); + if (parser->explain) { + trigger = trigger->pNext; + } else { + trigger = table->pTrigger; + } + } + + /* + * Drop all DBSQL_MASTER entries that refer to the table. + */ + __open_master_table(v, table->iDb); + base = __vdbe_add_op_list(v, ARRAY_SIZE(drop_table), + drop_table); + __vdbe_change_p3(v, base + 1, table->zName, 0); + + /* + * Drop all DBSQL_TEMP_MASTER entries that refer to the table. + */ + if (table->iDb != 1) { + __open_master_table(v, 1); + base = __vdbe_add_op_list(v, ARRAY_SIZE(drop_table), + drop_table); + __vdbe_change_p3(v, base + 1, table->zName, 0); + } + + if (table->iDb == 0) { + __change_schema_signature(dbp, v); + } + __vdbe_add_op(v, OP_Close, 0, 0); + if (!view) { + __vdbe_add_op(v, OP_Destroy, table->tnum, table->iDb); + for (idx = table->pIndex; idx; idx = idx->pNext) { + __vdbe_add_op(v, OP_Destroy, idx->tnum, + idx->iDb); + } + } + __vdbe_conclude_write(parser); + } + + /* + * Delete the in-memory description of the table. + * Exception: if the SQL statement began with the EXPLAIN keyword, + * then no changes should be made. + */ + if (!parser->explain) { + __unlink_and_delete_table(dbp, table); + dbp->flags |= DBSQL_InternChanges; + } + __view_reset_all(dbp, idb); +} + +/* + * __add_idx_key_type -- + * This routine constructs a P3 string suitable for an OP_MakeIdxKey + * opcode and adds that P3 string to the most recently inserted + * instruction in the virtual machine. The P3 string consists of a + * single character for each column in the index 'idx' of table + * 'table'. If the column uses a numeric sort order, then the P3 + * string character corresponding to that column is 'n'. If the column + * uses a text sort order, then the P3 string is 't'. See the + * OP_MakeIdxKey opcode documentation for additional information. + * See also: __add_key_type() + * + * PUBLIC: void __add_idx_key_type __P((vdbe_t *, index_t *)); + */ +void +__add_idx_key_type(v, idx) + vdbe_t *v; + index_t *idx; +{ + char *type; + table_t *table; + int i, n; + + DBSQL_ASSERT(idx != 0 && idx->pTable != 0); + table = idx->pTable; + n = idx->nColumn; + if (__dbsql_malloc(NULL, n + 1, &type) == ENOMEM) + return; + for (i = 0; i < n; i++) { + int col = idx->aiColumn[i]; + DBSQL_ASSERT(col >= 0 && col < table->nCol); + if ((table->aCol[col].sortOrder & DBSQL_SO_TYPEMASK) == + DBSQL_SO_TEXT) { + type[i] = 't'; + } else { + type[i] = 'n'; + } + } + type[n] = 0; + __vdbe_change_p3(v, -1, type, n); + __dbsql_free(NULL, type); +} + +/* + * __create_foreign_key -- + * This routine is called to create a new foreign key on the table + * currently under construction. 'from_col' determines which columns + * in the current table point to the foreign key. If 'from_col'==0 then + * connect the key to the last column inserted. 'to' is the name of + * the table referred to. to_col is a list of tables in the other + * 'to' table that the foreign key points to. flags contains all + * information about the conflict resolution algorithms specified + * in the ON DELETE, ON UPDATE and ON INSERT clauses. + * An foreign_key_t structure is created and added to the table currently + * under construction in the parser->pNewTable field. The new + * foreign_key_t is not linked into dbp->aFKey at this point - that + * does not happen until __ending_create_table_paren(). + * The foreign key is set for IMMEDIATE processing. A subsequent call + * to __defer_foreign_key() might change this to DEFERRED. + * + * PUBLIC: void __create_foreign_key __P((parser_t *, id_list_t *, token_t *, + * PUBLIC: id_list_t *, int)); + * + * parser Parsing context + * from_col Columns in table that point to other table + * to Name of the other table + * to_col Columns in the other table + * flags Conflict resolution algorithms + */ +void __create_foreign_key(parser, from_col, to, to_col, flags) + parser_t *parser; + id_list_t *from_col; + token_t *to; + id_list_t *to_col; + int flags; +{ + table_t *table = parser->pNewTable; + int bytes; + int i; + int ncol; + char *z; + foreign_key_t *fkey = 0; + + DBSQL_ASSERT(to != 0); + if (table == 0 || parser->nErr) + goto fk_end; + if (from_col == 0) { + int col = table->nCol - 1; + if (col < 0) + goto fk_end; + if (to_col && to_col->nId!=1 ){ + __str_nappend(&parser->zErrMsg, + "foreign key on ", -1, + table->aCol[col].zName, -1, + " should reference only one column " + "of table ", -1, to->z, to->n, NULL); + parser->nErr++; + goto fk_end; + } + ncol = 1; + } else if (to_col && to_col->nId != from_col->nId) { + __str_append(&parser->zErrMsg, + "number of columns in foreign key does not " + "match the number of columns in the referenced " + "table", (char*)0); + parser->nErr++; + goto fk_end; + } else { + ncol = from_col->nId; + } + bytes = sizeof(*fkey) + ncol * sizeof(fkey->aCol[0]) + to->n + 1; + if (to_col) { + for (i = 0; i < to_col->nId; i++) { + bytes += strlen(to_col->a[i].zName) + 1; + } + } + if (__dbsql_calloc(NULL, 1, bytes, &fkey) == ENOMEM) + goto fk_end; + fkey->pFrom = table; + fkey->pNextFrom = table->pFKey; + z = (char*)&fkey[1]; + fkey->aCol = (struct col_map*)z; + z += sizeof(struct col_map)*ncol; + fkey->zTo = z; + memcpy(z, to->z, to->n); + z[to->n] = 0; + z += to->n + 1; + fkey->pNextTo = 0; + fkey->nCol = ncol; + if (from_col == 0) { + fkey->aCol[0].iFrom = table->nCol - 1; + } else { + for(i = 0; i < ncol; i++) { + int j; + for(j = 0; j < table->nCol; j++) { + if (strcasecmp( + table->aCol[j].zName, + from_col->a[i].zName) == 0) { + fkey->aCol[i].iFrom = j; + break; + } + } + if (j >= table->nCol) { + __str_append(&parser->zErrMsg, + "unknown column \"", + from_col->a[i].zName, + "\" in foreign key definition", + (char*)0); + parser->nErr++; + goto fk_end; + } + } + } + if (to_col) { + for (i = 0; i < ncol; i++) { + int n = strlen(to_col->a[i].zName); + fkey->aCol[i].zCol = z; + memcpy(z, to_col->a[i].zName, n); + z[n] = 0; + z += n+1; + } + } + fkey->isDeferred = 0; + fkey->deleteConf = flags & 0xff; + fkey->updateConf = (flags >> 8 ) & 0xff; + fkey->insertConf = (flags >> 16 ) & 0xff; + + /* + * Link the foreign key to the table as the last step. + */ + table->pFKey = fkey; + fkey = 0; + + fk_end: + __dbsql_free(NULL, fkey); + __id_list_delete(from_col); + __id_list_delete(to_col); +} + +/* + * __defer_foreign_key -- + * This routine is called when an INITIALLY IMMEDIATE or + * INITIALLY DEFERRED clause is seen as part of a foreign key + * definition. The 'deferred' parameter is 1 for INITIALLY DEFERRED + * and 0 for INITIALLY IMMEDIATE. + * The behavior of the most recently created foreign key is adjusted + * accordingly. + * + * PUBLIC: void __defer_foreign_key __P((parser_t *, int)); + */ +void +__defer_foreign_key(parser, deferred) + parser_t *parser; + int deferred; +{ + table_t *table; + foreign_key_t *fkey; + if ((table = parser->pNewTable) == 0 || (fkey = table->pFKey) == 0) + return; + fkey->isDeferred = deferred; +} + +/* + * __creat_index -- + * Create a new index for an SQL table. 'index' is the name of the + * index and pTable is the name of the table that is to be indexed. + * Both will be NULL for a primary key or an index that is created + * to satisfy a UNIQUE constraint. If pTable and pIndex are NULL, + * use parser->pNewTable as the table to be indexed. parser->pNewTable + * is a table that is currently being constructed by a CREATE TABLE + * statement. + * 'list' is a list of columns to be indexed. 'list' will be NULL if + * this is a primary key or unique-constraint on the most recent column + * added to the table currently under construction. + * + * PUBLIC: void __create_index __P((parser_t *, token_t *, src_list_t *, + * PUBLIC: id_list_t *, int, token_t *, token_t *)); + * + * parser All information about this parse. + * token Name of the index. May be NULL. + * sltable Name of the table to index. Use + * parser->pNewTable if 0 + * list A list of columns to be indexed + * on_error OE_Abort, OE_Ignore, OE_Replace, or OE_None + * start The CREATE token that begins a CREATE TABLE + * statement. + * end The ")" that closes the CREATE INDEX statement. + */ +void __create_index(parser, token, sltable, list, on_error, start, end) + parser_t *parser; + token_t *token; + src_list_t *sltable; + id_list_t *list; + int on_error; + token_t *start; + token_t *end; +{ + table_t *table; /* Table to be indexed */ + index_t *index; /* The index to be created */ + char *name = 0; + int i, j; + token_t null_id; /* Fake token for an empty ID list */ + ref_normalizer_ctx_t normctx; /* For assigning database + names to sltable */ + int temp; /* True for a temporary index */ + DBSQL *dbp = parser->db; + + if (parser->nErr || parser->rc == ENOMEM) + goto exit_create_index; + if (parser->initFlag && + __ref_normalizer_ctx_init(&normctx, parser, parser->iDb, + "index", token) && + __ref_normalize_src_list(&normctx, sltable)) { + goto exit_create_index; + } + + /* + * Find the table that is to be indexed. Return early if not found. + */ + if (sltable != 0) { + DBSQL_ASSERT(token != 0); + DBSQL_ASSERT(sltable->nSrc == 1); + table = __src_list_lookup(parser, sltable); + } else { + DBSQL_ASSERT(token == 0); + table = parser->pNewTable; + } + if (table == 0 || parser->nErr ) + goto exit_create_index; + if (table->readOnly) { + __str_append(&parser->zErrMsg, "table ", table->zName, + " may not be indexed", (char*)0); + parser->nErr++; + goto exit_create_index; + } + if (table->iDb >= 2 && parser->initFlag == 0) { + __str_append(&parser->zErrMsg, "table ", table->zName, + " may not have indices added", (char*)0); + parser->nErr++; + goto exit_create_index; + } + if (table->pSelect) { + __str_append(&parser->zErrMsg, "views may not be indexed", + (char*)0); + parser->nErr++; + goto exit_create_index; + } + temp = (table->iDb == 1); + + /* + * Find the name of the index. Make sure there is not already another + * index or table with the same name. + * + * Exception: If we are reading the names of permanent indices from + * the master table (because some other process changed the schema) and + ** one of the index names collides with the name of a temporary table + * or index, then we will continue to process this index. + * + * If token==0 it means that we are dealing with a primary key or + * UNIQUE constraint. We have to invent our own name. + */ + if (token && !parser->initFlag) { + index_t *idx_same_name; /* Another index with the same name */ + table_t *tbl_same_name; /* A table with same name as index */ + __dbsql_strndup(dbp, token->z, &name, token->n); + if (name == 0) + goto exit_create_index; + if ((idx_same_name = __find_index(dbp, name, 0)) != 0) { + __str_append(&parser->zErrMsg, "index ", name, + " already exists", (char*)0); + parser->nErr++; + goto exit_create_index; + } + if ((tbl_same_name = __find_table(dbp, name, 0)) != 0) { + __str_append(&parser->zErrMsg, + "there is already a table named ", name, + (char*)0); + parser->nErr++; + goto exit_create_index; + } + } else if (token == 0) { + char buf[30]; /* TODO: static buffers are bad */ + int n = 1; + index_t *loop = table->pIndex; + while (loop) { + loop = loop->pNext; + n++; + } + sprintf(buf,"%d)", n); + name = 0; + __str_append(&name, "(", table->zName, " autoindex ", buf, + (char*)0); + if (name == 0) + goto exit_create_index; + } else { + __dbsql_strndup(dbp, token->z, &name, token->n); + } + + /* + * Check for authorization to create an index. + */ +#ifndef DBSQL_NO_AUTH + { + const char *db_name = dbp->aDb[table->iDb].zName; + + DBSQL_ASSERT(table->iDb == parser->iDb || temp); + if (__auth_check(parser, DBSQL_INSERT, SCHEMA_TABLE(temp), + 0, db_name)) { + goto exit_create_index; + } + i = DBSQL_CREATE_INDEX; + if (temp) + i = DBSQL_CREATE_TEMP_INDEX; + if (__auth_check(parser, i, name, table->zName, db_name)) { + goto exit_create_index; + } + } +#endif + + /* + * If 'list'==0, it means this routine was called to make a primary + * key out of the last column added to the table under construction. + * So create a fake list to simulate this. + */ + if (list == 0) { + null_id.z = table->aCol[table->nCol-1].zName; + null_id.n = strlen(null_id.z); + list = __id_list_append(0, &null_id); + if (list == 0) + goto exit_create_index; + } + + /* + * Allocate the index structure. + */ + if (__dbsql_calloc(dbp, 1, sizeof(index_t) + (strlen(name) + 1) + + (sizeof(int) * list->nId), &index) == ENOMEM) + goto exit_create_index; + index->aiColumn = (int*)&index[1]; + index->zName = (char*)&index->aiColumn[list->nId]; + strcpy(index->zName, name); + index->pTable = table; + index->nColumn = list->nId; + index->onError = on_error; + index->autoIndex = (token == 0); + index->iDb = (temp ? 1 : parser->iDb); + + /* + * Scan the names of the columns of the table to be indexed and + * load the column indices into the index_t structure. Report an error + * if any column is not found. + */ + for (i = 0; i < list->nId; i++) { + for(j = 0; j < table->nCol; j++) { + if (strcasecmp(list->a[i].zName, + table->aCol[j].zName) == 0) { + break; + } + } + if (j >= table->nCol) { + __str_append(&parser->zErrMsg, "table ", + table->zName, " has no column named ", + list->a[i].zName, (char*)0); + parser->nErr++; + __dbsql_free(dbp, index); + goto exit_create_index; + } + index->aiColumn[i] = j; + } + + /* + * Link the new index_t structure to its table and to the other + * in-memory database structures. + */ + if (!parser->explain) { + index_t *rindex; + rindex = __hash_insert(&dbp->aDb[index->iDb].idxHash, + index->zName, strlen(index->zName) + 1, index); + if (rindex) { + /* Malloc must have failed */ + DBSQL_ASSERT(rindex == index); + __dbsql_free(dbp, index); + goto exit_create_index; + } + dbp->flags |= DBSQL_InternChanges; + } + + /* + * When adding an index to the list of indices for a table, make + * sure all indices labeled OE_Replace come after all those labeled + * OE_Ignore. This is necessary for the correct operation of UPDATE + * and INSERT. + */ + if (on_error != OE_Replace || table->pIndex == 0 || + table->pIndex->onError == OE_Replace) { + index->pNext = table->pIndex; + table->pIndex = index; + } else { + index_t *other = table->pIndex; + while (other->pNext && other->pNext->onError != OE_Replace) { + other = other->pNext; + } + index->pNext = other->pNext; + other->pNext = index; + } + + if (parser->initFlag && sltable != 0) { + /* + * If the initFlag is 1 it means we are reading the SQL off the + * "master" table on the disk. So do not write to the disk + * again. Extract the table number from the parser->newTnum + * field. + */ + index->tnum = parser->newTnum; + } else if (parser->initFlag == 0) { + /* + * If the initFlag is 0 then create the index on disk. This + * involves writing the index into the master table and + * filling in the index with the current table contents. + * + * The initFlag is 0 when the user first enters a CREATE INDEX + * command. The initFlag is 1 when a database is opened and + * CREATE INDEX statements are read out of the master table. + * In the latter case the index already exists on disk, which + * is why we don't want to recreate it. + * + * If sltable==0 it means this index is generated as a primary + * key or UNIQUE constraint of a CREATE TABLE statement. + * Since the table has just been created, it contains no data + * and the index initialization step can be skipped. + */ + int n; + vdbe_t *v; + int lbl1, lbl2; + int i; + int addr; + + v = __parser_get_vdbe(parser); + if (v == 0) + goto exit_create_index; + if (sltable != 0) { + __vdbe_prepare_write(parser, 0, temp); + __open_master_table(v, temp); + } + __vdbe_add_op(v, OP_NewRecno, 0, 0); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, "index", P3_STATIC); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, index->zName, strlen(index->zName)); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, table->zName, P3_STATIC); + addr = __vdbe_add_op(v, OP_CreateIndex, 0, temp); + __vdbe_change_p3(v, addr, (char*)&index->tnum, P3_POINTER); + index->tnum = 0; + if (sltable) { + __vdbe_add_op(v, OP_Dup, 0, 0); + __vdbe_add_op(v, OP_Integer, temp, 0); + __vdbe_add_op(v, OP_OpenWrite, 1, 0); + } + addr = __vdbe_add_op(v, OP_String, 0, 0); + if (start && end ){ + n = P_TO_UINT32(end->z) - P_TO_UINT32(start->z) + 1; + __vdbe_change_p3(v, addr, start->z, n); + } + __vdbe_add_op(v, OP_MakeRecord, 5, 0); + __vdbe_add_op(v, OP_PutIntKey, 0, 0); + if (sltable) { + __vdbe_add_op(v, OP_Integer, table->iDb, 0); + __vdbe_add_op(v, OP_OpenRead, 2, table->tnum); + __vdbe_change_p3(v, -1, table->zName, P3_STATIC); + lbl2 = __vdbe_make_label(v); + __vdbe_add_op(v, OP_Rewind, 2, lbl2); + lbl1 = __vdbe_add_op(v, OP_Recno, 2, 0); + for (i = 0; i < index->nColumn; i++) { + int col = index->aiColumn[i]; + if (table->iPKey == col) { + __vdbe_add_op(v, OP_Dup, i, 0); + } else { + __vdbe_add_op(v, OP_Column, 2, col); + } + } + __vdbe_add_op(v, OP_MakeIdxKey, index->nColumn, 0); + __add_idx_key_type(v, index); + __vdbe_add_op(v, OP_IdxPut, 1, + index->onError != OE_None); + __vdbe_change_p3(v, -1, + "indexed columns are not unique", + P3_STATIC); + __vdbe_add_op(v, OP_Next, 2, lbl1); + __vdbe_resolve_label(v, lbl2); + __vdbe_add_op(v, OP_Close, 2, 0); + __vdbe_add_op(v, OP_Close, 1, 0); + } + if (sltable != 0) { + if (!temp) { + __change_schema_signature(dbp, v); + } + __vdbe_add_op(v, OP_Close, 0, 0); + __vdbe_conclude_write(parser); + } + } + + /* Clean up before exiting */ +exit_create_index: + __id_list_delete(list); + __src_list_delete(sltable); + __dbsql_free(dbp, name); + return; +} + +/* + * __drop_index -- + * This routine will drop an existing named index. This routine + * implements the DROP INDEX statement. + * + * PUBILC: __drop_index __P((parser_t *, src_list_t *)); + */ +void +__drop_index(parser, name) + parser_t *parser; + src_list_t *name; +{ + index_t *index; + vdbe_t *v; + DBSQL *dbp = parser->db; + + if (parser->nErr || parser->rc == ENOMEM) + return; + DBSQL_ASSERT(name->nSrc == 1); + index = __find_index(dbp, name->a[0].zName, name->a[0].zDatabase); + if (index == 0) { + __error_msg(parser, "no such index: %S", name, 0); + goto exit_drop_index; + } + if (index->autoIndex) { + __error_msg(parser, "index associated with UNIQUE " + "or PRIMARY KEY constraint cannot be dropped", 0); + goto exit_drop_index; + } + if (index->iDb > 1) { + __error_msg(parser, "cannot alter schema of attached " + "databases", 0); + goto exit_drop_index; + } +#ifndef DBSQL_NO_AUTH + { + int code = DBSQL_DROP_INDEX; + table_t *table = index->pTable; + const char *db_name = dbp->aDb[index->iDb].zName; + const char *table_name = SCHEMA_TABLE(index->iDb); + if (__auth_check(parser, DBSQL_DELETE, table_name, 0, + db_name)) { + goto exit_drop_index; + } + if (index->iDb) + code = DBSQL_DROP_TEMP_INDEX; + if (__auth_check(parser, code, index->zName, table->zName, + db_name)) { + goto exit_drop_index; + } + } +#endif + + /* + * Generate code to remove the index and from the master table. + */ + v = __parser_get_vdbe(parser); + if( v ){ + static vdbe_op_t drop_index[] = { + { OP_Rewind, 0, ADDR(9), 0}, + { OP_String, 0, 0, 0}, /* 1 */ + { OP_MemStore, 1, 1, 0}, + { OP_MemLoad, 1, 0, 0}, /* 3 */ + { OP_Column, 0, 1, 0}, + { OP_Eq, 0, ADDR(8), 0}, + { OP_Next, 0, ADDR(3), 0}, + { OP_Goto, 0, ADDR(9), 0}, + { OP_Delete, 0, 0, 0}, /* 8 */ + }; + int base; + + __vdbe_prepare_write(parser, 0, index->iDb); + __open_master_table(v, index->iDb); + base = __vdbe_add_op_list(v, ARRAY_SIZE(drop_index), + drop_index); + __vdbe_change_p3(v, base + 1, index->zName, 0); + if (index->iDb == 0) { + __change_schema_signature(dbp, v); + } + __vdbe_add_op(v, OP_Close, 0, 0); + __vdbe_add_op(v, OP_Destroy, index->tnum, index->iDb); + __vdbe_conclude_write(parser); + } + + /* + * Delete the in-memory description of this index. + */ + if (!parser->explain) { + __unlink_and_delete_index(dbp, index); + dbp->flags |= DBSQL_InternChanges; + } + + exit_drop_index: + __src_list_delete(name); +} + +/* + * __id_list_append -- + * Append a new element to the given id_list_t. Create a new + * id_list_t if need be. + * A new id_list_t is returned, or NULL if __dbsql_malloc() fails. + * + * PUBLIC: id_list_t *__id_list_append __P((id_list_t *, token_t *)); + */ +id_list_t * +__id_list_append(list, token) + id_list_t *list; + token_t *token; +{ + if (list == 0) { + if (__dbsql_calloc(NULL, 1, sizeof(id_list_t), &list) ==ENOMEM) + return 0; + list->nAlloc = 0; + } + if (list->nId >= list->nAlloc) { + struct id_list_item *a; + list->nAlloc = (list->nAlloc * 2) + 5; + if (__dbsql_realloc(NULL, list->nAlloc * sizeof(list->a[0]), + &list->a) == ENOMEM) { + __id_list_delete(list); + return 0; + } + } + memset(&list->a[list->nId], 0, sizeof(list->a[0])); + if(token) { + char **pz = &list->a[list->nId].zName; + __str_nappend(pz, token->z, token->n, NULL); + if (*pz == 0) { + __id_list_delete(list); + return 0; + } else { + __str_unquote(*pz); + } + } + list->nId++; + return list; +} + +/* + * __src_list_append -- + * Append a new table name to the given src_list_t. Create a new + * src_list_t if need be. A new entry is created in the src_list_t + * even if 'token' is NULL. + * A new src_list_t is returned, or NULL if __dbsql_malloc() fails. + * If 'database' is not null, it means that the table has an optional + * database name prefix. Like this: "database.table". The database + * points to the table name and the 'table' points to the database name. + * The src_list_t.a[].zName field is filled with the table name which + * might come from 'table' (if 'database' is NULL) or from 'database'. + * src_list_t.a[].zDatabase is filled with the database name from + * 'table', or with NULL if no database is specified. + * In other words, if call like this: + * __src_list_append(A,B,0); + * Then B is a table name and the database name is unspecified. If + * called like this: + * __src_list_append(A,B,C); + * Then C is the table name and B is the database name. + * + * PUBLIC: src_list_t *__src_list_append __P((src_list_t *, token_t *, + * PUBLIC: token_t *)); + */ +src_list_t * +__src_list_append(list, table, database) + src_list_t *list; + token_t *table; + token_t *database; +{ + if (list == 0) { + if (__dbsql_calloc(NULL, 1, sizeof(src_list_t), &list)==ENOMEM) + return 0; + list->nAlloc = 1; + } + if (list->nSrc >= list->nAlloc) { + list->nAlloc *= 2; + if (__dbsql_realloc(NULL, sizeof(*list) + (list->nAlloc - 1) * + sizeof(list->a[0]), &list) == ENOMEM) { + __src_list_delete(list); + return 0; + } + } + memset(&list->a[list->nSrc], 0, sizeof(list->a[0])); + if (database && database->z == 0) { + database = 0; + } + if (database && table) { + token_t *temp = database; + database = table; + table = temp; + } + if (table) { + char **pz = &list->a[list->nSrc].zName; + __str_nappend(pz, table->z, table->n, NULL); + if (*pz == 0) { + __src_list_delete(list); + return 0; + } else { + __str_unquote(*pz); + } + } + if (database) { + char **pz = &list->a[list->nSrc].zDatabase; + __str_nappend(pz, database->z, database->n, NULL); + if (*pz == 0) { + __src_list_delete(list); + return 0; + } else { + __str_unquote(*pz); + } + } + list->a[list->nSrc].iCursor = -1; + list->nSrc++; + return list; +} + +/* + * __src_list_assign_cursors -- + * Assign cursors to all tables in a src_list_t. + * + * __src_list_assign_cursors __P((parser_t *, src_list_t *)); + */ +void +__src_list_assign_cursors(parser, list) + parser_t *parser; + src_list_t *list; +{ + int i; + for (i = 0; i < list->nSrc; i++) { + if (list->a[i].iCursor < 0) { + list->a[i].iCursor = parser->nTab++; + } + } +} + +/* + * __src_list_add_alias -- + * Add an alias to the last identifier on the given identifier list. + * + * PUBLIC: void __src_list_add_alias __P((src_list_t *, token_t *)); + */ +void +__src_list_add_alias(list, token) + src_list_t *list; + token_t *token; +{ + if (list && list->nSrc > 0) { + int i = list->nSrc - 1; + __str_nappend(NULL, &list->a[i].zAlias, token->z, + token->n, NULL); + __str_unquote(list->a[i].zAlias); + } +} + +/* + * __id_list_delete -- + * Delete an id_list_t. + * + * PUBLIC: void __id_list_delete __P((id_list_t *)); + */ +void +__id_list_delete(list) + id_list_t *list; +{ + int i; + if (list == 0) + return; + for (i = 0; i < list->nId; i++) { + __dbsql_free(NULL, list->a[i].zName); + } + __dbsql_free(NULL, list->a); + __dbsql_free(NULL, list); +} + +/* + * __id_list_index -- + * Return the index in list of the identifier named zId. Return -1 + * if not found. + * + * PUBLIC: int __id_list_index __P((id_list_t *, const char *)); + */ +int +__id_list_index(list, name) + id_list_t *list; + const char *name; +{ + int i; + if (list == 0) + return -1; + for (i = 0; i < list->nId; i++) { + if (strcasecmp(list->a[i].zName, name) == 0) + return i; + } + return -1; +} + +/* + * __src_list_delete -- + * Delete an entire src_list_t including all its substructure. + * + * PUBLIC: void __src_list_delete __P((src_list_t *)); + */ +void +__src_list_delete(list) + src_list_t *list; +{ + int i; + if (list == 0) + return; + for (i = 0; i < list->nSrc; i++) { + __dbsql_free(NULL, list->a[i].zDatabase); + __dbsql_free(NULL, list->a[i].zName); + __dbsql_free(NULL, list->a[i].zAlias); + if (list->a[i].pTab && list->a[i].pTab->isTransient) { + __vdbe_delete_table(0, list->a[i].pTab); + } + __select_delete(list->a[i].pSelect); + __expr_delete(list->a[i].pOn); + __id_list_delete(list->a[i].pUsing); + } + __dbsql_free(NULL, list); +} + +/* + * __dbsql_txn_begin -- + * Begin a transaction + * + * PUBLIC: void __dbsql_txn_begin __P((parser_t *, int)); + */ +void +__dbsql_txn_begin(parser, on_error) + parser_t *parser; + int on_error; +{ + DBSQL *dbp; + + if (parser == 0) + return; + dbp = parser->db; + if (dbp == 0 || dbp->aDb[0].pBt == 0) + return; + if (parser->nErr || parser->rc == ENOMEM) + return; + if (__auth_check(parser, DBSQL_TRANSACTION, "BEGIN", 0, 0)) + return; + if (dbp->flags & DBSQL_InTrans) { + __error_msg(parser, + "cannot start a transaction within a transaction"); + return; + } + __vdbe_prepare_write(parser, 0, 0); + dbp->flags |= DBSQL_InTrans; + dbp->onError = on_error; +} + +/* + * __dbsql_txn_commit -- + * Commit a transaction. + * + * PUBLIC: void __dbsql_txn_commit __P((parser_t *)); + */ +void +__dbsql_txn_commit(parser) + parser_t *parser; +{ + DBSQL *dbp; + + if (parser == 0) + return; + dbp = parser->db; + if (dbp == 0 || dbp->aDb[0].pBt==0 ) + return; + if (parser->nErr || parser->rc == ENOMEM) + return; + if (__auth_check(parser, DBSQL_TRANSACTION, "COMMIT", 0, 0)) + return; + if ((dbp->flags & DBSQL_InTrans) == 0) { + __error_msg(parser, + "cannot commit - no transaction is active"); + return; + } + dbp->flags &= ~DBSQL_InTrans; + __vdbe_conclude_write(parser); + dbp->onError = OE_Default; +} + +/* + * __dbsql_txn_abort -- + * Rollback (aka abort) a transaction. + * + * PUBLIC: void __dbsql_txn_abort __P((parser_t *)); + */ +void +__dbsql_txn_abort(parser) + parser_t *parser; +{ + DBSQL *dbp; + vdbe_t *v; + + if (parser == 0) + return; + dbp = parser->db; + if (dbp == 0 || dbp->aDb[0].pBt == 0) + return; + if (parser->nErr || parser->rc == ENOMEM) + return; + if (__auth_check(parser, DBSQL_TRANSACTION, "ROLLBACK", 0, 0)) + return; + if ((dbp->flags & DBSQL_InTrans) == 0) { + __error_msg(parser, + "cannot rollback - no transaction is active"); + return; + } + v = __parser_get_vdbe(parser); + if (v) { + __vdbe_add_op(v, OP_Rollback, 0, 0); + } + dbp->flags &= ~DBSQL_InTrans; + dbp->onError = OE_Default; +} + +/* + * __code_verify_schema -- + * Generate VDBE code that will verify the schema signature for all + * named database files. + * + * PUBLIC: void __code_verify_schema __P((parser_t *, int)); + */ +void __code_verify_schema(parser, idb) + parser_t *parser; + int idb; +{ + DBSQL *dbp = parser->db; + vdbe_t *v = __parser_get_vdbe(parser); + DBSQL_ASSERT(idb >= 0 && idb < dbp->nDb); + DBSQL_ASSERT(dbp->aDb[idb].pBt != 0); + if (idb != 1 && !DB_PROPERTY_HAS_VALUE(dbp, idb, DBSQL_COOKIE)) { + __vdbe_add_op(v, OP_VerifySchemaSignature, idb, + dbp->aDb[idb].schema_sig); + DB_PROPERTY_SET(dbp, idb, DBSQL_COOKIE); + } +} + +/* + * __vdbe_prepare_write -- + * Generate VDBE code that prepares for doing an operation that + * might change the database. + * This routine starts a new transaction if we are not already within + * a transaction. If we are already within a transaction, then a + * checkpoint is set if the 'checkpoint' parameter is true. A + * checkpoint should be set for operations that might fail (due to a + * constraint) part of the way through and which will need to undo + * some writes without having to rollback the whole transaction. For + * operations where all constraints can be checked before any changes + * are made to the database, it is never necessary to undo a write and + * the checkpoint should not be set. + * Only database 'idb' and the temp database are made writable by this + * call. + * If idb==0, then the main and temp databases are made writable. If + * idb==1 then only the temp database is made writable. If idb>1 then + * the specified auxiliary database and the temp database are made + * writable. + * + * PUBLIC: void __vdbe_prepare_write __P((parser_t*, int, int)); + */ +void +__vdbe_prepare_write(parser, checkpoint, idb) + parser_t *parser; + int checkpoint; + int idb; +{ + vdbe_t *v; + DBSQL *dbp = parser->db; + if (DB_PROPERTY_HAS_VALUE(dbp, idb, DBSQL_SCHEMA_LOCKED)) + return; + v = __parser_get_vdbe(parser); + if (v == 0) + return; + if (!dbp->aDb[idb].inTrans) { + __vdbe_add_op(v, OP_Transaction, 0, 0); + DB_PROPERTY_SET(dbp, idb, DBSQL_SCHEMA_LOCKED); + __code_verify_schema(parser, idb); + if (idb != 1) { + __vdbe_prepare_write(parser, checkpoint, 1); + } + } else if (checkpoint) { + __vdbe_add_op(v, OP_Checkpoint, idb, 0); + DB_PROPERTY_SET(dbp, idb, DBSQL_SCHEMA_LOCKED); /*TODO why?*/ + } +} + +/* + * __vdbe_conclude_write -- + * Generate code that concludes an operation that may have changed + * the database. If a statement transaction was started, then emit + * an OP_Commit that will cause the changes to be committed to disk. + * Note that checkpoints are automatically committed at the end of + * a statement. Note also that there can be multiple calls to + * __vdbe_prepare_write() but there should only be a single + * call to __vdbe_conclude_write() at the conclusion of the statement. + * + * PUBLIC: void __vdbe_conclude_write __P((parser_t *)); + */ +void +__vdbe_conclude_write(parser) + parser_t *parser; +{ + vdbe_t *v; + DBSQL *dbp = parser->db; + if (parser->trigStack) + return; /* if this is in a trigger */ + v = __parser_get_vdbe(parser); + if (v == 0) + return; + if (dbp->flags & DBSQL_InTrans) { + /* + * A BEGIN has executed. Do not commit until we see an + * explicit COMMIT statement. + */ + } else { + __vdbe_add_op(v, OP_Commit, 0, 0); + } +} diff --git a/src/cg_copy.c b/src/cg_copy.c new file mode 100644 index 0000000..06d47a8 --- /dev/null +++ b/src/cg_copy.c @@ -0,0 +1,154 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_copy.c 7 2007-02-03 13:34:17Z gburd $ + */ + + +/* + * This file contains code used to implement the COPY command. + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +/* + * __copy -- + * The COPY command is for compatibility with PostgreSQL and specificially + * for the ability to read the output of pg_dump. The format is as + * follows: + * + * COPY table FROM file [USING DELIMITERS string] + * + * "table" is an existing table name. We will read lines of code from + * file to fill this table with data. File might be "stdin". The + * optional delimiter string identifies the field separators. The + * default is a tab. + * + * PUBLIC: void __copy __P((parser_t *, src_list_t *, token_t *, + * PUBLIC: token_t *, int)); + * + * parser The parser context + * table_name The name of the table into which we will insert + * filename The file from which to obtain information + * delimiter Use this as the field delimiter + * on_error What to do if a constraint fails + */ +void __copy(parser, table_name, filename, delimiter, on_error) + parser_t *parser; + src_list_t *table_name; + token_t *filename; + token_t *delimiter; + int on_error; +{ + table_t *table; + int i; + vdbe_t *v; + int addr, end; + index_t *index; + char *file = 0; + const char *db_name; + DBSQL *db = parser->db; + + if (parser->rc != DBSQL_SUCCESS) + goto copy_cleanup; + DBSQL_ASSERT(table_name->nSrc == 1); + table = __src_list_lookup(parser, table_name); + if (table==0 || __is_table_read_only(parser, table, 0)) + goto copy_cleanup; + __dbsql_strndup(parser->db, filename->z, &file, filename->n); + __str_unquote(file); + DBSQL_ASSERT(table->iDb < db->nDb); + db_name = db->aDb[table->iDb].zName; + if (__auth_check(parser, DBSQL_INSERT, table->zName, 0, db_name) || + __auth_check(parser, DBSQL_COPY, table->zName, file, db_name)) { + goto copy_cleanup; + } + v = __parser_get_vdbe(parser); + if (v) { + __vdbe_prepare_write(parser, 1, table->iDb); + addr = __vdbe_add_op(v, OP_FileOpen, 0, 0); + __vdbe_change_p3(v, addr, filename->z, filename->n); + __vdbe_dequote_p3(v, addr); + __vdbe_add_op(v, OP_Integer, table->iDb, 0); + __vdbe_add_op(v, OP_OpenWrite, 0, table->tnum); + __vdbe_change_p3(v, -1, table->zName, P3_STATIC); + for(i = 1, index = table->pIndex; index; + index=index->pNext, i++) { + DBSQL_ASSERT(index->iDb == 1 || index->iDb == table->iDb); + __vdbe_add_op(v, OP_Integer, index->iDb, 0); + __vdbe_add_op(v, OP_OpenWrite, i, index->tnum); + __vdbe_change_p3(v, -1, index->zName, P3_STATIC); + } + if (db->flags & DBSQL_CountRows) { + /* Initialize the row count */ + __vdbe_add_op(v, OP_Integer, 0, 0); + } + end = __vdbe_make_label(v); + addr = __vdbe_add_op(v, OP_FileRead, table->nCol, end); + if (delimiter) { + __vdbe_change_p3(v, addr, delimiter->z, delimiter->n); + __vdbe_dequote_p3(v, addr); + } else { + __vdbe_change_p3(v, addr, "\t", 1); + } + if (table->iPKey >= 0) { + __vdbe_add_op(v, OP_FileColumn, table->iPKey, 0); + __vdbe_add_op(v, OP_MustBeInt, 0, 0); + } else { + __vdbe_add_op(v, OP_NewRecno, 0, 0); + } + for(i = 0; i < table->nCol; i++) { + if (i == table->iPKey) { + /* + * The integer primary key column is filled + * with NULL since its value is always pulled + * from the record number. + */ + __vdbe_add_op(v, OP_String, 0, 0); + } else { + __vdbe_add_op(v, OP_FileColumn, i, 0); + } + } + __generate_constraint_checks(parser, table, 0, 0, + (table->iPKey >= 0), 0, on_error, + addr); + __complete_insertion(parser, table, 0, 0, 0, 0, -1); + if ((db->flags & DBSQL_CountRows) != 0) { + /* Increment row count */ + __vdbe_add_op(v, OP_AddImm, 1, 0); + } + __vdbe_add_op(v, OP_Goto, 0, addr); + __vdbe_resolve_label(v, end); + __vdbe_add_op(v, OP_Noop, 0, 0); + __vdbe_conclude_write(parser); + if (db->flags & DBSQL_CountRows) { + __vdbe_add_op(v, OP_ColumnName, 0, 0); + __vdbe_change_p3(v, -1, "rows inserted", P3_STATIC); + __vdbe_add_op(v, OP_Callback, 1, 0); + } + } + +copy_cleanup: + __src_list_delete(table_name); + __dbsql_free(parser->db, file); + return; +} diff --git a/src/cg_date.c b/src/cg_date.c new file mode 100644 index 0000000..46e9d57 --- /dev/null +++ b/src/cg_date.c @@ -0,0 +1,1052 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_date.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains routines that handle date and time functions. + */ + +/* + * IMPLEMENTATION NOTES: + * + * All times and dates are managed as Julian Day numbers. The + * dates and times are stored as the number of days since noon + * in Greenwich on November 24, 4714 B.C. according to the Gregorian + * calendar system. + * + * 1970-01-01 00:00:00 is JD 2440587.5 + * 2000-01-01 00:00:00 is JD 2451544.5 + * + * This implemention requires years to be expressed as a 4-digit number + * which means that only dates between 0000-01-01 and 9999-12-31 can + * be represented, even though julian day numbers allow a much wider + * range of dates. + * + * The Gregorian calendar system is used for all dates and times, + * even those that predate the Gregorian calendar. Historians usually + * use the Julian calendar for dates prior to 1582-10-15 and for some + * dates afterwards, depending on locale. Beware of this difference. + * + * The conversion algorithms are implemented based on descriptions + * in the following text: + * + * Jean Meeus + * Astronomical Algorithms, 2nd Edition, 1998 + * ISBN 0-943396-61-1 + * Willmann-Bell, Inc + * Richmond, Virginia (USA) + */ + +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#include +#endif + +#include "dbsql_int.h" + + +#ifndef DBSQL_OMIT_DATETIME_FUNCS + +/* + * A structure for holding a single date and time. + */ +typedef struct { + double rJD; /* The julian day number */ + int Y, M, D; /* Year, month, and day */ + int h, m; /* Hour and minutes */ + int tz; /* Timezone offset in minutes */ + double s; /* Seconds */ + char validYMD; /* True if Y,M,D are valid */ + char validHMS; /* True if h,m,s are valid */ + char validJD; /* True if rJD is valid */ + char validTZ; /* True if tz is valid */ +} datetime_t; + + +/* + * __get_ndigits_as_int -- + * Convert N digits from 'date' into an integer. Return + * -1 if 'date' does not begin with N digits. + * + * STATIC: static int __get_ndigits_as_int __P((const char *, int)); + */ +static int +__get_ndigits_as_int(date, n) + const char *date; + int n; +{ + int val = 0; + while (n--) { + if (!isdigit(*date)) + return -1; + val = (val * 10) + (*date - '0'); + date++; + } + return val; +} + +/* + * __convert_str_to_double -- + * Read text from z[] and convert into a floating point number. + * Place the result in 'result'. Return the number of digits converted. + * + * STATIC: int __convert_str_to_double __P((const char *, double *)); + */ +static int +__convert_str_to_double(date, result) + const char *date; + double *result; +{ + double r = 0.0; + double divide = 1.0; + int neg_p = 0; + int num_char = 0; + if (*date == '+') { + date++; + num_char++; + } else if (*date == '-') { + date++; + neg_p = 1; + num_char++; + } + if (!isdigit(*date)) + return 0; + while(isdigit(*date)) { + r = (r * 10.0) + (*date - '0'); + num_char++; + date++; + } + if (*date == '.' && isdigit(date[1])) { + date++; + num_char++; + while(isdigit(*date)) { + r = (r * 10.0) + (*date - '0'); + divide *= 10.0; + num_char++; + date++; + } + r /= divide; + } + if (*date != 0 && !isspace(*date)) + return 0; + *result = neg_p ? -r : r; + return num_char; +} + +/* + * __parser_tz -- + * Parse a timezone extension on the end of a date-time. + * The extension is of the form: + * + * (+/-)HH:MM + * + * If the parse is successful, write the number of minutes + * of change in *pnMin and return 0. If a parser error occurs, + * return 0. + * + * A missing specifier is not considered an error. + * + * STATIC: int __parse_tz __P((const char *, datetime_t *)); + */ +static int +__parse_tz(date, dt) + const char *date; + datetime_t *dt; +{ + int sgn = 0; + int hr, mn; + while(isspace(*date)) { + date++; + } + dt->tz = 0; + if (*date == '-') { + sgn = -1; + } else if (*date == '+') { + sgn = +1; + } else { + return *date != 0; + } + date++; + hr = __get_ndigits_as_int(date, 2); + if (hr < 0 || hr > 14) + return 1; + date += 2; + if (date[0] != ':') + return 1; + date++; + mn = __get_ndigits_as_int(date, 2); + if (mn < 0 || mn > 59) + return 1; + date += 2; + dt->tz = sgn * (mn + (hr * 60)); + while(isspace(*date)) { + date++; + } + return (*date != 0); +} + +/* + * __parse_hh_mm_ss -- + * Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF. + * The HH, MM, and SS must each be exactly 2 digits. The + * fractional seconds FFFF can be one or more digits. + * + * Return 1 if there is a parsing error and 0 on success. + * + * STATIC: static int __parse_hh_mm_ss __P((const char *, datetime_t *)); + */ +static int +__parse_hh_mm_ss(date, dt) + const char *date; + datetime_t *dt; +{ + int h, m, s; + double ms = 0.0; + h = __get_ndigits_as_int(date, 2); + if (h < 0 || date[2] != ':') + return 1; + date += 3; + m = __get_ndigits_as_int(date, 2); + if (m < 0 || m > 59) + return 1; + date += 2; + if (*date == ':') { + s = __get_ndigits_as_int(&date[1], 2); + if (s < 0 || s > 59) + return 1; + date += 3; + if (*date == '.' && isdigit(date[1])) { + double scale = 1.0; + date++; + while(isdigit(*date)) { + ms = (ms * 10.0) + (*date - '0'); + scale *= 10.0; + date++; + } + ms /= scale; + } + } else { + s = 0; + } + dt->validJD = 0; + dt->validHMS = 1; + dt->h = h; + dt->m = m; + dt->s = s + ms; + if (__parse_tz(date, dt)) + return 1; + dt->validTZ = (dt->tz != 0); + return 0; +} + +/* + * __compute_jd + * Convert from YYYY-MM-DD HH:MM:SS to julian day. We always assume + * that the YYYY-MM-DD is according to the Gregorian calendar. + * Reference: Meeus page 61 + * + * STATIC: static void compute_jd __P((datetime_t *)); + */ +static void +__compute_jd(dt) + datetime_t *dt; +{ + int Y, M, D, A, B, X1, X2; + + if (dt->validJD) + return; + if(dt->validYMD) { + Y = dt->Y; + M = dt->M; + D = dt->D; + } else { + Y = 2000; /* If no YMD specified, assume 2000-Jan-01 */ + M = 1; + D = 1; + } + if (M <= 2) { + Y--; + M += 12; + } + A = Y/100; + B = 2 - A + (A/4); + X1 = 365.25 * (Y + 4716); + X2 = 30.6001 * (M + 1); + dt->rJD = X1 + X2 + D + B - 1524.5; + dt->validJD = 1; + dt->validYMD = 0; + if (dt->validHMS) { + dt->rJD += ((dt->h * 3600.0) + (dt->m * 60.0) + dt->s)/86400.0; + if (dt->validTZ) { + dt->rJD += (dt->tz * 60) / 86400.0; + dt->validHMS = 0; + dt->validTZ = 0; + } + } +} + +/* + * __parse_yyyy_mm_dd -- + * Parse dates of the form + * + * YYYY-MM-DD HH:MM:SS.FFF + * YYYY-MM-DD HH:MM:SS + * YYYY-MM-DD HH:MM + * YYYY-MM-DD + * + * Write the result into the datetime_t structure and return 0 + * on success and 1 if the input string is not a well-formed + * date. + * + * STATIC: int __parse_yyyy_mm_dd __P((const char *, datetime_t *)); + */ +static int +__parse_yyyy_mm_dd(date, dt) + const char *date; + datetime_t *dt; +{ + int Y, M, D; + + Y = __get_ndigits_as_int(date, 4); + if (Y < 0 || date[4] != '-') + return 1; + date += 5; + M = __get_ndigits_as_int(date, 2); + if (M <= 0 || M > 12 || date[2] != '-') + return 1; + date += 3; + D = __get_ndigits_as_int(date, 2); + if (D <= 0 || D > 31) + return 1; + date += 2; + while(isspace(*date)) { + date++; + } + if (isdigit(*date)) { + if (__parse_hh_mm_ss(date, dt)) + return 1; + } else if (*date == 0) { + dt->validHMS = 0; + } else { + return 1; + } + dt->validJD = 0; + dt->validYMD = 1; + dt->Y = Y; + dt->M = M; + dt->D = D; + if (dt->validTZ) { + __compute_jd(dt); + } + return 0; +} + +/* + * __parse_date_or_time -- + * Attempt to parse the given string into a Julian Day Number. Return + * the number of errors. + * + * The following are acceptable forms for the input string: + * + * YYYY-MM-DD HH:MM:SS.FFF +/-HH:MM + * DDDD.DD + * now + * + * In the first form, the +/-HH:MM is always optional. The fractional + * seconds extension (the ".FFF") is optional. The seconds portion + * (":SS.FFF") is option. The year and date can be omitted as long + * as there is a time string. The time string can be omitted as long + * as there is a year and date. + * + * STATIC: static int __parse_date_or_time __P((const char *, datetime_t *)); + */ +static int +__parse_date_or_time(date, dt) + const char *date; + datetime_t *dt; +{ + int i = 0; + memset(dt, 0, sizeof(*dt)); + while (isdigit(date[i])) { + i++; + } + if (i == 4 && date[i] == '-') { + return __parse_yyyy_mm_dd(date, dt); + } else if (i == 2 && date[i] == ':') { + return __parse_hh_mm_ss(date, dt); + return 0; + } else if (i == 0 && strcasecmp(date, "now") == 0) { + double r; + if (__os_jtime(&r) == 0) { + dt->rJD = r; + dt->validJD = 1; + return 0; + } + return 1; + } else if (__str_is_numeric(date)) { + dt->rJD = __dbsql_atof(date); + dt->validJD = 1; + return 0; + } + return 1; +} + +/* + * __compute_ymd -- + * Compute the Year, Month, and Day from the julian day number. + * + * STATIC: static void __compute_ymd __P((datetime_t *)); + */ +static void +__compute_ymd(dt) + datetime_t *dt; +{ + int Z, A, B, C, D, E, X1; + if (dt->validYMD) + return; + Z = dt->rJD + 0.5; + A = (Z - 1867216.25) / 36524.25; + A = Z + 1 + A - (A/4); + B = A + 1524; + C = (B - 122.1)/365.25; + D = 365.25 * C; + E = (B - D) / 30.6001; + X1 = 30.6001 * E; + dt->D = B - D - X1; + dt->M = (E < 14) ? (E - 1) : (E - 13); + dt->Y = (dt->M > 2) ? (C - 4716) : (C - 4715); + dt->validYMD = 1; +} + +/* + * __compute_hms -- + * Compute the Hour, Minute, and Seconds from the julian day number. + * + * STATIC: static void __compute_hms __P((datetime_t *)); + */ +static void +__compute_hms(dt) + datetime_t *dt; +{ + int Z, s; + if (dt->validHMS) + return; + Z = dt->rJD + 0.5; + s = ((dt->rJD + 0.5 - Z) * 86400000.0) + 0.5; + dt->s = 0.001 * s; + s = dt->s; + dt->s -= s; + dt->h = s / 3600; + s -= dt->h * 3600; + dt->m = s / 60; + dt->s += s - dt->m * 60; + dt->validHMS = 1; +} + +/* + * __compute_ymd_hms -- + * Compute both YMD and HMS + * + * STATIC: static void __compute_ymd_hms __P((datetime_t *)); + */ +static void +__compute_ymd_hms(dt) + datetime_t *dt; +{ + __compute_ymd(dt); + __compute_hms(dt); +} + +/* + * __clear_ymd_hms_tz -- + * Clear the YMD and HMS and the TZ. + * + * STATIC: static void __clear_ymd_hms_tz __P((datetime_t *)); + */ +static void +__clear_ymd_hms_tz(dt) + datetime_t *dt; +{ + dt->validYMD = 0; + dt->validHMS = 0; + dt->validTZ = 0; +} + +/* + * __localtime_offset -- + * Compute the difference (in days) between localtime and UTC (a.k.a. GMT) + * for the time value 'dt' where 'dt' is in UTC. + * + * STATIC: static double __localtime_offset __P((datetime_t *)); + */ +static double +__localtime_offset(dt) + datetime_t *dt; +{ + datetime_t x, y; + time_t t; + struct tm tm; + x = *dt; + __compute_ymd_hms(&x); + if (x.Y < 1971 || x.Y >= 2038) { + x.Y = 2000; + x.M = 1; + x.D = 1; + x.h = 0; + x.m = 0; + x.s = 0.0; + } else { + int s = x.s + 0.5; + x.s = s; + } + x.tz = 0; + x.validJD = 0; + __compute_jd(&x); + t = ((x.rJD - 2440587.5) * 86400.0) + 0.5; + if (localtime_r(&t, &tm) == &tm) { + y.Y = tm.tm_year + 1900; + y.M = tm.tm_mon + 1; + y.D = tm.tm_mday; + y.h = tm.tm_hour; + y.m = tm.tm_min; + y.s = tm.tm_sec; + } + y.validYMD = 1; + y.validHMS = 1; + y.validJD = 0; + y.validTZ = 0; + __compute_jd(&y); + return (y.rJD - x.rJD); +} + +/* + * __parse_modifier -- + * Process a modifier to a date-time stamp. The modifiers are + * as follows: + * + * NNN days + * NNN hours + * NNN minutes + * NNN.NNNN seconds + * NNN months + * NNN years + * start of month + * start of year + * start of week + * start of day + * weekday N + * unixepoch + * localtime + * utc + * + * Return 0 on success and 1 if there is any kind of error. + * + * STATIC: static int __parse_modifier __P((const char *, datetime_t *)); + */ +static int +__parse_modifier(const char *mod, datetime_t *dt) +{ + int n, x, y; + int rc = 1; + double r, c1; + char *z, buf[30]; + z = buf; + for (n = 0; n < (sizeof(buf) - 1) && mod[n]; n++) { + z[n] = tolower(mod[n]); + } + z[n] = 0; + switch(z[0]) { + case 'l': + /* + * localtime + * + * Assuming the current time value is UTC (a.k.a. GMT), + * shift it to show local time. + */ + if (strcmp(z, "localtime") == 0) { + __compute_jd(dt); + dt->rJD += __localtime_offset(dt); + __clear_ymd_hms_tz(dt); + rc = 0; + } + break; + case 'u': + /* + * unixepoch + * + * Treat the current value of dt->rJD as the number of + * seconds since 1970. Convert to a real julian day number. + */ + if (strcmp(z, "unixepoch") == 0 && dt->validJD) { + dt->rJD = (dt->rJD / 86400.0) + 2440587.5; + __clear_ymd_hms_tz(dt); + rc = 0; + } else if (strcmp(z, "utc") == 0) { + __compute_jd(dt); + c1 = __localtime_offset(dt); + dt->rJD -= c1; + __clear_ymd_hms_tz(dt); + dt->rJD += (c1 - __localtime_offset(dt)); + rc = 0; + } + break; + case 'w': + /* + * weekday N + * + * Move the date to the same time on the next occurrance of + * weekday N where 0==Sunday, 1==Monday, and so forth. If the + * date is already on the appropriate weekday, this is a no-op. + */ + if (strncmp(z, "weekday ", 8) == 0 && + (__convert_str_to_double(&z[8], &r) > 0) && + ((n = r) == r) && (n >= 0) && (r < 7)) { + int Z; + __compute_ymd_hms(dt); + dt->validTZ = 0; + dt->validJD = 0; + __compute_jd(dt); + Z = dt->rJD + 1.5; + Z %= 7; + if (Z > n) + Z -= 7; + dt->rJD += (n - Z); + __clear_ymd_hms_tz(dt); + rc = 0; + } + break; + case 's': + /* + * start of TTTTT + * + * Move the date backwards to the beginning of the current day, + * or month or year. + */ + if (strncmp(z, "start of ", 9) != 0) + break; + z += 9; + __compute_ymd(dt); + dt->validHMS = 1; + dt->h = dt->m = 0; + dt->s = 0.0; + dt->validTZ = 0; + dt->validJD = 0; + if (strcmp(z, "month") == 0) { + dt->D = 1; + rc = 0; + } else if (strcmp(z, "year") == 0) { + __compute_ymd(dt); + dt->M = 1; + dt->D = 1; + rc = 0; + } else if (strcmp(z, "day") == 0) { + rc = 0; + } + break; + case '+': /* FALLTHROUGH */ + case '-': /* FALLTHROUGH */ + case '0': /* FALLTHROUGH */ + case '1': /* FALLTHROUGH */ + case '2': /* FALLTHROUGH */ + case '3': /* FALLTHROUGH */ + case '4': /* FALLTHROUGH */ + case '5': /* FALLTHROUGH */ + case '6': /* FALLTHROUGH */ + case '7': /* FALLTHROUGH */ + case '8': /* FALLTHROUGH */ + case '9': + n = __convert_str_to_double(z, &r); + if (n <= 0) + break; + z += n; + while(isspace(z[0])) + z++; + n = strlen(z); + if (n > 10 || n < 3) + break; + if (z[n-1] == 's') { + z[n-1] = 0; + n--; + } + __compute_jd(dt); + rc = 0; + if (n == 3 && strcmp(z, "day") == 0) { + dt->rJD += r; + } else if (n == 4 && strcmp(z, "hour") == 0) { + dt->rJD += (r / 24.0); + } else if (n == 6 && strcmp(z, "minute") == 0) { + dt->rJD += (r / (24.0 * 60.0)); + } else if (n == 6 && strcmp(z, "second") == 0) { + dt->rJD += (r / (24.0 * 60.0 * 60.0)); + } else if (n == 5 && strcmp(z, "month") == 0) { + __compute_ymd_hms(dt); + dt->M += r; + x = (dt->M > 0) ? + ((dt->M - 1) / 12) : + ((dt->M-12) / 12); + dt->Y += x; + dt->M -= (x * 12); + dt->validJD = 0; + __compute_jd(dt); + y = r; + if (y != r) { + dt->rJD += ((r - y) * 30.0); + } + } else if (n == 4 && strcmp(z, "year") == 0) { + __compute_ymd_hms(dt); + dt->Y += r; + dt->validJD = 0; + __compute_jd(dt); + } else { + rc = 1; + } + __clear_ymd_hms_tz(dt); + break; + default: + break; + } + return rc; +} + +/* + * __is_date -- + * Process time function arguments. argv[0] is a date-time stamp. + * argv[1] and following are modifiers. Parse them all and write + * the resulting time into the datetime_t structure p. Return 0 + * on success and 1 if there are any errors. + * + * STATIC: static int __is_date __P((int, const char **, datetime_t *)); + */ +static int +__is_date(argc, argv, dt) + int argc; + const char **argv; + datetime_t *dt; +{ + int i; + if (argc == 0) + return 1; + if (argv[0] == 0 || __parse_date_or_time(argv[0], dt)) + return 1; + for (i = 1; i < argc; i++) { + if (argv[i] == 0 || __parse_modifier(argv[i], dt)) + return 1; + } + return 0; +} + +/* + * __julianday_sql_func -- + * julianday( TIMESTRING, MOD, MOD, ...) + * + * Return the julian day number of the date specified in the arguments + * + * STATIC: static void __julianday_sql_func __P((dbsql_func_t *, int, + * STATIC: const char **)); + */ +static void +__julianday_sql_func(context, argc, argv) + dbsql_func_t *context; + int argc; + const char **argv; +{ + datetime_t dt; + if (__is_date(argc, argv, &dt) == 0) { + __compute_jd(&dt); + dbsql_set_result_double(context, dt.rJD); + } +} + +/* + * __datetime_sql_func -- + * datetime( TIMESTRING, MOD, MOD, ...) + * + * Return YYYY-MM-DD HH:MM:SS + * + * STATIC: static void __datetime__sql_func __P((dbsql_func_t *, int, + * STATIC: const char **)); + */ +static void +__datetime_sql_func(context, argc, argv) + dbsql_func_t *context; + int argc; + const char **argv; +{ + datetime_t dt; + if (__is_date(argc, argv, &dt) == 0) { + char buf[100]; + __compute_ymd_hms(&dt); + sprintf(buf, "%04d-%02d-%02d %02d:%02d:%02d", + dt.Y, dt.M, dt.D, dt.h, dt.m, (int)(dt.s)); + dbsql_set_result_string(context, buf, -1); + } +} + +/* + * __time_sql_func -- + * time( TIMESTRING, MOD, MOD, ...) + * + * Return HH:MM:SS + * STATIC: static void __time_sql_func __P((dbsql_func_t *, int, const char **)); + */ +static void +__time_sql_func(context, argc, argv) + dbsql_func_t *context; + int argc; + const char **argv; +{ + datetime_t dt; + if (__is_date(argc, argv, &dt) == 0) { + char buf[100]; + __compute_hms(&dt); + sprintf(buf, "%02d:%02d:%02d", dt.h, dt.m, (int)dt.s); + dbsql_set_result_string(context, buf, -1); + } +} + +/* + * __date_sql_func -- + * date( TIMESTRING, MOD, MOD, ...) + * + * Return YYYY-MM-DD + * + * STATIC: static void __date_sql_func __P((dbsql_func_t *, int, const char **)); + */ +static void +__date_sql_func(context, argc, argv) + dbsql_func_t *context; + int argc; + const char **argv; +{ + datetime_t dt; + if (__is_date(argc, argv, &dt) == 0) { + char buf[100]; + __compute_ymd(&dt); + sprintf(buf, "%04d-%02d-%02d", dt.Y, dt.M, dt.D); + dbsql_set_result_string(context, buf, -1); + } +} + +/* + * __strftime_sql_func -- + * strftime( FORMAT, TIMESTRING, MOD, MOD, ...) + * + * Return a string described by FORMAT. Conversions as follows: + * + * %d day of month + * %f ** fractional seconds SS.SSS + * %H hour 00-24 + * %j day of year 000-366 + * %J ** Julian day number + * %m month 01-12 + * %M minute 00-59 + * %s seconds since 1970-01-01 + * %S seconds 00-59 + * %w day of week 0-6 sunday==0 + * %W week of year 00-53 + * %Y year 0000-9999 + * %% % + * + * STATIC: static void __strftime_sql_func __P((dbsql_func_t *, int, + * STATIC: const char **)); +*/ +static void +__strftime_sql_func(context, argc, argv) + dbsql_func_t *context; + int argc; + const char **argv; +{ + datetime_t dt; + int n, i, j; + char *z; + const char *fmt = argv[0]; + char buf[100]; + + if (argv[0] == 0 || __is_date((argc - 1), (argv + 1), &dt)) + return; + + for (i = 0, n = 1; fmt[i]; i++, n++) { + if (fmt[i] == '%') { + switch(fmt[i + 1]) { + case 'd': /* FALLTHROUGH */ + case 'H': /* FALLTHROUGH */ + case 'm': /* FALLTHROUGH */ + case 'M': /* FALLTHROUGH */ + case 'S': /* FALLTHROUGH */ + case 'W': + n++; + /* FALLTHROUGH */ + case 'w': + case '%': + break; + case 'f': + n += 8; + break; + case 'j': + n += 3; + break; + case 'Y': + n += 8; + break; + case 's': /* FALLTHROUGH */ + case 'J': + n += 50; + break; + default: + return; /* ERROR, return a NULL. */ + } + i++; + } + } + if (n < sizeof(buf)) { + z = buf; + } else { + if (__dbsql_malloc(NULL, n, &z) == ENOMEM) + return; + } + __compute_jd(&dt); + __compute_ymd_hms(&dt); + for (i = j = 0; fmt[i]; i++) { + if (fmt[i] != '%') { + z[j++] = fmt[i]; + } else { + i++; + switch(fmt[i]) { + case 'd': + sprintf(&z[j],"%02d",dt.D); + j += 2; + break; + case 'f': { + int s = dt.s; + int ms = (dt.s - s) * 1000.0; + sprintf(&z[j], "%02d.%03d", s, ms); + j += strlen(&z[j]); + break; + } + case 'H': + sprintf(&z[j], "%02d", dt.h); + j += 2; + break; + case 'W': /* FALLTHROUGH */ + case 'j': { + int n; + datetime_t y = dt; + y.validJD = 0; + y.M = 1; + y.D = 1; + __compute_jd(&y); + n = dt.rJD - y.rJD + 1; + if (fmt[i] == 'W') { + sprintf(&z[j], "%02d", (n + 6) / 7); + j += 2; + } else { + sprintf(&z[j], "%03d", n); + j += 3; + } + break; + } + case 'J': + sprintf(&z[j], "%.16g", dt.rJD); + j += strlen(&z[j]); + break; + case 'm': + sprintf(&z[j], "%02d", dt.M); + j += 2; + break; + case 'M': + sprintf(&z[j], "%02d", dt.m); + j += 2; + break; + case 's': + sprintf(&z[j], "%d", + (int)((dt.rJD-2440587.5)*86400.0 + 0.5)); + j += strlen(&z[j]); + break; + case 'S': + sprintf(&z[j], "%02d", (int)(dt.s + 0.5)); + j += 2; + break; + case 'w': + z[j++] = (((int)(dt.rJD + 1.5)) % 7) + '0'; + break; + case 'Y': + sprintf(&z[j], "%04d", dt.Y); + j += strlen(&z[j]); + break; + case '%': + z[j++] = '%'; + break; + } + } + } + z[j] = 0; + dbsql_set_result_string(context, z, -1); + if (z != buf) { + __dbsql_free(NULL, z); + } +} + + +#endif + +/* + * __register_datetime_funcs -- + * This function registered all of the above C functions as SQL + * functions. This should be the only routine in this file with + * external linkage. + * + * PUBLIC: void __register_datetime_funcs __P((DBSQL *)); + */ +void +__register_datetime_funcs(dbp) + DBSQL *dbp; +{ + static struct { + char *name; + int args; + int type; + void (*func)(dbsql_func_t*, int, const char**); + } funcs[] = { +#ifndef DBSQL_OMIT_DATETIME_FUNCS + { "julianday", -1, DBSQL_NUMERIC, __julianday_sql_func }, + { "date", -1, DBSQL_TEXT, __date_sql_func }, + { "time", -1, DBSQL_TEXT, __time_sql_func }, + { "datetime", -1, DBSQL_TEXT, __datetime_sql_func }, + { "strftime", -1, DBSQL_TEXT, __strftime_sql_func }, +#endif + }; + int i; + + for (i = 0; i < sizeof(funcs) / sizeof(funcs[0]); i++) { + dbp->create_function(dbp, funcs[i].name, funcs[i].args, + DBSQL_UTF8_ENCODED, NULL, funcs[i].func, + NULL, NULL); + if (funcs[i].func) { + dbp->func_return_type(dbp, funcs[i].name, + funcs[i].type); + } + } +} diff --git a/src/cg_delete.c b/src/cg_delete.c new file mode 100644 index 0000000..ad8168c --- /dev/null +++ b/src/cg_delete.c @@ -0,0 +1,500 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_delete.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains C code routines that are called by the parser + * to handle DELETE FROM statements. + */ + +#include "dbsql_config.h" + +#include "dbsql_int.h" + +/* + * __src_list_lookup -- + * Look up every table that is named in 'src'. If any table is not found, + * add an error message to parse->zErrMsg and return NULL. If all tables + * are found, return a pointer to the last table. + * + * PUBLIC: table_t *__src_list_lookup __P((parser_t *, src_list_t *)); + */ +table_t * +__src_list_lookup(parser, src) + parser_t *parser; + src_list_t *src; +{ + table_t *table = 0; + int i; + for (i = 0; i < src->nSrc; i++) { + const char *tb_name = src->a[i].zName; + const char *db_name = src->a[i].zDatabase; + table = __locate_table(parser, tb_name, db_name); + src->a[i].pTab = table; + } + return table; +} + +/* + * __is_table_read_only -- + * Check to make sure the given table is writable. If it is not + * writable, generate an error message and return 1. If it is + * writable return 0; + * + * PUBLIC: int __is_table_read_only __P((parser_t *, table_t *, int)); + */ +int +__is_table_read_only(parser, table, views_ok) + parser_t *parser; + table_t *table; + int views_ok; +{ + if (table->readOnly) { + __error_msg(parser, "table %s may not be modified", + table->zName); + return 1; + } + if (!views_ok && table->pSelect) { + __error_msg(parser, "cannot modify %s because it is a view", + table->zName); + return 1; + } + return 0; +} + +/* + * __delete_from -- + * Process a DELETE FROM statement. + * + * PUBLIC: void __delete_from __P((parser_t *, src_list_t *, expr_t *)); + * + * parser The parser context + * list The table from which we should delete things + * where The WHERE clause. May be null. + */ +void __delete_from(parser, list, where) + parser_t *parser; + src_list_t *list; + expr_t *where; +{ + vdbe_t *v; /* The virtual database engine */ + table_t *table; /* The table from which records will be deleted */ + const char *name; /* Name of database holding 'table' */ + int end, addr; /* A couple addresses of generated code */ + int i; /* Loop counter */ + where_info_t *info; /* Information about the WHERE clause */ + index_t *idx; /* For looping over indices of the table */ + int cur; /* VDBE Cursor number for 'table' */ + DBSQL *dbp; /* Main database structure */ + int view; /* True if attempting to delete from a view */ + auth_context_t context;/* Authorization context */ + int row_triggers_exist = 0;/* True if any triggers exist */ + int before_triggers;/* True if there are BEFORE triggers */ + int after_triggers; /* True if there are AFTER triggers */ + int old_idx = -1; /* Cursor for the OLD table of AFTER triggers */ + + context.pParse = 0; + if (parser->nErr || parser->rc == ENOMEM) { + list = 0; + goto delete_from_cleanup; + } + dbp = parser->db; + DBSQL_ASSERT(list->nSrc == 1); + + /* + * Locate the table which we want to delete. This table has to be + * put in an src_list_t structure because some of the subroutines we + * will be calling are designed to work with multiple tables and expect + * an src_list_t* parameter instead of just a table_t* parameter. + */ + table = __src_list_lookup(parser, list); + if (table == 0) + goto delete_from_cleanup; + before_triggers = __triggers_exist(parser, table->pTrigger, + TK_DELETE, TK_BEFORE, TK_ROW, 0); + after_triggers = __triggers_exist(parser, table->pTrigger, + TK_DELETE, TK_AFTER, TK_ROW, 0); + row_triggers_exist = (before_triggers || after_triggers); + view = (table->pSelect != 0); + if (__is_table_read_only(parser, table, before_triggers)) { + goto delete_from_cleanup; + } + DBSQL_ASSERT(table->iDb < dbp->nDb); + name = dbp->aDb[table->iDb].zName; + if (__auth_check(parser, DBSQL_DELETE, table->zName, 0, name)) { + goto delete_from_cleanup; + } + + /* + * If pTab is really a view, make sure it has been initialized. + */ + if (view && __view_get_column_names(parser, table)) { + goto delete_from_cleanup; + } + + /* + * Allocate a cursor used to store the old.* data for a trigger. + */ + if (row_triggers_exist) { + old_idx = parser->nTab++; + } + + /* + * Resolve the column names in all the expressions. + */ + DBSQL_ASSERT(list->nSrc == 1); + cur = list->a[0].iCursor = parser->nTab++; + if (where) { + if (__expr_resolve_ids(parser, list, 0, where)) { + goto delete_from_cleanup; + } + if (__expr_check(parser, where, 0, 0)) { + goto delete_from_cleanup; + } + } + + /* + * Start the view context. + */ + if (view) { + __auth_context_push(parser, &context, table->zName); + } + + /* + * Begin generating code. + */ + v = __parser_get_vdbe(parser); + if (v == 0) { + goto delete_from_cleanup; + } + __vdbe_prepare_write(parser, row_triggers_exist, table->iDb); + + /* + * If we are trying to delete from a view, construct that view into + * a temporary table. + */ + if (view) { + select_t *vsel = __select_dup(table->pSelect); + __select(parser, vsel, SRT_TempTable, cur, 0, 0, 0); + __select_delete(vsel); + } + + /* + * Initialize the counter of the number of rows deleted, if + * we are counting rows. + */ + if (dbp->flags & DBSQL_CountRows) { + __vdbe_add_op(v, OP_Integer, 0, 0); + } + + /* + * Special case: A DELETE without a WHERE clause deletes everything. + * It is easier just to erase the whole table. Note, however, that + * this means that the row change count will be incorrect. + */ + if (where == 0 && !row_triggers_exist) { + if (dbp->flags & DBSQL_CountRows) { + /* + * If counting rows deleted, just count the total + * number of entries in the table. + */ + int end_of_loop = __vdbe_make_label(v); + int addr; + if (!view) { + __vdbe_add_op(v, OP_Integer, table->iDb, 0); + __vdbe_add_op(v, OP_OpenRead, cur, + table->tnum); + } + __vdbe_add_op(v, OP_Rewind, cur, + (__vdbe_current_addr(v) + 2)); + addr = __vdbe_add_op(v, OP_AddImm, 1, 0); + __vdbe_add_op(v, OP_Next, cur, addr); + __vdbe_resolve_label(v, end_of_loop); + __vdbe_add_op(v, OP_Close, cur, 0); + } + if (!view) { + __vdbe_add_op(v, OP_Clear, table->tnum, table->iDb); + for (idx = table->pIndex; idx; idx = idx->pNext) { + __vdbe_add_op(v, OP_Clear, idx->tnum, + idx->iDb); + } + } + } else { + /* + * The usual case: There is a WHERE clause so we have to + * scan through the table and pick which records to delete. + */ + + /* + * Begin the database scan. + */ + info = __where_begin(parser, list, where, 1, 0); + if (info == 0) + goto delete_from_cleanup; + + /* + * Remember the key of every item to be deleted. + */ + __vdbe_add_op(v, OP_ListWrite, 0, 0); + if (dbp->flags & DBSQL_CountRows) { + __vdbe_add_op(v, OP_AddImm, 1, 0); + } + + /* + * End the database scan loop. + */ + __where_end(info); + + /* + * Open the pseudo-table used to store OLD if there are + * triggers. + */ + if (row_triggers_exist) { + __vdbe_add_op(v, OP_OpenPseudo, old_idx, 0); + } + + /* + * Delete every item whose key was written to the list + * during the database scan. We have to delete items + * after the scan is complete because deleting an item + * can change the scan order. + */ + __vdbe_add_op(v, OP_ListRewind, 0, 0); + end = __vdbe_make_label(v); + + /* + * This is the beginning of the delete loop when there are + * row triggers. + */ + if (row_triggers_exist) { + addr = __vdbe_add_op(v, OP_ListRead, 0, end); + __vdbe_add_op(v, OP_Dup, 0, 0); + if (!view) { + __vdbe_add_op(v, OP_Integer, table->iDb, 0); + __vdbe_add_op(v, OP_OpenRead, cur, + table->tnum); + } + __vdbe_add_op(v, OP_MoveTo, cur, 0); + __vdbe_add_op(v, OP_Recno, cur, 0); + __vdbe_add_op(v, OP_RowData, cur, 0); + __vdbe_add_op(v, OP_PutIntKey, old_idx, 0); + if (!view) { + __vdbe_add_op(v, OP_Close, cur, 0); + } + __code_row_trigger(parser, TK_DELETE, 0, TK_BEFORE, + table, -1, old_idx, + ((parser->trigStack) ? + parser->trigStack->orconf : + OE_Default), addr); + } + + if (!view) { + /* + * Open cursors for the table we are deleting from + * and all its indices. If there are row triggers, + * this happens inside the OP_ListRead loop because + * the cursor have to all be closed before the trigger + * fires. If there are no row triggers, the cursors + * are opened only once on the outside the loop. + */ + parser->nTab = cur + 1; + __vdbe_add_op(v, OP_Integer, table->iDb, 0); + __vdbe_add_op(v, OP_OpenWrite, cur, table->tnum); + for (i = 1, idx = table->pIndex; idx; + i++, idx = idx->pNext) { + __vdbe_add_op(v, OP_Integer, idx->iDb, 0); + __vdbe_add_op(v, OP_OpenWrite, parser->nTab++, + idx->tnum); + } + + /* + * This is the beginning of the delete loop when + * there are no row triggers. + */ + if (!row_triggers_exist) { + addr = __vdbe_add_op(v, OP_ListRead, 0, end); + } + + /* + * Delete the row. + */ + __generate_row_delete(dbp, v, table, cur, + (parser->trigStack == 0)); + } + + /* + * If there are row triggers, close all cursors then invoke + * the AFTER triggers. + */ + if (row_triggers_exist) { + if (!view) { + for(i = 1, idx = table->pIndex; idx; + i++, idx = idx->pNext) { + __vdbe_add_op(v, OP_Close, cur + i, + idx->tnum); + } + __vdbe_add_op(v, OP_Close, cur, 0); + } + __code_row_trigger(parser, TK_DELETE, 0, TK_AFTER, + table, -1, old_idx, + ((parser->trigStack) ? + parser->trigStack->orconf : + OE_Default), addr); + } + + /* + * End of the delete loop. + */ + __vdbe_add_op(v, OP_Goto, 0, addr); + __vdbe_resolve_label(v, end); + __vdbe_add_op(v, OP_ListReset, 0, 0); + + /* + * Close the cursors after the loop if there are no row + * triggers. + */ + if (!row_triggers_exist) { + for (i = 1, idx = table->pIndex; idx; + i++, idx = idx->pNext) { + __vdbe_add_op(v, OP_Close, cur + i, idx->tnum); + } + __vdbe_add_op(v, OP_Close, cur, 0); + parser->nTab = cur; + } + } + __vdbe_conclude_write(parser); + + /* + * Return the number of rows that were deleted. + */ + if (dbp->flags & DBSQL_CountRows) { + __vdbe_add_op(v, OP_ColumnName, 0, 0); + __vdbe_change_p3(v, -1, "rows deleted", P3_STATIC); + __vdbe_add_op(v, OP_Callback, 1, 0); + } + + delete_from_cleanup: + __auth_context_pop(&context); + __src_list_delete(list); + __expr_delete(where); + return; +} + +/* + * __generate_row_delete -- + * This routine generates VDBE code that causes a single row of a + * single table to be deleted. + * + * The VDBE must be in a particular state when this routine is called. + * These are the requirements: + * + * 1. A read/write cursor pointing to 'table', the table containing + * the row to be deleted, must be opened as cursor number "base". + * + * 2. Read/write cursors for all indices of pTab must be open as + * cursor number base+i for the i-th index. + * + * 3. The record number of the row to be deleted must be on the top + * of the stack. + * + * This routine pops the top of the stack to remove the record number + * and then generates code to remove both the table record and all index + * entries that point to that record. + * + * PUBLIC: void __generate_row_delete __P((DBSQL *, vdbe_t *, table_t *, + * PUBLIC: int, int)); + * + * dbp The database containing the index + * v Generate code into this VDBE + * table Table containing the row to be deleted + * cur Cursor number for the table + * count Increment the row change counter + */ +void __generate_row_delete(dbp, v, table, cur, count) + DBSQL *dbp; + vdbe_t *v; + table_t *table; + int cur; + int count; +{ + int addr; + addr = __vdbe_add_op(v, OP_NotExists, cur, 0); + __generate_row_index_delete(dbp, v, table, cur, 0); + __vdbe_add_op(v, OP_Delete, cur, count); + __vdbe_change_p2(v, addr, __vdbe_current_addr(v)); +} + +/* + * __generate_row_index_delete -- + * This routine generates VDBE code that causes the deletion of all + * index entries associated with a single row of a single table. + * + * The VDBE must be in a particular state when this routine is called. + * These are the requirements: + * + * 1. A read/write cursor pointing to 'table', the table containing + * the row to be deleted, must be opened as cursor number 'cur'. + * + * 2. Read/write cursors for all indices of 'table' must be open as + * cursor number cur+i for the i-th index. + * + * 3. The 'cur' cursor must be pointing to the row that is to be + * deleted. + * + * PUBLIC: void __generate_row_index_delete __P((DBSQL *, vdbe_t *, + * PUBLIC: table_t *, int, char *)); + * + * dbp The database containing the index + * v Generate code into this VDBE + * table Table containing the row to be deleted + * cur Cursor number for the table + * idx_used Only delete if aIdxUsed!=0 && aIdxUsed[i]!=0 + */ +void __generate_row_index_delete(dbp, v, table, cur, idx_used) + DBSQL *dbp; + vdbe_t *v; + table_t *table; + int cur; + char *idx_used; +{ + int i; + index_t *idx; + + for (i = 1, idx = table->pIndex; idx; i++, idx = idx->pNext) { + int j; + if (idx_used != 0 && idx_used[i-1] == 0) + continue; + __vdbe_add_op(v, OP_Recno, cur, 0); + for (j = 0; j < idx->nColumn; j++) { + int n = idx->aiColumn[j]; + if (n == table->iPKey) { + __vdbe_add_op(v, OP_Dup, j, 0); + } else { + __vdbe_add_op(v, OP_Column, cur, n); + } + } + __vdbe_add_op(v, OP_MakeIdxKey, idx->nColumn, 0); + __add_idx_key_type(v, idx); + __vdbe_add_op(v, OP_IdxDelete, cur + i, 0); + } +} diff --git a/src/cg_expr.c b/src/cg_expr.c new file mode 100644 index 0000000..0bc2398 --- /dev/null +++ b/src/cg_expr.c @@ -0,0 +1,1980 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_expr.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains routines used for analyzing expressions and + * for generating VDBE code that evaluates expressions in SQLite. + */ + +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "dbsql_int.h" + +/* + * __expr -- + * Construct a new expression node and return a pointer to it. Memory + * for this node is obtained from __dbsql_calloc(). The calling function + * is responsible for making sure the node eventually gets freed. + * + * PUBLIC: expr_t *__expr __P((int, expr_t *, expr_t *, token_t *)); + */ +expr_t * +__expr(op, left, right, token) + int op; + expr_t *left; + expr_t *right; + token_t *token; +{ + expr_t *new; + if (__dbsql_calloc(NULL, 1, sizeof(expr_t), &new) == ENOMEM) { + /* TODO If malloc fails, we leak memory from left and right */ + return 0; + } + new->op = op; + new->pLeft = left; + new->pRight = right; + if (token) { + DBSQL_ASSERT(token->dyn ==0); + new->token = *token; + new->span = *token; + } else { + DBSQL_ASSERT(new->token.dyn == 0); + DBSQL_ASSERT(new->token.z == 0); + DBSQL_ASSERT(new->token.n == 0); + if (left && right) { + __expr_span(new, &left->span, &right->span); + } else { + new->span = new->token; + } + } + return new; +} + +/* + * __expr_span -- + * Set the expr_t.span field of the given expression to span all + * text between the two given tokens. + * + * PUBLIC: void __expr_span __P((expr_t *, token_t *, token_t *)); + */ +void +__expr_span(expr, left, right) + expr_t *expr; + token_t *left; + token_t *right; +{ + DBSQL_ASSERT(right != 0); + DBSQL_ASSERT(left != 0); + /* + * Note: 'expr' might be NULL due to a prior __dbsql_malloc failure. + */ + if (expr && right->z && left->z) { + if (left->dyn == 0 && right->dyn == 0) { + expr->span.z = left->z; + expr->span.n = right->n + P_TO_UINT32(right->z) - + P_TO_UINT32(left->z); + } else { + expr->span.z = 0; + } + } +} + +/* + * __expr_function -- + * Construct a new expression node for a function with multiple + * arguments. + * + * PUBLIC: expr_t *__expr_function __P((expr_list_t *, token_t *)); + */ +expr_t * +__expr_function(list, token) + expr_list_t *list; + token_t *token; +{ + expr_t *new; + if (__dbsql_calloc(NULL, 1, sizeof(expr_t), &new) == ENOMEM) { +#if 0 /* TODO Leak pList when malloc fails */ + __expr_list_delete(list); +#endif + return 0; + } + new->op = TK_FUNCTION; + new->pList = list; + if (token) { + DBSQL_ASSERT(token->dyn == 0); + new->token = *token; + } else { + new->token.z = 0; + } + new->span = new->token; + return new; +} + +/* + * __expr_delete -- + * Recursively delete an expression tree. + * + * PUBLIC: void __expr_delete __P((expr_t *)); + */ +void +__expr_delete(p) + expr_t *p; +{ + if (p == 0) + return; + if (p->span.dyn) + __dbsql_free(NULL, (char*)p->span.z); + if (p->token.dyn) + __dbsql_free(NULL, (char*)p->token.z); + __expr_delete(p->pLeft); + __expr_delete(p->pRight); + __expr_list_delete(p->pList); + __select_delete(p->pSelect); + __dbsql_free(NULL, p); +} + + +/* + * __expr_dup -- + * The following group of routines make deep copies of expressions, + * expression lists, ID lists, and select statements. The copies can + * be deleted (by being passed to their respective XXX_delete() routines) + * without effecting the originals. + * The expression list, ID, and source lists return by __expr_list_dup(), + * __id_list_dup(), and __src_list_dup() can not be further expanded + * by subsequent calls to DBSQL* __XXX_list_append() routines. + * Any tables that the src_list_t might point to are not duplicated. + * + * PUBLIC: expr_t *__expr_dup __P((expr_t *)); + */ +expr_t * +__expr_dup(p) + expr_t *p; +{ + expr_t *new; + if (p == 0) + return 0; + if (__dbsql_calloc(NULL, 1, sizeof(*p), &new) == ENOMEM) + return 0; + memcpy(new, p, sizeof(*new)); + if (p->token.z != 0) { + __dbsql_strdup(NULL, p->token.z, &new->token.z); + new->token.dyn = 1; + } else { + DBSQL_ASSERT(new->token.z == 0); + } + new->span.z = 0; + new->pLeft = __expr_dup(p->pLeft); + new->pRight = __expr_dup(p->pRight); + new->pList = __expr_list_dup(p->pList); + new->pSelect = __select_dup(p->pSelect); + return new; +} + +/* + * __token_copy -- + * Copy a token_t. + * + * PUBLIC: void __token_copy __P((token_t *, token_t *)); + */ +void +__token_copy(to, from) + token_t *to; + token_t *from; +{ + if (to->dyn) + __dbsql_free(NULL, (char*)to->z); + if (from->z) { + to->n = from->n; + __dbsql_strndup(NULL, from->z, &to->z, from->n); + to->dyn = 1; + } else { + to->z = 0; + } +} + +/* + * __expr_list_dup -- + * Copy a expr_list_t. + * + * PUBLIC: expr_list_t *__expr_list_dup __P((expr_list_t *)); + */ +expr_list_t * +__expr_list_dup(p) + expr_list_t *p; +{ + expr_list_t *new; + int i; + + if (p == 0) + return 0; + if (__dbsql_calloc(NULL, 1, sizeof(*new), &new) == ENOMEM) + return 0; + new->nExpr = new->nAlloc = p->nExpr; + if (__dbsql_calloc(NULL, p->nExpr, sizeof(p->a[0]), &new->a) == ENOMEM) + return 0; + for (i = 0; i < p->nExpr; i++) { + expr_t *new_expr, *old_expr; + new->a[i].pExpr = new_expr = + __expr_dup(old_expr = p->a[i].pExpr); + if (old_expr->span.z!=0 && new_expr) { + /* + * Always make a copy of the span for top-level + * expressions in the expression list. The logic + * in SELECT processing that determines the names + * of columns in the result set needs this + * information. + */ + __token_copy(&new_expr->span, &old_expr->span); + } + DBSQL_ASSERT(new_expr == 0 || new_expr->span.z != 0 || + old_expr->span.z == 0); + if (p->a[i].zName) + __dbsql_strdup(NULL, p->a[i].zName, &new->a[i].zName); + new->a[i].sortOrder = p->a[i].sortOrder; + new->a[i].isAgg = p->a[i].isAgg; + new->a[i].done = 0; + } + return new; +} + +/* + * __src_list_dup -- + * Copy a src_list_t. + * + * PUBLIC: src_list_t *__src_list_dup __P((src_list_t *)); + */ +src_list_t * +__src_list_dup(p) + src_list_t *p; +{ + src_list_t *new; + int i; + int bytes; + if (p == 0) + return 0; + bytes = sizeof(*p) + ((p->nSrc > 0) ? + (sizeof(p->a[0]) * (p->nSrc - 1)) : 0); + if (__dbsql_calloc(NULL, 1, bytes, &new) == ENOMEM) + return 0; + new->nSrc = new->nAlloc = p->nSrc; + for (i = 0; i < p->nSrc; i++) { + struct src_list_item *new_item = &new->a[i]; + struct src_list_item *old_item = &p->a[i]; + __dbsql_strdup(NULL, old_item->zDatabase, &new_item->zDatabase); + __dbsql_strdup(NULL, old_item->zName, &new_item->zName); + __dbsql_strdup(NULL, old_item->zAlias, &new_item->zAlias); + new_item->jointype = old_item->jointype; + new_item->iCursor = old_item->iCursor; + new_item->pTab = 0; + new_item->pSelect = __select_dup(old_item->pSelect); + new_item->pOn = __expr_dup(old_item->pOn); + new_item->pUsing = __id_list_dup(old_item->pUsing); + } + return new; +} + +/* + * __id_list_dup -- + * Copy a id_list_t. + * + * PUBLIC: id_list_t *__id_list_dup __P((id_list_t *)); + */ +id_list_t * +__id_list_dup(p) + id_list_t *p; +{ + id_list_t *new; + int i; + if (p == 0) + return 0; + if (__dbsql_calloc(NULL, 1, sizeof(*new), &new) == ENOMEM) + return 0; + new->nId = new->nAlloc = p->nId; + if (__dbsql_calloc(NULL, p->nId, sizeof(p->a[0]), &new->a) == ENOMEM) + return 0; + for (i = 0; i < p->nId; i++) { + struct id_list_item *new_item = &new->a[i]; + struct id_list_item *old_item = &p->a[i]; + __dbsql_strdup(NULL, old_item->zName, &new_item->zName); + new_item->idx = old_item->idx; + } + return new; +} + +/* + * __select_dup -- + * Copy a select_t. + * + * PUBLIC: select_t *__select_dup __P((select_t *)); + */ +select_t * +__select_dup(p) + select_t *p; +{ + select_t *new; + if (p == 0) + return 0; + if (__dbsql_calloc(NULL, 1, sizeof(*p), &new) == ENOMEM) + return 0; + new->isDistinct = p->isDistinct; + new->pEList = __expr_list_dup(p->pEList); + new->pSrc = __src_list_dup(p->pSrc); + new->pWhere = __expr_dup(p->pWhere); + new->pGroupBy = __expr_list_dup(p->pGroupBy); + new->pHaving = __expr_dup(p->pHaving); + new->pOrderBy = __expr_list_dup(p->pOrderBy); + new->op = p->op; + new->pPrior = __select_dup(p->pPrior); + new->nLimit = p->nLimit; + new->nOffset = p->nOffset; + new->zSelect = 0; + new->iLimit = -1; + new->iOffset = -1; + return new; +} + + +/* + * __expr_list_append -- + * Add a new element to the end of an expression list. If 'list' is + * initially NULL, then create a new expression list. + * + * PUBLIC: expr_list_t *__expr_list_append __P((expr_list_t *, expr_t *, + * PUBLIC: token_t *)); + */ +expr_list_t * +__expr_list_append(list, expr, name) + expr_list_t *list; + expr_t *expr; + token_t *name; +{ + if (list == 0) { + if (__dbsql_calloc(NULL, 1, sizeof(expr_list_t), + &list) == ENOMEM) { + /* TODO Leak memory if malloc fails + __expr_delete(expr); */ + return 0; + } + DBSQL_ASSERT(list->nAlloc == 0); + } + if (list->nAlloc <= list->nExpr) { + list->nAlloc = (list->nAlloc * 2) + 4; + if (__dbsql_realloc(NULL, (list->nAlloc * sizeof(list->a[0])), + &list->a) == ENOMEM) { + /* TODO Leak memory if malloc fails + __expr_delete(expr); */ + list->nExpr = list->nAlloc = 0; + return list; + } + } + DBSQL_ASSERT(list->a != 0); + if (expr || name) { + struct expr_list_item *item = &list->a[list->nExpr++]; + memset(item, 0, sizeof(*item)); + item->pExpr = expr; + if (name) { + __str_nappend(&item->zName, name->z, name->n, NULL); + __str_unquote(item->zName); + } + } + return list; +} + +/* + * __expr_list_delete -- + * Delete an entire expression list. + * + * PUBLIC: void __expr_list_delete __P((expr_list_t *)); + */ +void +__expr_list_delete(list) + expr_list_t *list; +{ + int i; + if (list == 0) + return; + for (i = 0; i < list->nExpr; i++) { + __expr_delete(list->a[i].pExpr); + __dbsql_free(NULL, list->a[i].zName); + } + __dbsql_free(NULL, list->a); + __dbsql_free(NULL, list); +} + +/* + * __expr_is_constant -- + * Walk an expression tree. Return 1 if the expression is constant + * and 0 if it involves variables. + * For the purposes of this function, a double-quoted string (ex: "abc") + * is considered a variable but a single-quoted string (ex: 'abc') is + * a constant. + * + * PUBLIC: int __expr_is_constant __P((expr_t *)); + */ +int +__expr_is_constant(p) + expr_t *p; +{ + int rc = 0; + + switch(p->op) { + case TK_ID: /* FALLTHROUGH */ + case TK_COLUMN: /* FALLTHROUGH */ + case TK_DOT: /* FALLTHROUGH */ + case TK_FUNCTION:/* FALLTHROUGH */ + rc = 0; + break; + case TK_NULL: /* FALLTHROUGH */ + case TK_STRING: /* FALLTHROUGH */ + case TK_INTEGER: /* FALLTHROUGH */ + case TK_FLOAT: /* FALLTHROUGH */ + case TK_VARIABLE: + rc = 1; + break; + default: + if (p->pLeft && !__expr_is_constant(p->pLeft)) { + rc = 0; + } else if (p->pRight && !__expr_is_constant(p->pRight)) { + rc = 0; + } else { + if (p->pList) { + int i = 0; + while (i < p->pList->nExpr && + __expr_is_constant(p->pList->a[i].pExpr)) { + i++; + } + if (i != p->pList->nExpr) { + rc = 0; + break; + } + } + if (p->pLeft != 0 || p->pRight != 0 || + (p->pList && p->pList->nExpr > 0)) { + rc = 1; + } else { + rc = 0; + break; + } + } + break; + } + return rc; +} + +/* + * __expr_is_integer -- + * If the given expression codes a constant integer that is small enough + * to fit in a 32-bit integer, return 1 and put the value of the integer + * in 'value'. If the expression is not an integer or if it is too big + * to fit in a signed 32-bit integer, return 0 and leave + * 'value' unchanged. + * + * PUBLIC: int __expr_is_integer __P((expr_t *, int *)); + */ +int +__expr_is_integer(p, value) + expr_t *p; + int *value; +{ + const char *z; + int v, n; + + switch(p->op) { + case TK_INTEGER: + if (__str_int_in32b(p->token.z)) { + *value = atoi(p->token.z); + return 1; + } + break; + case TK_STRING: + z = p->token.z; + n = p->token.n; + if (n > 0 && z[0] == '-') { + z++; + n--; + } + while (n > 0 && *z && isdigit(*z)) { + z++; + n--; + } + if (n == 0 && __str_int_in32b(p->token.z)) { + *value = atoi(p->token.z); + return 1; + } + break; + case TK_UPLUS: + return __expr_is_integer(p->pLeft, value); + break; + case TK_UMINUS: + if (__expr_is_integer(p->pLeft, &v)) { + *value = -v; + return 1; + } + break; + default: + break; + } + return 0; +} + +/* + * __is_row_id -- + * Return TRUE if the given string is a row-id column name. + * + * PUBLIC: int __is_row_id __P((const char *)); + */ +int +__is_row_id(z) + const char *z; +{ + if (strcasecmp(z, "_ROWID_") == 0) + return 1; + if (strcasecmp(z, "ROWID") == 0) + return 1; + if (strcasecmp(z, "OID") == 0) + return 1; + return 0; +} + +/* + * __lookup_name -- + * Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up + * that name in the set of source tables in 'slist' and make the 'expr' + * expression node refer back to that source column. The following + * changes are made to 'expr': + * + * expr->iDb Set the index in db->aDb[] of the database holding + * the table. + * expr->iTable Set to the cursor number for the table obtained + * from pSrcList. + * expr->iColumn Set to the column number within the table. + * expr->dataType Set to the appropriate data type for the column. + * expr->op Set to TK_COLUMN. + * expr->pLeft Any expression this points to is deleted + * expr->pRight Any expression this points to is deleted. + * + * The 'db_token' is the name of the database (the "X"). This value may + * be NULL meaning that name is of the form Y.Z or Z. Any available + * database can be used. The table_token is the name of the table + * (the "Y"). This value can be NULL if db_token is also NULL. If + * 'table_token' is NULL it means that the form of the name is Z and + * that columns from any table can be used. + * + * If the name cannot be resolved unambiguously, leave an error message + * in 'parser' and return non-zero. Return zero on success. + * + * STATIC: static int __lookup_name __P((parser_t *, token_t *, token_t *, + * STATIC: token_t *, src_list_t *, expr_list_t *, + * STATIC: expr_t *)); + * + * parser The parsing context + * db_token Name of the database containing table, or NULL + * table_token Name of table containing column, or NULL + * col_token Name of the column. + * slist List of tables used to resolve column names + * elist List of expressions used to resolve "AS" + * expr Make this EXPR node point to the selected + * column + */ +static int +__lookup_name(parser, db_token, table_token, col_token, slist, + elist, expr) + parser_t *parser; + token_t *db_token; + token_t *table_token; + token_t *col_token; + src_list_t *slist; + expr_list_t *elist; + expr_t *expr; +{ + char *db_name = 0; /* Name of the database. The "X" in X.Y.Z */ + char *table_name = 0;/* Name of the table. The "Y" in X.Y.Z or Y.Z */ + char *col_name = 0; /* Name of the column. The "Z" */ + int i, j; /* Loop counters */ + int cnt = 0; /* Number of matching column names */ + int ntables = 0; /* Number of matching table names */ + DBSQL *dbp = parser->db; /* The database */ + + DBSQL_ASSERT(col_token && col_token->z); /* The Z in X.Y.Z cannot be NULL */ + if (db_token && db_token->z) { + __dbsql_strndup(dbp, db_token->z, &db_name, db_token->n); + __str_unquote(db_name); + } else { + db_name = 0; + } + if (table_token && table_token->z) { + __dbsql_strndup(dbp, table_token->z, &table_name, + table_token->n); + __str_unquote(table_name); + } else { + DBSQL_ASSERT(db_name == 0); + table_name = 0; + } + if (__dbsql_strndup(dbp, col_token->z, &col_name, + col_token->n) == ENOMEM){ + /* TODO Leak memory (db_name and table_name) if malloc fails */ + return 1; + } + __str_unquote(col_name); + DBSQL_ASSERT(table_name == 0 || elist == 0); + + expr->iTable = -1; + for (i = 0; i < slist->nSrc; i++) { + struct src_list_item *item = &slist->a[i]; + table_t *table = item->pTab; + column_t *column; + + if (table == 0) + continue; + DBSQL_ASSERT(table->nCol > 0); + if (table_name) { + if (item->zAlias) { + char *tname = item->zAlias; + if (strcasecmp(tname, table_name) != 0 ) { + continue; + } + } else { + char *tname = table->zName; + if (tname == 0 || + strcasecmp(tname, table_name) != 0) { + continue; + } + if (db_name != 0 && strcasecmp( + dbp->aDb[table->iDb].zName, + db_name) != 0) { + continue; + } + } + } + if (0 == (ntables++)) { + expr->iTable = item->iCursor; + expr->iDb = table->iDb; + } + for (j = 0, column = table->aCol; j < table->nCol; + j++, column++) { + if (strcasecmp(column->zName, + col_name) == 0){ + cnt++; + expr->iTable = item->iCursor; + expr->iDb = table->iDb; + /* + * Substitute the rowid (column -1) for the + * INTEGER PRIMARY KEY + */ + expr->iColumn = ((j == table->iPKey) ? -1 : j); + expr->dataType = column->sortOrder & + DBSQL_SO_TYPEMASK; + break; + } + } + } + + /* + * If we have not already resolved the name, then maybe + * it is a new.* or old.* trigger argument reference + */ + if (db_name == 0 && table_name != 0 && cnt == 0 && + parser->trigStack != 0) { + trigger_stack_t *tstack = parser->trigStack; + table_t *table = 0; + if (tstack->newIdx != -1 && + strcasecmp("new", table_name) == 0) { + expr->iTable = tstack->newIdx; + DBSQL_ASSERT(tstack->pTab); + table = tstack->pTab; + } else if (tstack->oldIdx != -1 && + strcasecmp("old", table_name) == 0) { + expr->iTable = tstack->oldIdx; + DBSQL_ASSERT(tstack->pTab); + table = tstack->pTab; + } + if(table) { + int j; + column_t *column = table->aCol; + expr->iDb = table->iDb; + ntables++; + for (j = 0; j < table->nCol; j++, column++) { + if (strcasecmp(column->zName, + col_name) == 0) { + cnt++; + expr->iColumn = ((j == table->iPKey) ? + -1 : j); + expr->dataType = column->sortOrder & + DBSQL_SO_TYPEMASK; + break; + } + } + } + } + + /* + * Perhaps the name is a reference to the ROWID. + */ + if (cnt == 0 && ntables == 1 && __is_row_id(col_name)) { + cnt = 1; + expr->iColumn = -1; + expr->dataType = DBSQL_SO_NUM; + } + + /* + * If the input is of the form Z (not Y.Z or X.Y.Z) then the name Z + * might refer to an result-set alias. This happens, for example, when + * we are resolving names in the WHERE clause of the following command: + * + * SELECT a+b AS x FROM table WHERE x<10; + * + * In cases like this, replace expr with a copy of the expression that + * forms the result set entry ("a+b" in the example) and return + * immediately. Note that the expression in the result set should + * have already been resolved by the time the WHERE clause is resolved. + */ + if (cnt == 0 && elist != 0) { + for (j = 0; j < elist->nExpr; j++) { + char *as = elist->a[j].zName; + if (as != 0 && strcasecmp(as, + col_name) == 0) { + DBSQL_ASSERT(expr->pLeft == 0 && expr->pRight == 0); + expr->op = TK_AS; + expr->iColumn = j; + expr->pLeft = __expr_dup(elist->a[j].pExpr); + __dbsql_free(NULL, col_name); + DBSQL_ASSERT(table_name == 0 && db_name == 0); + return 0; + } + } + } + + /* + * If X and Y are NULL (in other words if only the column name Z is + * supplied) and the value of Z is enclosed in double-quotes, then + * Z is a string literal if it doesn't match any column names. In that + * case, we need to return right away and not make any changes to + * expr. + */ + if (cnt == 0 && table_name == 0 && col_token->z[0] == '"') { + __dbsql_free(NULL, col_name); + return 0; + } + + /* + * Note, cnt==0 means there was not match. Also cnt>1 means there were + * two or more matches. Either way, we have an error. + */ + if (cnt != 1) { + char *z = 0; + char *err; + err = (cnt == 0) ? "no such column: %s" : + "ambiguous column name: %s"; + if (db_name) { + __str_append(&z, db_name, ".", table_name, ".", + col_name, 0); + } else if (table_name) { + __str_append(&z, table_name, ".", col_name, 0); + } else { + __dbsql_strdup(NULL, col_name, &z); + } + __error_msg(parser, err, z); + __dbsql_free(NULL, z); + } + + /* + * Clean up and return + */ + __dbsql_free(NULL, db_name); + __dbsql_free(NULL, table_name); + __dbsql_free(NULL, col_name); + __expr_delete(expr->pLeft); + expr->pLeft = 0; + __expr_delete(expr->pRight); + expr->pRight = 0; + expr->op = TK_COLUMN; + __auth_read(parser, expr, slist); + return cnt!=1; +} + +/* + * __expr_resolve_ids -- + * This routine walks an expression tree and resolves references to + * table columns. Nodes of the form ID.ID or ID resolve into an + * index to the table in the table list and a column offset. The + * expr_t.opcode for such nodes is changed to TK_COLUMN. The + * expr_t.iTable value is changed to the index of the referenced table + * in 'elist' plus the "base" value. The base value will ultimately + * become the VDBE cursor number for a cursor that is pointing into + * the referenced table. The expr_t.iColumn value is changed to the + * index of the column of the referenced table. The expr_t.iColumn + * value for the special ROWID column is -1. Any INTEGER PRIMARY KEY + * column is tried as an alias for ROWID. + * + * We also check for instances of the IN operator. IN comes in two + * forms: + * + * expr IN (exprlist) + * and + * expr IN (SELECT ...) + * + * The first form is handled by creating a set holding the list + * of allowed values. The second form causes the SELECT to generate + * a temporary table. + * + * This routine also looks for scalar SELECTs that are part of an + * expression. + * If it finds any, it generates code to write the value of that select + * into a memory cell. + * + * Unknown columns or tables provoke an error. The function returns + * the number of errors seen and leaves an error message on + * parser->zErrMsg. + * + * PUBLIC: int __expr_resolve_ids __P((parser_t *, src_list_t *, expr_list_t *, + * PUBLIC: expr_t *)); + * + * parser The parser context + * slist List of tables used to resolve column names + * elist List of expressions used to resolve "AS" + * expr The expression to be analyzed + */ +int __expr_resolve_ids(parser, slist, elist, expr) + parser_t *parser; + src_list_t *slist; + expr_list_t *elist; + expr_t *expr; +{ + int i, iset; + vdbe_t *v; + token_t *column; + token_t *table; + token_t *database; + expr_t *right; + int addr; + expr_t *e2; + + if (expr == 0 || slist == 0) + return 0; + for (i = 0; i < slist->nSrc; i++) { + DBSQL_ASSERT(slist->a[i].iCursor >= 0 && + slist->a[i].iCursornTab); + } + switch(expr->op) { + /* + * Double-quoted strings (ex: "abc") are used as identifiers if + * possible. Otherwise they remain as strings. Single-quoted + * strings (ex: 'abc') are always string literals. + */ + case TK_STRING: + if (expr->token.z[0] == '\'') { + break; + } + /* + * FALLTHROUGH into the TK_ID case if this is a + * double-quoted string + */ + case TK_ID: + /* + * A lone identifier is the name of a column. + */ + if (__lookup_name(parser, 0, 0, &expr->token, slist, + elist, expr)) { + return 1; + } + break; + case TK_DOT: + /* + * A table name and column name: ID.ID + * Or a database, table and column: ID.ID.ID + */ + right = expr->pRight; + if (right->op == TK_ID) { + database = 0; + table = &expr->pLeft->token; + column = &right->token; + } else { + DBSQL_ASSERT(right->op == TK_DOT); + database = &expr->pLeft->token; + table = &right->pLeft->token; + column = &right->pRight->token; + } + if (__lookup_name(parser, database, table, column, slist, + 0, expr)) { + return 1; + } + break; + case TK_IN: + v = __parser_get_vdbe(parser); + if (v == 0) + return 1; + if (__expr_resolve_ids(parser, slist, elist, expr->pLeft)) { + return 1; + } + if (expr->pSelect) { + /* + * Case 1: expr IN (SELECT ...) + * + * Generate code to write the results of the select + * into a temporary table. The cursor number of the + * temporary table has already been put in iTable by + * __expr_resolve_in_select(). + */ + expr->iTable = parser->nTab++; + __vdbe_add_op(v, OP_OpenTemp, expr->iTable, 1); + __select(parser, expr->pSelect, SRT_Set, + expr->iTable, 0,0,0); + } else if (expr->pList) { + /* + * Case 2: expr IN (exprlist) + * + * Create a set to put the exprlist values in. The + * Set id is stored in iTable. + */ + for (i = 0; i < expr->pList->nExpr; i++) { + e2 = expr->pList->a[i].pExpr; + if (!__expr_is_constant(e2)) { + __error_msg(parser, + "right-hand side of IN " + "operator must be " + "constant"); + return 1; + } + if (__expr_check(parser, e2, 0, 0)) { + return 1; + } + } + iset = expr->iTable = parser->nSet++; + for (i = 0; i < expr->pList->nExpr; i++) { + expr_t *e2 = expr->pList->a[i].pExpr; + switch(e2->op) { + case TK_FLOAT: /* FALLTHROUGH */ + case TK_INTEGER: + case TK_STRING: + addr = __vdbe_add_op(v, OP_SetInsert, + iset, 0); + DBSQL_ASSERT(e2->token.z); + __vdbe_change_p3(v, addr, e2->token.z, + e2->token.n); + __vdbe_dequote_p3(v, addr); + break; + default: + __expr_code(parser, e2); + __vdbe_add_op(v, OP_SetInsert, iset,0); + break; + } + } + } + break; + case TK_SELECT: + /* + * This has to be a scalar SELECT. Generate code to put the + * value of this select in a memory cell and record the number + * of the memory cell in iColumn. + */ + expr->iColumn = parser->nMem++; + if (__select(parser, expr->pSelect, SRT_Mem, + expr->iColumn,0,0,0)) { + return 1; + } + break; + default: + /* + * In all other cases, recursively walk the tree. + */ + if (expr->pLeft && + __expr_resolve_ids(parser, slist, elist, expr->pLeft)) { + return 1; + } + if (expr->pRight && + __expr_resolve_ids(parser, slist, elist, expr->pRight)) { + return 1; + } + if (expr->pList) { + int i; + expr_list_t *el = expr->pList; + for (i = 0; i < el->nExpr; i++) { + expr_t *arg = el->a[i].pExpr; + if (__expr_resolve_ids(parser, slist, elist, + arg)) { + return 1; + } + } + } + } + return 0; +} + +/* + * __get_function_name -- + * 'expr' is a node that defines a function of some kind. It might + * be a syntactic function like "count(x)" or it might be a function + * that implements an operator, like "a LIKE b". + * This routine makes 'name' point to the name of the function and + * 'len' hold the number of characters in the function name. + * + * STATIC: static void __get_function_name __P((expr_t *, const char **, + * STATIC: int *)); + */ +static void +__get_function_name(expr, name, len) + expr_t *expr; + const char **name; + int *len; +{ + switch(expr->op) { + case TK_FUNCTION: + *name = expr->token.z; + *len = expr->token.n; + break; + case TK_LIKE: + *name = "like"; + *len = 4; + break; + case TK_GLOB: + *name = "glob"; + *len = 4; + break; + default: + /* TODO shouldn't this do an DBSQL_ASSERT() or something? fail? */ + *name = "can't happen"; + *len = 12; + break; + } +} + +/* + * __expr_check -- + * Error check the functions in an expression. Make sure all + * function names are recognized and all functions have the correct + * number of arguments. Leave an error message in parser->zErrMsg + * if anything is amiss. Return the number of errors. + * If 'agg' is not null and this expression is an aggregate function + * (like count(*) or max(value)) then write a 1 into *agg. + * + * PUBLIC: int __expr_check __P((parser_t *, expr_t *, int, int *)); + */ +int +__expr_check(parser, expr, agg_allowed, agg) + parser_t *parser; + expr_t *expr; + int agg_allowed; + int *agg; +{ + int nerr, i, n, no_such_func, is_type_of, wrong_num_args, is_agg, nid; + const char *id; + func_def_t *def; + expr_t *e2; + + if (expr == 0) + return 0; + + nerr = 0; + + switch(expr->op) { + case TK_GLOB: /* FALLTHROUGH */ + case TK_LIKE: /* FALLTHROUGH */ + case TK_FUNCTION: + n = (expr->pList) ? + expr->pList->nExpr : 0; /* Number of arguments */ + no_such_func = 0; /* True if no such function exists */ + is_type_of = 0; /* True if is the special TypeOf() func */ + wrong_num_args = 0;/* True if wrong number of arguments */ + is_agg = 0; /* True if is an aggregate function */ + nid = 0; /* Number of characters in function name */ + id = ""; /* The function name. */ + + __get_function_name(expr, &id, &nid); + def = __find_function(parser->db, id, nid, n, 0); + if (def == 0) { + def = __find_function(parser->db, id, nid, -1, 0); + if (def == 0) { + if (n == 1 && nid == 6 && + strncasecmp(id, "typeof",6) == 0) { + is_type_of = 1; + } else { + no_such_func = 1; + } + } else { + wrong_num_args = 1; + } + } else { + is_agg = (def->xFunc == 0); + } + if (is_agg && !agg_allowed) { + __str_nappend(&parser->zErrMsg, + "misuse of aggregate function ", -1, + id, nid, "()", 2, NULL); + parser->nErr++; + nerr++; + is_agg = 0; + } else if (no_such_func) { + __str_nappend(&parser->zErrMsg, + "no such function: ", -1, id, nid, NULL); + parser->nErr++; + nerr++; + } else if (wrong_num_args) { + __str_nappend(&parser->zErrMsg, + "wrong number of arguments to function ", + -1, id, nid, "()", 2, NULL); + parser->nErr++; + nerr++; + } + if (is_agg) + expr->op = TK_AGG_FUNCTION; + if (is_agg && agg) + *agg = 1; + for (i = 0; nerr == 0 && i < n; i++) { + nerr = __expr_check(parser, expr->pList->a[i].pExpr, + agg_allowed && !is_agg, agg); + } + if (def == 0) { + if (is_type_of) { + expr->op = TK_STRING; + if (__expr_type(expr->pList->a[0].pExpr) == + DBSQL_SO_NUM) { + expr->token.z = "numeric"; + expr->token.n = 7; + } else { + expr->token.z = "text"; + expr->token.n = 4; + } + } + } else if (def->dataType >= 0) { + if (def->dataType < n) { + expr->dataType = + __expr_type(expr->pList->a[def->dataType].pExpr); + } else { + expr->dataType = DBSQL_SO_NUM; + } + } else if (def->dataType == DBSQL_ARGS) { + def->dataType = DBSQL_SO_TEXT; + for (i = 0; i < n; i++) { + if (__expr_type(expr->pList->a[i].pExpr) == + DBSQL_SO_NUM) { + expr->dataType = DBSQL_SO_NUM; + break; + } + } + } else if (def->dataType == DBSQL_NUMERIC) { + expr->dataType = DBSQL_SO_NUM; + } else { + expr->dataType = DBSQL_SO_TEXT; + } + break; + default: + if (expr->pLeft) { + nerr = __expr_check(parser, expr->pLeft, + agg_allowed, agg); + } + if (nerr == 0 && expr->pRight) { + nerr = __expr_check(parser, expr->pRight, + agg_allowed, agg); + } + if (nerr == 0 && expr->pList) { + n = expr->pList->nExpr; + for (i = 0; nerr == 0 && i < n; i++) { + e2 = expr->pList->a[i].pExpr; + nerr = __expr_check(parser, e2, + agg_allowed, agg); + } + } + break; + } + return nerr; +} + +/* + * __expr_type -- + * Return either DBSQL_SO_NUM or DBSQL_SO_TEXT to indicate whether the + * given expression should sort as numeric values or as text. + * The __expr_resolve_ids() and __expr_check() routines must have + * both been called on the expression before it is passed to this routine. + * + * PUBLIC: int __expr_type __P((expr_t *)); + */ +int +__expr_type(p) + expr_t *p; +{ + int i; + expr_list_t *list; + + if (p == 0) + return DBSQL_SO_NUM; + + while(p) + switch(p->op) { + case TK_PLUS: /* FALLTHROUGH */ + case TK_MINUS: /* FALLTHROUGH */ + case TK_STAR: /* FALLTHROUGH */ + case TK_SLASH: /* FALLTHROUGH */ + case TK_AND: /* FALLTHROUGH */ + case TK_OR: /* FALLTHROUGH */ + case TK_ISNULL: /* FALLTHROUGH */ + case TK_NOTNULL: /* FALLTHROUGH */ + case TK_NOT: /* FALLTHROUGH */ + case TK_UMINUS: /* FALLTHROUGH */ + case TK_UPLUS: /* FALLTHROUGH */ + case TK_BITAND: /* FALLTHROUGH */ + case TK_BITOR: /* FALLTHROUGH */ + case TK_BITNOT: /* FALLTHROUGH */ + case TK_LSHIFT: /* FALLTHROUGH */ + case TK_RSHIFT: /* FALLTHROUGH */ + case TK_REM: /* FALLTHROUGH */ + case TK_INTEGER: /* FALLTHROUGH */ + case TK_FLOAT: /* FALLTHROUGH */ + case TK_IN: /* FALLTHROUGH */ + case TK_BETWEEN: /* FALLTHROUGH */ + case TK_GLOB: /* FALLTHROUGH */ + case TK_LIKE: + return DBSQL_SO_NUM; + case TK_STRING: /* FALLTHROUGH */ + case TK_NULL: /* FALLTHROUGH */ + case TK_CONCAT: /* FALLTHROUGH */ + case TK_VARIABLE: + return DBSQL_SO_TEXT; + case TK_LT: /* FALLTHROUGH */ + case TK_LE: /* FALLTHROUGH */ + case TK_GT: /* FALLTHROUGH */ + case TK_GE: /* FALLTHROUGH */ + case TK_NE: /* FALLTHROUGH */ + case TK_EQ: + if (__expr_type(p->pLeft) == DBSQL_SO_NUM) { + return DBSQL_SO_NUM; + } + p = p->pRight; + break; + case TK_AS: + p = p->pLeft; + break; + case TK_COLUMN: /* FALLTHROUGH */ + case TK_FUNCTION: /* FALLTHROUGH */ + case TK_AGG_FUNCTION: + return p->dataType; + case TK_SELECT: + DBSQL_ASSERT(p->pSelect); + DBSQL_ASSERT(p->pSelect->pEList); + DBSQL_ASSERT(p->pSelect->pEList->nExpr > 0); + p = p->pSelect->pEList->a[0].pExpr; + break; + case TK_CASE: + if (p->pRight && + __expr_type(p->pRight) == DBSQL_SO_NUM) { + return DBSQL_SO_NUM; + } + if (p->pList) { + list = p->pList; + for (i = 1; i < list->nExpr; i += 2) { + if(__expr_type(list->a[i].pExpr) + == DBSQL_SO_NUM) { + return DBSQL_SO_NUM; + } + } + } + return DBSQL_SO_TEXT; + default: + DBSQL_ASSERT(p->op == TK_ABORT); /* Can't Happen */ + break; + } + return DBSQL_SO_NUM; +} + +/* + * __expr_code -- + * Generate code into the current Vdbe to evaluate the given + * expression and leave the result on the top of stack. + * + * PUBLIC: void __expr_code __P((parser_t *, expr_t *)); + */ +void +__expr_code(parser, expr) + parser_t *parser; + expr_t *expr; +{ + vdbe_t *v = parser->pVdbe; + int i, op, dest, nexpr, nid, addr, expr_end_lable, jump_inst; + int expr_end_label; + char *z; + expr_list_t *list; + func_def_t *def; + const char *id; + + if (v == 0 || expr == 0) + return; + + switch(expr->op) { + case TK_PLUS: op = OP_Add; break; + case TK_MINUS: op = OP_Subtract; break; + case TK_STAR: op = OP_Multiply; break; + case TK_SLASH: op = OP_Divide; break; + case TK_AND: op = OP_And; break; + case TK_OR: op = OP_Or; break; + case TK_LT: op = OP_Lt; break; + case TK_LE: op = OP_Le; break; + case TK_GT: op = OP_Gt; break; + case TK_GE: op = OP_Ge; break; + case TK_NE: op = OP_Ne; break; + case TK_EQ: op = OP_Eq; break; + case TK_ISNULL: op = OP_IsNull; break; + case TK_NOTNULL: op = OP_NotNull; break; + case TK_NOT: op = OP_Not; break; + case TK_UMINUS: op = OP_Negative; break; + case TK_BITAND: op = OP_BitAnd; break; + case TK_BITOR: op = OP_BitOr; break; + case TK_BITNOT: op = OP_BitNot; break; + case TK_LSHIFT: op = OP_ShiftLeft; break; + case TK_RSHIFT: op = OP_ShiftRight; break; + case TK_REM: op = OP_Remainder; break; + default: break; + } + + switch(expr->op) { + case TK_COLUMN: + if( parser->useAgg ) { + __vdbe_add_op(v, OP_AggGet, 0, expr->iAgg); + } else if (expr->iColumn >= 0) { + __vdbe_add_op(v, OP_Column, expr->iTable, + expr->iColumn); + } else { + __vdbe_add_op(v, OP_Recno, expr->iTable, 0); + } + break; + case TK_STRING: + case TK_FLOAT: + case TK_INTEGER: + if (expr->op == TK_INTEGER && + __str_int_in32b(expr->token.z)) { + __vdbe_add_op(v, OP_Integer, atoi(expr->token.z), 0); + } else { + __vdbe_add_op(v, OP_String, 0, 0); + } + DBSQL_ASSERT(expr->token.z); + __vdbe_change_p3(v, -1, expr->token.z, expr->token.n); + __vdbe_dequote_p3(v, -1); + break; + case TK_NULL: + __vdbe_add_op(v, OP_String, 0, 0); + break; + case TK_VARIABLE: + __vdbe_add_op(v, OP_Variable, expr->iTable, 0); + break; + case TK_LT: /* FALLTHROUGH */ + case TK_LE: /* FALLTHROUGH */ + case TK_GT: /* FALLTHROUGH */ + case TK_GE: /* FALLTHROUGH */ + case TK_NE: /* FALLTHROUGH */ + case TK_EQ: + if (__expr_type(expr) == DBSQL_SO_TEXT) { + op += 6; /* Convert numeric opcodes to text opcodes */ + } + /* FALLTHROUGH */ + case TK_AND: /* FALLTHROUGH */ + case TK_OR: /* FALLTHROUGH */ + case TK_PLUS: /* FALLTHROUGH */ + case TK_STAR: /* FALLTHROUGH */ + case TK_MINUS: /* FALLTHROUGH */ + case TK_REM: /* FALLTHROUGH */ + case TK_BITAND: /* FALLTHROUGH */ + case TK_BITOR: /* FALLTHROUGH */ + case TK_SLASH: + __expr_code(parser, expr->pLeft); + __expr_code(parser, expr->pRight); + __vdbe_add_op(v, op, 0, 0); + break; + case TK_LSHIFT: /* FALLTHROUGH */ + case TK_RSHIFT: + __expr_code(parser, expr->pRight); + __expr_code(parser, expr->pLeft); + __vdbe_add_op(v, op, 0, 0); + break; + case TK_CONCAT: + __expr_code(parser, expr->pLeft); + __expr_code(parser, expr->pRight); + __vdbe_add_op(v, OP_Concat, 2, 0); + break; + case TK_UMINUS: + DBSQL_ASSERT(expr->pLeft); + if (expr->pLeft->op == TK_FLOAT || + expr->pLeft->op == TK_INTEGER) { + token_t *p = &expr->pLeft->token; + __dbsql_calloc(parser->db, 1, p->n + 2, &z); + sprintf(z, "-%.*s", p->n, p->z); + if (expr->pLeft->op == TK_INTEGER && + __str_int_in32b(z)) { + __vdbe_add_op(v, OP_Integer, atoi(z), 0); + } else { + __vdbe_add_op(v, OP_String, 0, 0); + } + __vdbe_change_p3(v, -1, z, (p->n + 1)); + __dbsql_free(NULL, z); + break; + } + /* FALLTHROUGH */ + case TK_BITNOT: /* FALLTHROUGH */ + case TK_NOT: + __expr_code(parser, expr->pLeft); + __vdbe_add_op(v, op, 0, 0); + break; + case TK_ISNULL: + case TK_NOTNULL: + __vdbe_add_op(v, OP_Integer, 1, 0); + __expr_code(parser, expr->pLeft); + dest = __vdbe_current_addr(v) + 2; + __vdbe_add_op(v, op, 1, dest); + __vdbe_add_op(v, OP_AddImm, -1, 0); + break; + case TK_AGG_FUNCTION: + __vdbe_add_op(v, OP_AggGet, 0, expr->iAgg); + break; + case TK_GLOB: /* FALLTHROUGH */ + case TK_LIKE: /* FALLTHROUGH */ + case TK_FUNCTION: + list = expr->pList; + nexpr = list ? list->nExpr : 0; + __get_function_name(expr, &id, &nid); + def = __find_function(parser->db, id, nid, nexpr, 0); + DBSQL_ASSERT(def != 0); + for (i = 0; i < nexpr; i++) { + __expr_code(parser, list->a[i].pExpr); + } + __vdbe_add_op(v, OP_Function, nexpr, 0); + __vdbe_change_p3(v, -1, (char*)def, P3_POINTER); + break; + case TK_SELECT: + __vdbe_add_op(v, OP_MemLoad, expr->iColumn, 0); + break; + case TK_IN: + __vdbe_add_op(v, OP_Integer, 1, 0); + __expr_code(parser, expr->pLeft); + addr = __vdbe_current_addr(v); + __vdbe_add_op(v, OP_NotNull, -1, addr+4); + __vdbe_add_op(v, OP_Pop, 1, 0); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_add_op(v, OP_Goto, 0, (addr + 6)); + if (expr->pSelect) { + __vdbe_add_op(v, OP_Found, expr->iTable, (addr + 6)); + } else { + __vdbe_add_op(v, OP_SetFound, expr->iTable,(addr + 6)); + } + __vdbe_add_op(v, OP_AddImm, -1, 0); + break; + case TK_BETWEEN: + __expr_code(parser, expr->pLeft); + __vdbe_add_op(v, OP_Dup, 0, 0); + __expr_code(parser, expr->pList->a[0].pExpr); + __vdbe_add_op(v, OP_Ge, 0, 0); + __vdbe_add_op(v, OP_Pull, 1, 0); + __expr_code(parser, expr->pList->a[1].pExpr); + __vdbe_add_op(v, OP_Le, 0, 0); + __vdbe_add_op(v, OP_And, 0, 0); + break; + case TK_UPLUS: /* FALLTHROUGH */ + case TK_AS: + __expr_code(parser, expr->pLeft); + break; + case TK_CASE: + DBSQL_ASSERT(expr->pList); + DBSQL_ASSERT((expr->pList->nExpr % 2) == 0); + DBSQL_ASSERT(expr->pList->nExpr > 0); + nexpr = expr->pList->nExpr; + expr_end_label = __vdbe_make_label(v); + if (expr->pLeft) { + __expr_code(parser, expr->pLeft); + } + for (i = 0; i < nexpr; i += 2) { + __expr_code(parser, expr->pList->a[i].pExpr); + if (expr->pLeft) { + __vdbe_add_op(v, OP_Dup, 1, 1); + jump_inst = __vdbe_add_op(v, OP_Ne, 1, 0); + __vdbe_add_op(v, OP_Pop, 1, 0); + } else { + jump_inst = __vdbe_add_op(v, OP_IfNot, 1, 0); + } + __expr_code(parser, expr->pList->a[i+1].pExpr); + __vdbe_add_op(v, OP_Goto, 0, expr_end_label); + addr = __vdbe_current_addr(v); + __vdbe_change_p2(v, jump_inst, addr); + } + if (expr->pLeft) { + __vdbe_add_op(v, OP_Pop, 1, 0); + } + if (expr->pRight) { + __expr_code(parser, expr->pRight); + } else { + __vdbe_add_op(v, OP_String, 0, 0); + } + __vdbe_resolve_label(v, expr_end_label); + break; + case TK_RAISE: + if (!parser->trigStack) { + __error_msg(parser, + "RAISE() may only be used within a " + "trigger-program"); + parser->nErr++; + return; + } + if (expr->iColumn == OE_Rollback || + expr->iColumn == OE_Abort || + expr->iColumn == OE_Fail ){ + char *msg; + __dbsql_strndup(parser->db, expr->token.z, &msg, + expr->token.n); + __vdbe_add_op(v, OP_Halt, DBSQL_CONSTRAINT, + expr->iColumn); + __str_unquote(msg); + __vdbe_change_p3(v, -1, msg, 0); + __dbsql_free(parser->db, msg); + } else { + DBSQL_ASSERT(expr->iColumn == OE_Ignore); + __vdbe_add_op(v, OP_Goto, 0, + parser->trigStack->ignoreJump); + __vdbe_change_p3(v, -1, "(IGNORE jump)", 0); + } + break; + } +} + +/* + * __expr_if_true -- + * Generate code for a boolean expression such that a jump is made + * to the label "dest" if the expression is true but execution + * continues straight thru if the expression is false. + * If the expression evaluates to NULL (neither true nor false), then + * take the jump if the jump_if_null flag is true. + * + * PUBILC: void __expr_if_true __P((parser_t *, expr_t *, int, int)); + */ +void +__expr_if_true(parser, expr, dest, jump_if_null) + parser_t *parser; + expr_t *expr; + int dest; + int jump_if_null; +{ + vdbe_t *v = parser->pVdbe; + int d2, addr, op = 0; + + if (v == 0 || expr == 0) + return; + switch(expr->op) { + case TK_LT: op = OP_Lt; break; + case TK_LE: op = OP_Le; break; + case TK_GT: op = OP_Gt; break; + case TK_GE: op = OP_Ge; break; + case TK_NE: op = OP_Ne; break; + case TK_EQ: op = OP_Eq; break; + case TK_ISNULL: op = OP_IsNull; break; + case TK_NOTNULL: op = OP_NotNull; break; + default: break; + } + switch(expr->op) { + case TK_AND: + d2 = __vdbe_make_label(v); + __expr_if_false(parser, expr->pLeft, d2, !jump_if_null); + __expr_if_true(parser, expr->pRight, dest, jump_if_null); + __vdbe_resolve_label(v, d2); + break; + case TK_OR: + __expr_if_true(parser, expr->pLeft, dest, jump_if_null); + __expr_if_true(parser, expr->pRight, dest, jump_if_null); + break; + case TK_NOT: + __expr_if_false(parser, expr->pLeft, dest, jump_if_null); + break; + case TK_LT: /* FALLTHROUGH */ + case TK_LE: /* FALLTHROUGH */ + case TK_GT: /* FALLTHROUGH */ + case TK_GE: /* FALLTHROUGH */ + case TK_NE: /* FALLTHROUGH */ + case TK_EQ: + __expr_code(parser, expr->pLeft); + __expr_code(parser, expr->pRight); + if (__expr_type(expr) == DBSQL_SO_TEXT) { + op += 6; /* Convert numeric opcodes to text opcodes */ + } + __vdbe_add_op(v, op, jump_if_null, dest); + break; + case TK_ISNULL: /* FALLTHROUGH */ + case TK_NOTNULL: + __expr_code(parser, expr->pLeft); + __vdbe_add_op(v, op, 1, dest); + break; + case TK_IN: + __expr_code(parser, expr->pLeft); + addr = __vdbe_current_addr(v); + __vdbe_add_op(v, OP_NotNull, -1, addr + 3); + __vdbe_add_op(v, OP_Pop, 1, 0); + __vdbe_add_op(v, OP_Goto, 0, jump_if_null ? dest : addr + 4); + if (expr->pSelect) { + __vdbe_add_op(v, OP_Found, expr->iTable, dest); + } else { + __vdbe_add_op(v, OP_SetFound, expr->iTable, dest); + } + break; + case TK_BETWEEN: + __expr_code(parser, expr->pLeft); + __vdbe_add_op(v, OP_Dup, 0, 0); + __expr_code(parser, expr->pList->a[0].pExpr); + addr = __vdbe_add_op(v, OP_Lt, !jump_if_null, 0); + __expr_code(parser, expr->pList->a[1].pExpr); + __vdbe_add_op(v, OP_Le, jump_if_null, dest); + __vdbe_add_op(v, OP_Integer, 0, 0); + __vdbe_change_p2(v, addr, __vdbe_current_addr(v)); + __vdbe_add_op(v, OP_Pop, 1, 0); + break; + default: + __expr_code(parser, expr); + __vdbe_add_op(v, OP_If, jump_if_null, dest); + break; + } +} + +/* + * __expr_if_false -- + * Generate code for a boolean expression such that a jump is made + * to the label "dest" if the expression is false but execution + * continues straight thru if the expression is true. + * If the expression evaluates to NULL (neither true nor false) then + * jump if jump_if_null is true or fall through if jump_if_null is false. + * + * PUBLIC: void __expr_if_false __P((parser_t *, expr_t *, int, int)); + */ +void +__expr_if_false(parser, expr, dest, jump_if_null) + parser_t *parser; + expr_t *expr; + int dest; + int jump_if_null; +{ + vdbe_t *v = parser->pVdbe; + int addr, d2, op = 0; + + if (v == 0 || expr == 0) + return; + + switch(expr->op) { + case TK_LT: op = OP_Ge; break; + case TK_LE: op = OP_Gt; break; + case TK_GT: op = OP_Le; break; + case TK_GE: op = OP_Lt; break; + case TK_NE: op = OP_Eq; break; + case TK_EQ: op = OP_Ne; break; + case TK_ISNULL: op = OP_NotNull; break; + case TK_NOTNULL: op = OP_IsNull; break; + default: break; + } + + switch(expr->op) { + case TK_AND: + __expr_if_false(parser, expr->pLeft, dest, jump_if_null); + __expr_if_false(parser, expr->pRight, dest, jump_if_null); + break; + case TK_OR: + d2 = __vdbe_make_label(v); + __expr_if_true(parser, expr->pLeft, d2, !jump_if_null); + __expr_if_false(parser, expr->pRight, dest, jump_if_null); + __vdbe_resolve_label(v, d2); + break; + case TK_NOT: + __expr_if_true(parser, expr->pLeft, dest, jump_if_null); + break; + case TK_LT: /* FALLTHROUGH */ + case TK_LE: /* FALLTHROUGH */ + case TK_GT: /* FALLTHROUGH */ + case TK_GE: /* FALLTHROUGH */ + case TK_NE: /* FALLTHROUGH */ + case TK_EQ: + if (__expr_type(expr)==DBSQL_SO_TEXT) { + /* + *Convert numeric comparison opcodes into text + * comparison opcodes. This step depends on the + * fact that the text comparision opcodes are + * always 6 greater than their corresponding + * numeric comparison opcodes. + */ + DBSQL_ASSERT(OP_Eq + 6 == OP_StrEq); + op += 6; + } + __expr_code(parser, expr->pLeft); + __expr_code(parser, expr->pRight); + __vdbe_add_op(v, op, jump_if_null, dest); + break; + case TK_ISNULL: /* FALLTHROUGH */ + case TK_NOTNULL: + __expr_code(parser, expr->pLeft); + __vdbe_add_op(v, op, 1, dest); + break; + case TK_IN: + __expr_code(parser, expr->pLeft); + addr = __vdbe_current_addr(v); + __vdbe_add_op(v, OP_NotNull, -1, addr + 3); + __vdbe_add_op(v, OP_Pop, 1, 0); + __vdbe_add_op(v, OP_Goto, 0, (jump_if_null ? dest : addr + 4)); + if (expr->pSelect) { + __vdbe_add_op(v, OP_NotFound, expr->iTable, dest); + } else { + __vdbe_add_op(v, OP_SetNotFound, expr->iTable, dest); + } + break; + case TK_BETWEEN: + __expr_code(parser, expr->pLeft); + __vdbe_add_op(v, OP_Dup, 0, 0); + __expr_code(parser, expr->pList->a[0].pExpr); + addr = __vdbe_current_addr(v); + __vdbe_add_op(v, OP_Ge, !jump_if_null, addr + 3); + __vdbe_add_op(v, OP_Pop, 1, 0); + __vdbe_add_op(v, OP_Goto, 0, dest); + __expr_code(parser, expr->pList->a[1].pExpr); + __vdbe_add_op(v, OP_Gt, jump_if_null, dest); + break; + default: + __expr_code(parser, expr); + __vdbe_add_op(v, OP_IfNot, jump_if_null, dest); + break; + } +} + +/* + * __expr_compare -- + * Do a deep comparison of two expression trees. Return TRUE (non-zero) + * if they are identical and return FALSE if they differ in any way. + * + * PUBLIC: int __expr_compare __P((expr_t *, expr_t *)); + */ +int +__expr_compare(a, b) + expr_t *a; + expr_t *b; +{ + int i; + if (a == 0) { + return (b == 0); + } else if (b == 0) { + return 0; + } + if (a->op != b->op) + return 0; + if (!__expr_compare(a->pLeft, b->pLeft)) + return 0; + if (!__expr_compare(a->pRight, b->pRight)) + return 0; + if (a->pList) { + if (b->pList == 0) + return 0; + if (a->pList->nExpr != b->pList->nExpr) + return 0; + for(i = 0; i < a->pList->nExpr; i++) { + if(!__expr_compare(a->pList->a[i].pExpr, + b->pList->a[i].pExpr)) { + return 0; + } + } + } else if (b->pList) { + return 0; + } + if (a->pSelect || b->pSelect) + return 0; + if (a->iTable!=b->iTable || a->iColumn!=b->iColumn) + return 0; + if (a->token.z) { + if (b->token.z == 0) + return 0; + if (b->token.n != a->token.n) + return 0; + if (strncasecmp(a->token.z, + b->token.z, + b->token.n) != 0) + return 0; + } + return 1; +} + +/* + * __append_agg_info -- + * Add a new element to the parser->aAgg[] array and return its index. + * + * STATIC: static int __append_agg_info __P((parser_t *)); + */ +static int +__append_agg_info(parser) + parser_t *parser; +{ + agg_expr_t *agg; + if ((parser->nAgg & 0x7) == 0) { + int amt = parser->nAgg + 8; + if (__dbsql_realloc(parser->db, amt * sizeof(parser->aAgg[0]), + &parser->aAgg) == ENOMEM) + return -1; + } + memset(&parser->aAgg[parser->nAgg], 0, sizeof(parser->aAgg[0])); + return parser->nAgg++; +} + +/* + * __expr_analyze_aggregates -- + * Analyze the given expression looking for aggregate functions and + * for variables that need to be added to the parser->aAgg[] array. + * Make additional entries to the parser->aAgg[] array as necessary. + * This routine should only be called after the expression has been + * analyzed by __expr_resolve_ids() and __expr_check(). + * Return the number of errors. + * + * PUBLIC: int __expr_analyze_aggregates __P((parser_t *, expr_t *)); + */ +int +__expr_analyze_aggregates(parser, expr) + parser_t *parser; + expr_t *expr; +{ + int i, n, nexpr, nerr = 0; + agg_expr_t *agg; + + if (expr == 0) + return 0; + + switch(expr->op) { + case TK_COLUMN: + agg = parser->aAgg; + for (i = 0; i < parser->nAgg; i++) { + if (agg[i].isAgg) + continue; + if (agg[i].pExpr->iTable == expr->iTable && + agg[i].pExpr->iColumn==expr->iColumn) { + break; + } + } + if (i >= parser->nAgg) { + i = __append_agg_info(parser); + if (i < 0) + return 1; + parser->aAgg[i].isAgg = 0; + parser->aAgg[i].pExpr = expr; + } + expr->iAgg = i; + break; + case TK_AGG_FUNCTION: + agg = parser->aAgg; + for(i = 0; i < parser->nAgg; i++) { + if (!agg[i].isAgg) + continue; + if (__expr_compare(agg[i].pExpr, expr)) { + break; + } + } + if (i >= parser->nAgg) { + i = __append_agg_info(parser); + if (i < 0) + return 1; + parser->aAgg[i].isAgg = 1; + parser->aAgg[i].pExpr = expr; + nexpr = (expr->pList ? expr->pList->nExpr : 0); + parser->aAgg[i].pFunc = __find_function(parser->db, + expr->token.z, + expr->token.n, + nexpr, 0); + } + expr->iAgg = i; + break; + default: + if (expr->pLeft) { + nerr = __expr_analyze_aggregates(parser, expr->pLeft); + } + if (nerr == 0 && expr->pRight) { + nerr = __expr_analyze_aggregates(parser, expr->pRight); + } + if (nerr == 0 && expr->pList) { + n = expr->pList->nExpr; + for (i = 0; nerr == 0 && i < n; i++) { + nerr = __expr_analyze_aggregates(parser, + expr->pList->a[i].pExpr); + } + } + break; + } + return nerr; +} + +/* + * __find_function -- + * Locate a user function given a name and a number of arguments. + * Return a pointer to the func_def_t structure that defines that + * function, or return NULL if the function does not exist. + * If the 'create' argument is true, then a new (blank) func_def_t + * structure is created and liked into the 'dbp' structure if a + * no matching function previously existed. When 'create' is true + * and the 'nargs' parameter is -1, then only a function that accepts + * any number of arguments will be returned. + * If 'create' is false and 'nargs' is -1, then the first valid + * function found is returned. A function is valid if either 'func' + * or 'step' is non-zero. + * + * PUBLIC: func_def_t *__find_function __P((DBSQL *, const char *, int, + * PUBLIC: int, int)); + * + * dbp An open database. + * name Name of the function. Not null-terminated. + * len Number of characters in the name. + * nargs Number of arguments. -1 means any number. + * create Create new entry if true and does not otherwise + * exist. + */ +func_def_t * +__find_function(dbp, name, len, nargs, create) + DBSQL *dbp; + const char *name; + int len; + int nargs; + int create; +{ + func_def_t *first, *p, *maybe; + first = p = (func_def_t *)__hash_find((hash_t*)dbp->aFunc, name, len); + if (p && !create && nargs < 0) { + while (p && p->xFunc==0 && p->xStep == 0) { + p = p->pNext; + } + return p; + } + maybe = 0; + while(p && p->nArg != nargs) { + if (p->nArg < 0 && !create && (p->xFunc || p->xStep)) + maybe = p; + p = p->pNext; + } + if (p && !create && p->xFunc == 0 && p->xStep == 0) { + return 0; + } + if (p == 0 && maybe) { + DBSQL_ASSERT(create == 0); + return maybe; + } + if (p == 0 && create && + __dbsql_calloc(dbp, 1, sizeof(*p), &p) != ENOMEM) { + p->nArg = nargs; + p->pNext = first; + p->dataType = first ? first->dataType : DBSQL_NUMERIC; + __hash_insert((hash_t*)dbp->aFunc, name, len, (void*)p); + } + return p; +} diff --git a/src/cg_insert.c b/src/cg_insert.c new file mode 100644 index 0000000..60ae9d8 --- /dev/null +++ b/src/cg_insert.c @@ -0,0 +1,1072 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_insert.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains routines that handle INSERT statements. + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +/* + * __insert -- + * This routine is call to handle SQL of the following forms: + * + * insert into TABLE (IDLIST) values(EXPRLIST) + * insert into TABLE (IDLIST) select + * + * The IDLIST following the table name is always optional. If omitted, + * then a list of all columns for the table is substituted. The IDLIST + * appears in the 'column' parameter. 'column' is NULL if IDLIST is + * omitted. + * + * The 'list' parameter holds EXPRLIST in the first form of the INSERT + * statement above, and 'select' is NULL. For the second form, 'list' is + * NULL and 'select' is a pointer to the select statement used to generate + * data for the insert. + * + * The code generated follows one of three templates. For a simple + * select with data coming from a VALUES clause, the code executes + * once straight down through. The template looks like this: + * + * open write cursor to and its indices + * puts VALUES clause expressions onto the stack + * write the resulting record into
+ * cleanup + * + * If the statement is of the form + * + * INSERT INTO
SELECT ... + * + * And the SELECT clause does not read from
at any time, then + * the generated code follows this template: + * + * goto B + * A: setup for the SELECT + * loop over the tables in the SELECT + * gosub C + * end loop + * cleanup after the SELECT + * goto D + * B: open write cursor to
and its indices + * goto A + * C: insert the select result into
+ * return + * D: cleanup + * + * The third template is used if the insert statement takes its + * values from a SELECT but the data is being inserted into a table + * that is also read as part of the SELECT. In the third form, + * we have to use a intermediate table to store the results of + * the select. The template is like this: + * + * goto B + * A: setup for the SELECT + * loop over the tables in the SELECT + * gosub C + * end loop + * cleanup after the SELECT + * goto D + * C: insert the select result into the intermediate table + * return + * B: open a cursor to an intermediate table + * goto A + * D: open write cursor to
and its indices + * loop over the intermediate table + * transfer values form intermediate table into
+ * end the loop + * cleanup + * + * PUBLIC: void __insert __P((parser_t *, src_list_t *, expr_list_t *, + * PUBLIC: select_t *, id_list_t *, int)); + * + * parser Parser context + * tlist Name of table into which we are inserting + * vlist List of values to be inserted + * select A SELECT statement to use as the data source + * column Column names corresponding to IDLIST + * on_error How to handle constraint errors + */ +void __insert(parser, tlist, vlist, select, column, on_error) + parser_t *parser; + src_list_t *tlist; + expr_list_t *vlist; + select_t *select; + id_list_t *column; + int on_error; +{ + int rc, init_code; + int i, j, dx; /* Loop counters */ + table_t *table; /* The table to insert into */ + char *tname; /* Name of the table into which we are inserting*/ + const char *dname; /* Name of the database holding this table */ + vdbe_t *v; /* Generate code into this virtual machine */ + index_t *idx; /* For looping over indices of the table */ + int ncol; /* Number of columns in the data */ + int base; /* VDBE Cursor number for pTab */ + int cont, brk; /* Beginning and end of the loop over srcTab */ + DBSQL *dbp; /* The main database structure */ + int key_col = -1; /* Column that is the INTEGER PRIMARY KEY */ + int end_of_loop; /* Label for the end of the insertion loop */ + int use_temp_table; /* Store SELECT results in intermediate table */ + int src_tab; /* Data comes from this temporary cursor if >=0 */ + int select_loop; /* Address of code that implements the SELECT */ + int cleanup; /* Address of the cleanup code */ + int insert_block; /* Address of the subroutine used to insert data*/ + int cnt_mem; /* Memory cell used for the row counter */ + int view_p; /* True if attempting to insert into a view */ + + int row_triggers_p = 0; /* True if there are FOR EACH ROW triggers */ + int before_triggers_p; /* True if there are BEFORE triggers */ + int after_triggers_p; /* True if there are AFTER triggers */ + int nidx = -1; /* Cursor for the NEW table */ + vdbe_op_t *op; + src_list_t dummy; + + if (parser->nErr) + goto insert_cleanup; + + dbp = parser->db; + + /* + * Locate the table into which we will be inserting new information. + */ + DBSQL_ASSERT(tlist->nSrc == 1); + tname = tlist->a[0].zName; + if (tname == 0) + goto insert_cleanup; + table = __src_list_lookup(parser, tlist); + if (table == 0) { + goto insert_cleanup; + } + DBSQL_ASSERT(table->iDb < dbp->nDb); + dname = dbp->aDb[table->iDb].zName; + if (__auth_check(parser, DBSQL_INSERT, table->zName, 0, dname)) { + goto insert_cleanup; + } + + /* + * Ensure that: + * (a) the table is not read-only, + * (b) that if it is a view then ON INSERT triggers exist + */ + before_triggers_p = __triggers_exist(parser, table->pTrigger, + TK_INSERT, TK_BEFORE, TK_ROW, 0); + after_triggers_p = __triggers_exist(parser, table->pTrigger, + TK_INSERT, TK_AFTER, TK_ROW, 0); + row_triggers_p = before_triggers_p || after_triggers_p; + view_p = (table->pSelect != 0); + if (__is_table_read_only(parser, table, before_triggers_p)) { + goto insert_cleanup; + } + if (table == 0) + goto insert_cleanup; + + /* + * If 'table' is really a view, make sure it has been initialized. + */ + if (view_p && __view_get_column_names(parser, table)) { + goto insert_cleanup; + } + + /* + * Allocate a VDBE + */ + v = __parser_get_vdbe(parser); + if (v == 0) + goto insert_cleanup; + __vdbe_prepare_write(parser, select || row_triggers_p, table->iDb); + + /* + * If there are row triggers, allocate a temp table for new.* + * references. + */ + if (row_triggers_p) { + nidx = parser->nTab++; + } + + /* + * Figure out how many columns of data are supplied. If the data + * is coming from a SELECT statement, then this step also generates + * all the code to implement the SELECT statement and invoke a + * subroutine to process each row of the result. (Template 2.) If + * the SELECT statement uses the the table that is being inserted + * into, then the subroutine is also coded here. That subroutine + * stores the SELECT results in a temporary table. (Template 3.) + */ + if (select) { + /* + * Data is coming from a SELECT. Generate code to implement + * that SELECT. + */ + init_code = __vdbe_add_op(v, OP_Goto, 0, 0); + select_loop = __vdbe_current_addr(v); + insert_block = __vdbe_make_label(v); + rc = __select(parser, select, SRT_Subroutine, insert_block, + 0,0,0); + if (rc || parser->nErr) + goto insert_cleanup; + cleanup = __vdbe_make_label(v); + __vdbe_add_op(v, OP_Goto, 0, cleanup); + DBSQL_ASSERT(select->pEList); + ncol = select->pEList->nExpr; + + /* + * Set use_temp_table to TRUE if the result of the SELECT + * statement should be written into a temporary table. Set + * to FALSE if each row of the SELECT can be written directly + * into the result table. + * + * A temp table must be used if the table being updated is + * also one of the tables being read by the SELECT statement. + * Also use a temp table in the case of row triggers. + */ + if (row_triggers_p) { + use_temp_table = 1; + } else { + int addr = __vdbe_find_op(v, OP_OpenRead, table->tnum); + use_temp_table = 0; + if (addr > 0) { + op = __vdbe_get_op(v, addr-2); + if (op->opcode == OP_Integer && + op->p1 == table->iDb) { + use_temp_table = 1; + } + } + } + + if (use_temp_table) { + /* + * Generate the subroutine that SELECT calls to + * process each row of the result. Store the result + * in a temporary table. + */ + src_tab = parser->nTab++; + __vdbe_resolve_label(v, insert_block); + __vdbe_add_op(v, OP_MakeRecord, ncol, 0); + __vdbe_add_op(v, OP_NewRecno, src_tab, 0); + __vdbe_add_op(v, OP_Pull, 1, 0); + __vdbe_add_op(v, OP_PutIntKey, src_tab, 0); + __vdbe_add_op(v, OP_Return, 0, 0); + + /* + * The following code runs first because the GOTO at + * the very top of the program jumps to it. Create + * the temporary table, then jump back up and execute + * the SELECT code above. + */ + __vdbe_change_p2(v, init_code, __vdbe_current_addr(v)); + __vdbe_add_op(v, OP_OpenTemp, src_tab, 0); + __vdbe_add_op(v, OP_Goto, 0, select_loop); + __vdbe_resolve_label(v, cleanup); + } else { + __vdbe_change_p2(v, init_code, __vdbe_current_addr(v)); + } + } else { + /* + * This is the case if the data for the INSERT is coming from + * a VALUES clause. + */ + DBSQL_ASSERT(vlist != 0); + src_tab = -1; + use_temp_table = 0; + DBSQL_ASSERT(vlist); + ncol = vlist->nExpr; + dummy.nSrc = 0; + for(i = 0; i < ncol; i++) { + if (__expr_resolve_ids(parser, &dummy, 0, + vlist->a[i].pExpr)) { + goto insert_cleanup; + } + if (__expr_check(parser, vlist->a[i].pExpr, 0, 0)) { + goto insert_cleanup; + } + } + } + + /* + * Make sure the number of columns in the source data matches the + * number of columns to be inserted into the table. + */ + if (column == 0 && ncol != table->nCol) { + __error_msg(parser, + "table %S has %d columns but %d values " + "were supplied", tlist, 0, table->nCol, ncol); + goto insert_cleanup; + } + if (column != 0 && ncol != column->nId) { + __error_msg(parser, "%d values for %d columns", ncol, + column->nId); + goto insert_cleanup; + } + + /* + * If the INSERT statement included an IDLIST term, then make sure + * all elements of the IDLIST really are columns of the table and + * remember the column indices. + * + * If the table has an INTEGER PRIMARY KEY column and that column + * is named in the IDLIST, then record in the key_col variable + * the index into IDLIST of the primary key column. key_col is + * the index of the primary key as it appears in IDLIST, not as + * is appears in the original table. (The index of the primary + * key in the original table is table->iPKey.) + */ + if (column) { + for(i = 0; i < column->nId; i++) { + column->a[i].idx = -1; + } + for(i = 0; i < column->nId; i++) { + for(j = 0; j < table->nCol; j++) { + if (strcasecmp(column->a[i].zName, + table->aCol[j].zName) == 0) { + column->a[i].idx = j; + if (j == table->iPKey) { + key_col = i; + } + break; + } + } + if(j >= table->nCol) { + if (__is_row_id(column->a[i].zName)) { + key_col = i; + } else { + __error_msg(parser, + "table %S has no column named %s", + tlist, 0, column->a[i].zName); + parser->nErr++; + goto insert_cleanup; + } + } + } + } + + /* + * If there is no IDLIST term but the table has an integer primary + * key, then set the key_col variable to the primary key column + * index in the original table definition. + */ + if (column == 0) { + key_col = table->iPKey; + } + + /* + * Open the temp table for FOR EACH ROW triggers. + */ + if (row_triggers_p) { + __vdbe_add_op(v, OP_OpenPseudo, nidx, 0); + } + + /* + * Initialize the count of rows to be inserted. + */ + if (dbp->flags & DBSQL_CountRows) { + cnt_mem = parser->nMem++; + __vdbe_add_op(v, OP_Integer, 0, 0); + __vdbe_add_op(v, OP_MemStore, cnt_mem, 1); + } + + /* + * Open tables and indices if there are no row triggers. + */ + if (!row_triggers_p) { + base = parser->nTab; + __vdbe_add_op(v, OP_Integer, table->iDb, 0); + __vdbe_add_op(v, OP_OpenWrite, base, table->tnum); + __vdbe_change_p3(v, -1, table->zName, P3_STATIC); + for (dx = 1, idx = table->pIndex; idx; idx = idx->pNext, dx++){ + __vdbe_add_op(v, OP_Integer, idx->iDb, 0); + __vdbe_add_op(v, OP_OpenWrite, (dx + base), idx->tnum); + __vdbe_change_p3(v, -1, idx->zName, P3_STATIC); + } + parser->nTab += dx; + } + + /* + * If the data source is a temporary table, then we have to create + * a loop because there might be multiple rows of data. If the data + * source is a subroutine call from the SELECT statement, then we need + * to launch the SELECT statement processing. + */ + if (use_temp_table) { + brk = __vdbe_make_label(v); + __vdbe_add_op(v, OP_Rewind, src_tab, brk); + cont = __vdbe_current_addr(v); + } else if (select) { + __vdbe_add_op(v, OP_Goto, 0, select_loop); + __vdbe_resolve_label(v, insert_block); + } + + /* + * Run the BEFORE and INSTEAD OF triggers, if there are any. + */ + end_of_loop = __vdbe_make_label(v); + if (before_triggers_p) { + + /* + * build the new.* reference row. Note that if there is + * an INTEGER PRIMARY KEY into which a NULL is being + * inserted, that NULL will be translated into a unique ID + * for the row. But on a BEFORE trigger, we do not know what + * the unique ID will be (because the insert has not happened + * yet) so we substitute a rowid of -1. + */ + if (key_col < 0) { + __vdbe_add_op(v, OP_Integer, -1, 0); + } else if (use_temp_table) { + __vdbe_add_op(v, OP_Column, src_tab, key_col); + } else if (select) { + __vdbe_add_op(v, OP_Dup, ncol - key_col - 1, 1); + } else { + __expr_code(parser, vlist->a[key_col].pExpr); + __vdbe_add_op(v, OP_NotNull, -1, + (__vdbe_current_addr(v) + 3)); + __vdbe_add_op(v, OP_Pop, 1, 0); + __vdbe_add_op(v, OP_Integer, -1, 0); + __vdbe_add_op(v, OP_MustBeInt, 0, 0); + } + + /* + * Create the new column data. + */ + for (i = 0; i < table->nCol; i++) { + if (column == 0) { + j = i; + } else { + for (j = 0; j < column->nId; j++) { + if (column->a[j].idx == i) + break; + } + } + if (column && j >= column->nId) { + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, table->aCol[i].zDflt, + P3_STATIC); + } else if (use_temp_table) { + __vdbe_add_op(v, OP_Column, src_tab, j); + } else if (select) { + __vdbe_add_op(v, OP_Dup, (ncol - j - 1), 1); + } else { + __expr_code(parser, vlist->a[j].pExpr); + } + } + __vdbe_add_op(v, OP_MakeRecord, table->nCol, 0); + __vdbe_add_op(v, OP_PutIntKey, nidx, 0); + + /* + * Fire BEFORE or INSTEAD OF triggers. + */ + if (__code_row_trigger(parser, TK_INSERT, 0, TK_BEFORE, table, + nidx, -1, on_error, end_of_loop)) { + goto insert_cleanup; + } + } + + /* + * If any triggers exists, the opening of tables and indices is + * deferred until now. + */ + if (row_triggers_p && !view_p) { + base = parser->nTab; + __vdbe_add_op(v, OP_Integer, table->iDb, 0); + __vdbe_add_op(v, OP_OpenWrite, base, table->tnum); + __vdbe_change_p3(v, -1, table->zName, P3_STATIC); + for (dx = 1, idx = table->pIndex; idx; idx = idx->pNext, dx++){ + __vdbe_add_op(v, OP_Integer, idx->iDb, 0); + __vdbe_add_op(v, OP_OpenWrite, (dx + base), idx->tnum); + __vdbe_change_p3(v, -1, idx->zName, P3_STATIC); + } + parser->nTab += dx; + } + + /* + * Push the record number for the new entry onto the stack. The + * record number is a randomly generate integer created by NewRecno + * except when the table has an INTEGER PRIMARY KEY column, in which + * case the record number is the same as that column. + */ + if (!view_p) { + if (key_col >= 0) { + if (use_temp_table) { + __vdbe_add_op(v, OP_Column, src_tab, + key_col); + } else if (select) { + __vdbe_add_op(v, OP_Dup, + (ncol - key_col - 1), 1); + } else { + __expr_code(parser, vlist->a[key_col].pExpr); + } + /* + * If the PRIMARY KEY expression is NULL, then use + * OP_NewRecno to generate a unique primary key value. + */ + __vdbe_add_op(v, OP_NotNull, -1, + (__vdbe_current_addr(v) + 3)); + __vdbe_add_op(v, OP_Pop, 1, 0); + __vdbe_add_op(v, OP_NewRecno, base, 0); + __vdbe_add_op(v, OP_MustBeInt, 0, 0); + } else { + __vdbe_add_op(v, OP_NewRecno, base, 0); + } + + /* + * Push onto the stack, data for all columns of the new + * entry, beginning with the first column. + */ + for (i = 0; i < table->nCol; i++) { + if (i == table->iPKey) { + /* + * The value of the INTEGER PRIMARY KEY + * column is always a NULL. Whenever this + * column is read, the record number will be + * substituted in its place. So will fill + * this column with a NULL to avoid taking up + * data space with information that will never + * be used. + */ + __vdbe_add_op(v, OP_String, 0, 0); + continue; + } + if (column == 0) { + j = i; + } else { + for (j = 0; j < column->nId; j++) { + if (column->a[j].idx == i) + break; + } + } + if (column && j >= column->nId) { + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, table->aCol[i].zDflt, + P3_STATIC); + } else if (use_temp_table) { + __vdbe_add_op(v, OP_Column, src_tab, j); + } else if (select) { + __vdbe_add_op(v, OP_Dup, (i + ncol - j), 1); + } else { + __expr_code(parser, vlist->a[j].pExpr); + } + } + + /* + * Generate code to check constraints and generate index + * keys and do the insertion. + */ + __generate_constraint_checks(parser, table, base, 0, + key_col >= 0, 0, on_error, + end_of_loop); + __complete_insertion(parser, table, base, 0, 0, 0, + after_triggers_p ? nidx : -1); + } + + /* + * Update the count of rows that are inserted. + */ + if ((dbp->flags & DBSQL_CountRows) != 0) { + __vdbe_add_op(v, OP_MemIncr, cnt_mem, 0); + } + + if (row_triggers_p) { + /* Close all tables opened */ + if (!view_p) { + __vdbe_add_op(v, OP_Close, base, 0); + for(dx = 1, idx = table->pIndex; idx; + idx = idx->pNext, dx++) { + __vdbe_add_op(v, OP_Close, (dx + base), 0); + } + } + + /* Code AFTER triggers */ + if (__code_row_trigger(parser, TK_INSERT, 0, TK_AFTER, table, + nidx, -1, on_error, end_of_loop)) { + goto insert_cleanup; + } + } + + /* + * The bottom of the loop, if the data source is a SELECT statement. + */ + __vdbe_resolve_label(v, end_of_loop); + if (use_temp_table) { + __vdbe_add_op(v, OP_Next, src_tab, cont); + __vdbe_resolve_label(v, brk); + __vdbe_add_op(v, OP_Close, src_tab, 0); + } else if (select) { + __vdbe_add_op(v, OP_Pop, ncol, 0); + __vdbe_add_op(v, OP_Return, 0, 0); + __vdbe_resolve_label(v, cleanup); + } + + if (!row_triggers_p) { + /* Close all tables opened */ + __vdbe_add_op(v, OP_Close, base, 0); + for(dx = 1, idx = table->pIndex; idx; idx = idx->pNext, dx++){ + __vdbe_add_op(v, OP_Close, (dx + base), 0); + } + } + + __vdbe_conclude_write(parser); + + /* + * Return the number of rows inserted. + */ + if (dbp->flags & DBSQL_CountRows) { + __vdbe_add_op(v, OP_ColumnName, 0, 0); + __vdbe_change_p3(v, -1, "rows inserted", P3_STATIC); + __vdbe_add_op(v, OP_MemLoad, cnt_mem, 0); + __vdbe_add_op(v, OP_Callback, 1, 0); + } + + insert_cleanup: + __src_list_delete(tlist); + if (vlist ) + __expr_list_delete(vlist); + if (select) + __select_delete(select); + __id_list_delete(column); +} + +/* + * __generate_constraint_checks -- + * Generate code to do a constraint check prior to an INSERT or an UPDATE. + * + * When this routine is called, the stack contains (from bottom to top) + * the following values: + * + * 1. The recno of the row to be updated before the update. This + * value is omitted unless we are doing an UPDATE that involves a + * change to the record number. + * + * 2. The recno of the row after the update. + * + * 3. The data in the first column of the entry after the update. + * + * i. Data from middle columns... + * + * N. The data in the last column of the entry after the update. + * + * The old recno shown as entry (1) above is omitted unless both + * 'update_p' and 'will_recno_chng_p' are 1. 'update_p' is true for + * UPDATEs and false for INSERTs and 'will_recno_chng_p' is true if + * the record number is being changed. + * + * The code generated by this routine pushes additional entries onto + * the stack which are the keys for new index entries for the new record. + * The order of index keys is the same as the order of the indices on + * the table->pIndex list. A key is only created for index i if + * used_indicies!=0 and used_indicies[i]!=0. + * + * This routine also generates code to check constraints. NOT NULL, + * CHECK, and UNIQUE constraints are all checked. If a constraint fails, + * then the appropriate action is performed. There are five possible + * actions: ROLLBACK, ABORT, FAIL, REPLACE, and IGNORE. + * + * Constraint type Action What Happens + * --------------- ---------- ---------------------------------------- + * any ROLLBACK The current transaction is rolled back and + * dbsql_exec() returns immediately with a + * return code of DBSQL_CONSTRAINT. + * + * any ABORT Back out changes from the current command + * only (do not do a complete rollback) then + * cause dbsql_exec() to return immediately + * with DBSQL_CONSTRAINT. + * + * any FAIL dbsql_exec() returns immediately with a + * return code of DBSQL_CONSTRAINT. The + * transaction is not rolled back and any + * prior changes are retained. + * + * any IGNORE The record number and data is popped from + * the stack and there is an immediate jump + * to label 'ignore_dest'. + * + * NOT NULL REPLACE The NULL value is replace by the default + * value for that column. If the default value + * is NULL, the action is the same as ABORT. + * + * UNIQUE REPLACE The other row that conflicts with the row + * being inserted is removed. + * + * CHECK REPLACE Illegal. The results in an exception. + * + * Which action to take is determined by the override_error parameter. + * Or if override_error==OE_Default, then the parser->onError parameter + * is used. Or if parser->onError==OE_Default then the onError value + * for the constraint is used. + * + * The calling routine must open a read/write cursor for table with + * cursor number 'base'. All indices of table must also have open + * read/write cursors with cursor number base+i for the i-th cursor. + * Except, if there is no possibility of a REPLACE action then + * cursors do not need to be open for indices where used_indicies[i]==0. + * + * If the 'update_p' flag is true, it means that the 'base' cursor is + * initially pointing to an entry that is being updated. The 'update_p' + * flag causes extra code to be generated so that the 'base' cursor + * is still pointing at the same entry after the routine returns. + * Without the 'update_p' flag, the 'base' cursor might be moved. + * + * PUBLIC: void __generate_constraint_checks __P((parser_t *, table_t *, int, + * PUBLIC: char *, int, int, int, int)); + * + * parser The parser context + * table The table into which we are inserting + * base Index of a read/write cursor pointing at table + * used_indicies Which indices are used. If NULL, all are used + * will_recno_chng_p True if the record number will change + * update_p True for UPDATE, False for INSERT + * override_error Override onError to this if not OE_Default + * ignore_dest Jump to this label on an OE_Ignore resolution + */ +void +__generate_constraint_checks(parser, table, base, used_indicies, + will_recno_chng_p, update_p, override_error, + ignore_dest) + parser_t *parser; + table_t *table; + int base; + char *used_indicies; + int will_recno_chng_p; + int update_p; + int override_error; + int ignore_dest; +{ + int i; + vdbe_t *v; + int num_col; + int on_error; + int addr; + int extra; + int cur; + index_t *index; + int seen_replace_p = 0; + int jmp_inst_1, jmp_inst_2; + int cont_addr; + int two_recnos_p = (update_p && will_recno_chng_p); + char *msg = 0; + char *dup_msg; + int j, n1, n2; + char err_msg[200]; + char *col; + + v = __parser_get_vdbe(parser); + DBSQL_ASSERT(v != 0); + DBSQL_ASSERT(table->pSelect == 0); /* This table is not a VIEW */ + num_col = table->nCol; + + /* + * Test all NOT NULL constraints. + */ + for (i = 0; i < num_col; i++) { + if (i == table->iPKey) { + continue; + } + on_error = table->aCol[i].notNull; + if (on_error == OE_None) + continue; + if (override_error != OE_Default) { + on_error = override_error; + } else if (parser->db->onError != OE_Default) { + on_error = parser->db->onError; + } else if (on_error == OE_Default) { + on_error = OE_Abort; + } + if (on_error == OE_Replace && table->aCol[i].zDflt == 0) { + on_error = OE_Abort; + } + __vdbe_add_op(v, OP_Dup, (num_col - 1 - i), 1); + addr = __vdbe_add_op(v, OP_NotNull, 1, 0); + switch(on_error) { + case OE_Rollback: /* FALLTHROUGH */ + case OE_Abort: /* FALLTHROUGH */ + case OE_Fail: + msg = 0; /* Reset msg or set_string does bad things. */ + __vdbe_add_op(v, OP_Halt, DBSQL_CONSTRAINT, on_error); + __str_append(&msg, table->zName, ".", + table->aCol[i].zName, + " may not be NULL", (char*)0); + __vdbe_change_p3(v, -1, msg, P3_DYNAMIC); + break; + case OE_Ignore: + __vdbe_add_op(v, OP_Pop, (num_col + 1 + two_recnos_p), + 0); + __vdbe_add_op(v, OP_Goto, 0, ignore_dest); + break; + case OE_Replace: + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, table->aCol[i].zDflt, + P3_STATIC); + __vdbe_add_op(v, OP_Push, (num_col - i), 0); + break; + default: + DBSQL_ASSERT(0); + break; + } + __vdbe_change_p2(v, addr, __vdbe_current_addr(v)); + } + + /* + * Test all CHECK constraints + */ + + /* + * If we have an INTEGER PRIMARY KEY, make sure the primary key + * of the new record does not previously exist. Except, if this + * is an UPDATE and the primary key is not changing, that is OK. + */ + if (will_recno_chng_p) { + on_error = table->keyConf; + if (override_error != OE_Default) { + on_error = override_error; + } else if (parser->db->onError != OE_Default) { + on_error = parser->db->onError; + } else if (on_error == OE_Default) { + on_error = OE_Abort; + } + + if (update_p) { + __vdbe_add_op(v, OP_Dup, (num_col + 1), 1); + __vdbe_add_op(v, OP_Dup, (num_col + 1), 1); + jmp_inst_1 = __vdbe_add_op(v, OP_Eq, 0, 0); + } + __vdbe_add_op(v, OP_Dup, num_col, 1); + jmp_inst_2 = __vdbe_add_op(v, OP_NotExists, base, 0); + switch(on_error) { + default: + on_error = OE_Abort; /* FALLTHROUGH */ + case OE_Rollback: /* FALLTHROUGH */ + case OE_Abort: /* FALLTHROUGH */ + case OE_Fail: + __vdbe_add_op(v, OP_Halt, DBSQL_CONSTRAINT, on_error); + __vdbe_change_p3(v, -1, "PRIMARY KEY must be unique", + P3_STATIC); + break; + case OE_Replace: + __generate_row_index_delete(parser->db, v, table, + base, 0); + if (update_p) { + __vdbe_add_op(v, OP_Dup, (num_col + + two_recnos_p), 1); + __vdbe_add_op(v, OP_MoveTo, base, 0); + } + seen_replace_p = 1; + break; + case OE_Ignore: + DBSQL_ASSERT(seen_replace_p == 0); + __vdbe_add_op(v, OP_Pop, (num_col + 1 + two_recnos_p), + 0); + __vdbe_add_op(v, OP_Goto, 0, ignore_dest); + break; + } + cont_addr = __vdbe_current_addr(v); + __vdbe_change_p2(v, jmp_inst_2, cont_addr); + if (update_p) { + __vdbe_change_p2(v, jmp_inst_1, cont_addr); + __vdbe_add_op(v, OP_Dup, (num_col + 1), 1); + __vdbe_add_op(v, OP_MoveTo, base, 0); + } + } + + /* + * Test all UNIQUE constraints by creating entries for each UNIQUE + * index and making sure that duplicate entries do not already exist. + * Add the new records to the indices as we go. + */ + extra = -1; + for (cur = 0, index = table->pIndex; index; + index = index->pNext, cur++) { + if (used_indicies && used_indicies[cur] == 0) + continue; /* Skip unused indices */ + extra++; + + /* + * Create a key for accessing the index entry. + */ + __vdbe_add_op(v, OP_Dup, (num_col + extra), 1); + for (i = 0; i < index->nColumn; i++) { + int idx = index->aiColumn[i]; + if (idx == table->iPKey) { + __vdbe_add_op(v, OP_Dup, (i + extra + + num_col + 1), 1); + } else { + __vdbe_add_op(v, OP_Dup, (i + extra + + num_col - idx), 1); + } + } + jmp_inst_1 = __vdbe_add_op(v, OP_MakeIdxKey, index->nColumn,0); + __add_idx_key_type(v, index); + + /* + * Find out what action to take in case there is an + * indexing conflict. + */ + on_error = index->onError; + if (on_error == OE_None) + continue; /* index is not a UNIQUE index */ + if (override_error != OE_Default) { + on_error = override_error; + } else if (parser->db->onError != OE_Default) { + on_error = parser->db->onError; + } else if (on_error == OE_Default) { + on_error = OE_Abort; + } + if (seen_replace_p) { + if (on_error == OE_Ignore) + on_error = OE_Replace; + else if (on_error == OE_Fail) + on_error = OE_Abort; + } + + /* + * Check to see if the new index entry will be unique. + */ + __vdbe_add_op(v, OP_Dup, (extra + num_col + 1 + + two_recnos_p), 1); + jmp_inst_2 = __vdbe_add_op(v, OP_IsUnique, (base + cur + 1), + 0); + + /* + * Generate code that executes if the new index entry + * is not unique. + */ + switch(on_error) { + case OE_Rollback: /* FALLTHROUGH */ + case OE_Abort: /* FALLTHROUGH */ + case OE_Fail: + strcpy(err_msg, (index->nColumn>1 ? + "columns " : "column ")); + n1 = strlen(err_msg); + for (j = 0; j < index->nColumn && + n1 < (sizeof(err_msg) - 30); j++) { + col = table->aCol[index->aiColumn[j]].zName; + n2 = strlen(col); + if (j > 0) { + strcpy(&err_msg[n1], ", "); + n1 += 2; + } + if ((n1 + n2) > (sizeof(err_msg) - 30)) { + strcpy(&err_msg[n1], "..."); + n1 += 3; + break; + } else { + strcpy(&err_msg[n1], col); + n1 += n2; + } + } + strcpy(&err_msg[n1], (index->nColumn > 1 ? + " are not unique" : " is not unique")); + __vdbe_add_op(v, OP_Halt, DBSQL_CONSTRAINT, on_error); + __dbsql_strdup(parser->db, err_msg, &dup_msg); + __vdbe_change_p3(v, -1, dup_msg, P3_DYNAMIC); + break; + case OE_Ignore: + DBSQL_ASSERT(seen_replace_p == 0); + __vdbe_add_op(v, OP_Pop, (num_col + extra + 3 + + two_recnos_p), 0); + __vdbe_add_op(v, OP_Goto, 0, ignore_dest); + break; + case OE_Replace: + __generate_row_delete(parser->db, v, table, base, 0); + if (update_p) { + __vdbe_add_op(v, OP_Dup, (num_col + extra + 1 + + two_recnos_p), 1); + __vdbe_add_op(v, OP_MoveTo, base, 0); + } + seen_replace_p = 1; + break; + default: + DBSQL_ASSERT(0); + break; + } + cont_addr = __vdbe_current_addr(v); +#if NULL_DISTINCT_FOR_UNIQUE + __vdbe_change_p2(v, jmp_inst_1, cont_addr); +#endif + __vdbe_change_p2(v, jmp_inst_2, cont_addr); + } +} + +/* + * __complete_insertion -- + * This routine generates code to finish the INSERT or UPDATE operation + * that was started by a prior call to __generate_constraint_checks. + * The stack must contain keys for all active indices followed by data + * and the recno for the new entry. This routine creates the new + * entries in all indices and in the main table. + * + * The arguments to this routine should be the same as the first six + * arguments to __generate_constraint_checks. + * + * PUBLIC: void __complete_insertion __P((parser_t *, table_t *, int, char *, + * PUBLIC: int, int, int)); + * + * parser The parser context + * table The table into which we are inserting + * base Index of a read/write cursor pointing at table + * used_indicies Which indices are used. If NULL, all are used + * will_recno_chng_p True if the record number will change + * update_p True for UPDATE, False for INSERT + * new_idx Index of NEW table for triggers, -1 if none + */ +void __complete_insertion(parser, table, base, used_indicies, + will_recno_chng_p, update_p, new_idx) + parser_t *parser; + table_t *table; + int base; + char *used_indicies; + int will_recno_chng_p; + int update_p; + int new_idx; +{ + int i; + vdbe_t *v; + int idx; + index_t *index; + + v = __parser_get_vdbe(parser); + DBSQL_ASSERT(v != 0); + DBSQL_ASSERT(table->pSelect == 0); /* This table is not a VIEW */ + idx = 0; + index = table->pIndex; + while (index) { + index = index->pNext; + idx++; + } + for (i = (idx - 1); i >= 0; i--) { + if (used_indicies && used_indicies[i] == 0) + continue; + __vdbe_add_op(v, OP_IdxPut, base + i + 1, 0); + } + __vdbe_add_op(v, OP_MakeRecord, table->nCol, 0); + if (new_idx >= 0) { + __vdbe_add_op(v, OP_Dup, 1, 0); + __vdbe_add_op(v, OP_Dup, 1, 0); + __vdbe_add_op(v, OP_PutIntKey, new_idx, 0); + } + __vdbe_add_op(v, OP_PutIntKey, base, (parser->trigStack ? 0 : 1)); + if (update_p && will_recno_chng_p) { + __vdbe_add_op(v, OP_Pop, 1, 0); + } +} diff --git a/src/cg_pragma.c b/src/cg_pragma.c new file mode 100644 index 0000000..bf4a085 --- /dev/null +++ b/src/cg_pragma.c @@ -0,0 +1,397 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_pragma.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains code used to implement the PRAGMA command. + */ + +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "dbsql_int.h" + +/* + * __get_boolean -- + * Interpret the given string as a boolean value. + * + * STATIC: static int __get_boolean __P((char *)); + */ +static int +__get_boolean(z) + char *z; +{ + static char *true[] = { "yes", "on", "true" }; + int i; + if (z[0] == 0) + return 0; + if (isdigit(z[0]) || (z[0]=='-' && isdigit(z[1]))) { + return atoi(z); + } + for(i = 0; i < sizeof(true) / sizeof(true[0]); i++) { + if (strcasecmp(z, true[i]) == 0) + return 1; + } + return 0; +} + +/* + * __get_safety_level -- + * Interpret the given string as a safety level. Return 0 for OFF, + * 1 for ON or NORMAL and 2 for FULL. Return 1 for an empty or + * unrecognized string argument. + * + * Note that the values returned are one less that the values that + * should be passed into __sm_set_safety_level(). This is done + * to support legacy SQL code. The safety level used to be boolean + * and older scripts may have used numbers 0 for OFF and 1 for ON. + * + * STATIC: static int __get_safety_level __P((char *)); + */ +static int +__get_safety_level(z) + char *z; +{ + static const struct { + const char *word; + int val; + } key[] = { + { "no", 0 }, + { "off", 0 }, + { "false", 0 }, + { "yes", 1 }, + { "on", 1 }, + { "true", 1 }, + { "full", 2 }, + }; + int i; + if (z[0] == 0) + return 1; + if (isdigit(z[0]) || (z[0] == '-' && isdigit(z[1]))) { + return atoi(z); + } + for (i = 0; i < sizeof(key)/sizeof(key[0]); i++) { + if (strcasecmp(z,key[i].word) == 0) + return key[i].val; + } + return 1; +} + +/* + * __pragma -- + * Process a pragma statement. + * + * Pragmas are of this form: + * + * PRAGMA id = value + * + * The identifier might also be a string. The value is a string, and + * identifier, or a number. If 'minus_p' is true, then the value is + * a number that was preceded by a minus sign. + * + * PUBLIC: void __pragma __P((parser_t *, token_t *, token_t *, int)); + */ +void +__pragma(parser, left, right, minus_p) + parser_t *parser; + token_t *left; + token_t *right; + int minus_p; +{ + char *left_name = 0; + char *right_name = 0; + DBSQL *dbp = parser->db; + vdbe_t *v = __parser_get_vdbe(parser); + if (v == 0) + return; + + __dbsql_strndup(dbp, left->z, &left_name, left->n); + __str_unquote(left_name); + if (minus_p) { + right_name = 0; + __str_nappend(&right_name, "-", 1, right->z, right->n, NULL); + } else { + __dbsql_strndup(dbp, right->z, &right_name, right->n); + __str_unquote(right_name); + } + if (__auth_check(parser, DBSQL_PRAGMA, left_name, right_name, NULL)) { + __dbsql_free(dbp, left_name); + __dbsql_free(dbp, right_name); + return; + } + +/* + * PRAGMA trigger_overhead_test + */ +if (strcasecmp(left_name, "trigger_overhead_test") == 0) { + if (__get_boolean(right_name)) { + always_code_trigger_setup = 1; + } else { + always_code_trigger_setup = 0; + } +} else +/* + * PRAGMA vdbe_trace + */ +if (strcasecmp(left_name, "vdbe_trace") == 0) { + if (__get_boolean(right_name)) { + dbp->flags |= DBSQL_VdbeTrace; + } else { + dbp->flags &= ~DBSQL_VdbeTrace; + } +} else +/* + * PRAGMA full_column_names + */ +if (strcasecmp(left_name, "full_column_names") == 0) { + if (__get_boolean(right_name)) { + dbp->flags |= DBSQL_FullColNames; + } else { + dbp->flags &= ~DBSQL_FullColNames; + } +} else +/* + * PRAGMA show_datatypes + */ +if (strcasecmp(left_name, "show_datatypes") == 0) { + if( __get_boolean(right_name)) { + dbp->flags |= DBSQL_ReportTypes; + } else { + dbp->flags &= ~DBSQL_ReportTypes; + } +} else +/* + * PRAGMA count_changes + */ +if (strcasecmp(left_name, "count_changes") == 0) { + if (__get_boolean(right_name)) { + dbp->flags |= DBSQL_CountRows; + } else { + dbp->flags &= ~DBSQL_CountRows; + } +} else +/* + * PRAGMA empty_result_callbacks + */ +if (strcasecmp(left_name, "empty_result_callbacks") == 0) { + if ( __get_boolean(right_name)) { + dbp->flags |= DBSQL_NullCallback; + } else { + dbp->flags &= ~DBSQL_NullCallback; + } +} else +/* + * PRAGMA table_info + */ +if (strcasecmp(left_name, "table_info") == 0) { + table_t *table; + table = __find_table(dbp, right_name, 0); + if (table) { + static vdbe_op_t table_info_preface[] = { + { OP_ColumnName, 0, 0, "cid"}, + { OP_ColumnName, 1, 0, "name"}, + { OP_ColumnName, 2, 0, "type"}, + { OP_ColumnName, 3, 0, "notnull"}, + { OP_ColumnName, 4, 0, "dflt_value"}, + { OP_ColumnName, 5, 0, "pk"}, + }; + int i; + __vdbe_add_op_list(v, ARRAY_SIZE(table_info_preface), + table_info_preface); + __view_get_column_names(parser, table); + for (i = 0; i < table->nCol; i++) { + __vdbe_add_op(v, OP_Integer, i, 0); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, table->aCol[i].zName, + P3_STATIC); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, + table->aCol[i].zType ? + table->aCol[i].zType : + "numeric", P3_STATIC); + __vdbe_add_op(v, OP_Integer, + table->aCol[i].notNull, 0); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, table->aCol[i].zDflt, + P3_STATIC); + __vdbe_add_op(v, OP_Integer, + table->aCol[i].isPrimKey, 0); + __vdbe_add_op(v, OP_Callback, 6, 0); + } + } +} else +/* + * PRAGMA index_info + */ +if (strcasecmp(left_name, "index_info") == 0) { + index_t *index; + table_t *table; + index = __find_index(dbp, right_name, 0); + if (index) { + static vdbe_op_t table_info_preface[] = { + { OP_ColumnName, 0, 0, "seqno"}, + { OP_ColumnName, 1, 0, "cid"}, + { OP_ColumnName, 2, 0, "name"}, + }; + int i; + table = index->pTable; + __vdbe_add_op_list(v, ARRAY_SIZE(table_info_preface), + table_info_preface); + for (i = 0; i < index->nColumn; i++) { + int cnum = index->aiColumn[i]; + __vdbe_add_op(v, OP_Integer, i, 0); + __vdbe_add_op(v, OP_Integer, cnum, 0); + __vdbe_add_op(v, OP_String, 0, 0); + DBSQL_ASSERT(table->nCol > cnum); + __vdbe_change_p3(v, -1, + table->aCol[cnum].zName, + P3_STATIC); + __vdbe_add_op(v, OP_Callback, 3, 0); + } + } +} else +/* + * PRAGMA index_list + */ +if (strcasecmp(left_name, "index_list") == 0) { + index_t *index; + table_t *table; + table = __find_table(dbp, right_name, 0); + if (table) { + v = __parser_get_vdbe(parser); + index = table->pIndex; + } + if (table && index) { + int i = 0; + static vdbe_op_t index_list_preface[] = { + { OP_ColumnName, 0, 0, "seq"}, + { OP_ColumnName, 1, 0, "name"}, + { OP_ColumnName, 2, 0, "unique"}, + }; + + __vdbe_add_op_list(v, ARRAY_SIZE(index_list_preface), + index_list_preface); + while(index) { + __vdbe_add_op(v, OP_Integer, i, 0); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, index->zName, + P3_STATIC); + __vdbe_add_op(v, OP_Integer, + index->onError != OE_None, 0); + __vdbe_add_op(v, OP_Callback, 3, 0); + ++i; + index = index->pNext; + } + } +} else +/* + * PRAGMA foreign_key_list + */ +if (strcasecmp(left_name, "foreign_key_list") == 0) { + foreign_key_t *fk; + table_t *table; + table = __find_table(dbp, right_name, 0); + if (table) { + v = __parser_get_vdbe(parser); + fk = table->pFKey; + } + if (table && fk) { + int i = 0; + static vdbe_op_t index_list_preface[] = { + { OP_ColumnName, 0, 0, "id"}, + { OP_ColumnName, 1, 0, "seq"}, + { OP_ColumnName, 2, 0, "table"}, + { OP_ColumnName, 3, 0, "from"}, + { OP_ColumnName, 4, 0, "to"}, + }; + + __vdbe_add_op_list(v, ARRAY_SIZE(index_list_preface), + index_list_preface); + while(fk) { + int j; + for (j = 0; j < fk->nCol; j++) { + __vdbe_add_op(v, OP_Integer, i, 0); + __vdbe_add_op(v, OP_Integer, j, 0); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, fk->zTo, + P3_STATIC); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, + table->aCol[fk->aCol[j].iFrom].zName, + P3_STATIC); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, + fk->aCol[j].zCol, P3_STATIC); + __vdbe_add_op(v, OP_Callback, 5, 0); + } + ++i; + fk = fk->pNextFrom; + } + } +} else +/* + * PRAGMA database_list + */ +if (strcasecmp(left_name, "database_list") == 0) { + int i; + static vdbe_op_t index_list_preface[] = { + { OP_ColumnName, 0, 0, "seq"}, + { OP_ColumnName, 1, 0, "name"}, + { OP_ColumnName, 2, 0, "file"}, + }; + + __vdbe_add_op_list(v, ARRAY_SIZE(index_list_preface), + index_list_preface); + for (i = 0; i < dbp->nDb; i++) { + if (dbp->aDb[i].pBt == 0) + continue; + DBSQL_ASSERT(dbp->aDb[i].zName != 0); + __vdbe_add_op(v, OP_Integer, i, 0); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, dbp->aDb[i].zName, P3_STATIC); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_change_p3(v, -1, + __sm_get_database_name(dbp->aDb[i].pBt), P3_STATIC); + __vdbe_add_op(v, OP_Callback, 3, 0); + } +} else +#ifndef NDEBUG + /* + * PRAGMA parser_trace + */ + if (strcasecmp(left_name, "parser_trace") == 0) { + extern void __sql_parser_trace(FILE*, char *); + if (__get_boolean(right_name)) { + __sql_parser_trace(stdout, "parser: "); + } else { + __sql_parser_trace(0, 0); + } + } +#endif + else {} +__dbsql_free(dbp, left_name); +__dbsql_free(dbp, right_name); +} diff --git a/src/cg_select.c b/src/cg_select.c new file mode 100644 index 0000000..4712562 --- /dev/null +++ b/src/cg_select.c @@ -0,0 +1,2975 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_select.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains C code routines that are called by the parser + * to handle SELECT statements. + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +/* __select_new -- + * Allocate a new Select structure and return a pointer to that + * structure. + * + * PUBLIC: select_t *__select_new __P((expr_list_t *, src_list_t *, expr_t *, + * PUBLIC: expr_list_t *, expr_t *, expr_list_t *, + * PUBLIC: int, int, int)); + * + * result_cols Which columns to include in the result + * from_clause The FROM clause -- which tables to scan + * where_clause The WHERE clause + * groupby_clause The GROUP BY clause + * having_clause The HAVING clause + * orderby_clause The ORDER BY clause + * distinct_p True if the DISTINCT keyword is present + * limit LIMIT value, -1 means not used + * offset OFFSET value, 0 means no offset + */ +select_t * +__select_new(result_cols, from_clause, where_clause, groupby_clause, + having_clause, orderby_clause, distinct_p, limit, offset) + expr_list_t *result_cols; + src_list_t *from_clause; + expr_t *where_clause; + expr_list_t *groupby_clause; + expr_t *having_clause; + expr_list_t *orderby_clause; + int distinct_p; + int limit; + int offset; +{ + select_t *new; + if (__dbsql_calloc(NULL, 1, sizeof(*new), &new) == ENOMEM) { + __expr_list_delete(result_cols); + __src_list_delete(from_clause); + __expr_delete(where_clause); + __expr_list_delete(groupby_clause); + __expr_delete(having_clause); + __expr_list_delete(orderby_clause); + } else { + if (result_cols == 0) { + result_cols = __expr_list_append(0, + __expr(TK_ALL, 0, 0, 0), 0); + } + new->pEList = result_cols; + new->pSrc = from_clause; + new->pWhere = where_clause; + new->pGroupBy = groupby_clause; + new->pHaving = having_clause; + new->pOrderBy = orderby_clause; + new->isDistinct = distinct_p; + new->op = TK_SELECT; + new->nLimit = limit; + new->nOffset = offset; + new->iLimit = -1; + new->iOffset = -1; + } + return new; +} + +/* + * __join_type + * Given 1 to 3 identifiers preceeding the JOIN keyword, determine the + * type of join. Return an integer constant that expresses that type + * in terms of the following bit values: + * + * JT_INNER + * JT_OUTER + * JT_NATURAL + * JT_LEFT + * JT_RIGHT + * + * A full outer join is the combination of JT_LEFT and JT_RIGHT. + * + * If an illegal or unsupported join type is seen, then still return + * a join type, but put an error in the parser structure. + * + * PUBLIC: int __join_type __P((parser_t *, token_t *, token_t *, token_t *)); + */ +int +__join_type(parser, a, b, c) + parser_t *parser; + token_t *a; + token_t *b; + token_t *c; +{ + int jointype = 0; + token_t *ap_all[3]; + token_t *p; + static struct { + const char *keyword; + int len; + int code; + } keywords[] = { + { "natural", 7, JT_NATURAL }, + { "left", 4, JT_LEFT|JT_OUTER }, + { "right", 5, JT_RIGHT|JT_OUTER }, + { "full", 4, JT_LEFT|JT_RIGHT|JT_OUTER }, + { "outer", 5, JT_OUTER }, + { "inner", 5, JT_INNER }, + { "cross", 5, JT_INNER }, + }; + static int num_keywords = sizeof(keywords) / sizeof(keywords[0]); + static token_t dummy = { 0, 0 }; + char *sp1 = " ", *sp2 = " "; + int i, j; + + ap_all[0] = a; + ap_all[1] = b; + ap_all[2] = c; + for (i = 0; i < 3 && ap_all[i]; i++) { + p = ap_all[i]; + for (j = 0; j < num_keywords; j++) { + if (p->n == keywords[j].len && + strncasecmp(p->z, keywords[j].keyword, + p->n) == 0) { + jointype |= keywords[j].code; + break; + } + } + if (j >= num_keywords) { + jointype |= JT_ERROR; + break; + } + } + if(((jointype & (JT_INNER | JT_OUTER)) == (JT_INNER | JT_OUTER)) || + (jointype & JT_ERROR) != 0) { + if (b == 0) { + b = &dummy; + sp1 = 0; + } + if (c == 0) { + c = &dummy; + sp2 = 0; + } + __str_nappend(&parser->zErrMsg, + "unknown or unsupported join type: ", 0, + a->z, a->n, sp1, 1, b->z, b->n, sp2, 1, c->z, + c->n, NULL); + parser->nErr++; + jointype = JT_INNER; + } else if (jointype & JT_RIGHT) { + __error_msg(parser, + "RIGHT and FULL OUTER JOINs are not currently supported"); + jointype = JT_INNER; + } + return jointype; +} + +/* + * __column_index -- + * Return the index of a column in a table. Return -1 if the column + * is not contained in the table. + * + * STATIC: static int __column_index __P((table_t *, const char *)); + */ +static int +__column_index(table, col) + table_t *table; + const char *col; +{ + int i; + for (i = 0; i < table->nCol; i++) { + if (strcasecmp(table->aCol[i].zName, col) == 0) + return i; + } + return -1; +} + +/* + * __add_where_term -- + * Add a term to the WHERE expression in *expr that requires the + * col column to be equal in the two tables table1 and table2. + * + * STATIC: static void __add_where_term __P((const char *, const table_t *, + * STATIC: const table_t *, expr_t **)); + * + * col Name of the column + * table1 First table + * table2 Second table + * expr Add the equality term to this expression + */ +static void +__add_where_term(col, table1, table2, expr) + const char *col; + const table_t *table1; + const table_t *table2; + expr_t **expr; +{ + token_t dummy; + expr_t *e_1a, *e_1b, *e_1c; + expr_t *e_2a, *e_2b, *e_2c; + expr_t *e; + + dummy.z = col; + dummy.n = strlen(col); + dummy.dyn = 0; + e_1a = __expr(TK_ID, 0, 0, &dummy); + e_2a = __expr(TK_ID, 0, 0, &dummy); + dummy.z = table1->zName; + dummy.n = strlen(dummy.z); + e_1b = __expr(TK_ID, 0, 0, &dummy); + dummy.z = table2->zName; + dummy.n = strlen(dummy.z); + e_2b = __expr(TK_ID, 0, 0, &dummy); + e_1c = __expr(TK_DOT, e_1b, e_1a, 0); + e_2c = __expr(TK_DOT, e_2b, e_2a, 0); + e = __expr(TK_EQ, e_1c, e_2c, 0); + ExprSetProperty(e, EP_FromJoin); + if (*expr) { + *expr = __expr(TK_AND, *expr, e, 0); + } else { + *expr = e; + } +} + +/* + * __set_join_expr -- + * Set the EP_FromJoin property on all terms of the given expression. + * + * The EP_FromJoin property is used on terms of an expression to tell + * the LEFT OUTER JOIN processing logic that this term is part of the + * join restriction specified in the ON or USING clause and not a part + * of the more general WHERE clause. These terms are moved over to the + * WHERE clause during join processing but we need to remember that they + * originated in the ON or USING clause. + * + * STATIC: static void __set_join_expr __P((expr_t *)); + */ +static void +__set_join_expr(p) + expr_t *p; +{ + while (p) { + ExprSetProperty(p, EP_FromJoin); + __set_join_expr(p->pLeft); + p = p->pRight; + } +} + +/* + * __process_join -- + * This routine processes the join information for a SELECT statement. + * ON and USING clauses are converted into extra terms of the WHERE + * clause. NATURAL joins also create extra WHERE clause terms. + * + * This routine returns the number of errors encountered. + * + * STATIC: static int __process_join __P((parser_t *, select_t *)); + */ +static int +__process_join(parser, select) + parser_t *parser; + select_t *select; +{ + int i, j; + src_list_t *src; + struct src_list_item *term; + struct src_list_item *other; + table_t *table; + id_list_t *list; + + src = select->pSrc; + for (i = 0; i < (src->nSrc - 1); i++) { + term = &src->a[i]; + other = &src->a[i+1]; + + if (term->pTab == 0 || other->pTab == 0) + continue; + + /* + * When the NATURAL keyword is present, add WHERE clause + * terms for every column that the two tables have in common. + */ + if (term->jointype & JT_NATURAL) { + if (term->pOn || term->pUsing) { + __error_msg(parser, + "a NATURAL join may not have " + "an ON or USING clause", 0); + return 1; + } + table = term->pTab; + for (j = 0; j < table->nCol; j++) { + if (__column_index(other->pTab, + table->aCol[j].zName) >= 0) { + __add_where_term(table->aCol[j].zName, + table, other->pTab, + &select->pWhere); + } + } + } + + /* + * Disallow both ON and USING clauses in the same join. + */ + if (term->pOn && term->pUsing) { + __error_msg(parser, "cannot have both ON and USING " + "clauses in the same join"); + return 1; + } + + /* + * Add the ON clause to the end of the WHERE clause, + * connected by and AND operator. + */ + if (term->pOn) { + __set_join_expr(term->pOn); + if (select->pWhere == 0) { + select->pWhere = term->pOn; + } else { + select->pWhere = __expr(TK_AND, select->pWhere, + term->pOn, 0); + } + term->pOn = 0; + } + + /* + * Create extra terms on the WHERE clause for each column named + * in the USING clause. Example: If the two tables to be + * joined are A and B and the USING clause names X, Y, and Z, + * then add this to the WHERE clause: + * A.X=B.X AND A.Y=B.Y AND A.Z=B.Z + * Report an error if any column mentioned in the USING clause + * is not contained in both tables to be joined. + */ + if (term->pUsing) { + DBSQL_ASSERT(i < (src->nSrc - 1)); + list = term->pUsing; + for (j = 0; j < list->nId; j++) { + if (__column_index(term->pTab, + list->a[j].zName) < 0 || + __column_index(other->pTab, + list->a[j].zName) < 0) { + __error_msg(parser, + "cannot join using column %s - column " + "not present in both tables", + list->a[j].zName); + return 1; + } + __add_where_term(list->a[j].zName, term->pTab, + other->pTab, &select->pWhere); + } + } + } + return 0; +} + +/* + * __select_delete -- + * Delete the given Select structure and all of its substructures. + * + * PUBLIC: void __select_delete __P((select_t *)); + */ +void +__select_delete(select) + select_t *select; +{ + if (select == 0) + return; + __expr_list_delete(select->pEList); + __src_list_delete(select->pSrc); + __expr_delete(select->pWhere); + __expr_list_delete(select->pGroupBy); + __expr_delete(select->pHaving); + __expr_list_delete(select->pOrderBy); + __select_delete(select->pPrior); + __dbsql_free(NULL, select->zSelect); + __dbsql_free(NULL, select); +} + +/* + * __aggregate_info_reset -- + * Delete the aggregate information from the parse structure. + * + * STATIC: static void __aggregage_info_reset __P((parser_t *)); + */ +static void +__aggregate_info_reset(parser) + parser_t *parser; +{ + __dbsql_free(parser->db, parser->aAgg); + parser->aAgg = 0; + parser->nAgg = 0; + parser->useAgg = 0; +} + +/* + * __push_onto_sorter -- + * Insert code into "v" that will push the record on the top of the + * stack into the sorter. + * + * STATIC: static void __push_onto_sorter __P((parser_t *, vdbe_t *, + * STATIC: expr_list_t *)); + */ +static void +__push_onto_sorter(parser, v, orderby_clause) + parser_t *parser; + vdbe_t *v; + expr_list_t *orderby_clause; +{ + int i, order, type, c; + char *sort_order; + + if (__dbsql_calloc(parser->db, 1, orderby_clause->nExpr + 1, + &sort_order) == ENOMEM) + return; + for (i = 0; i < orderby_clause->nExpr; i++) { + order = orderby_clause->a[i].sortOrder; + if ((order & DBSQL_SO_TYPEMASK) == DBSQL_SO_TEXT) { + type = DBSQL_SO_TEXT; + } else if ((order & DBSQL_SO_TYPEMASK) == DBSQL_SO_NUM) { + type = DBSQL_SO_NUM; + } else { + type = __expr_type(orderby_clause->a[i].pExpr); + } + if ((order & DBSQL_SO_DIRMASK) == DBSQL_SO_ASC) { + c = (type == DBSQL_SO_TEXT ? 'A' : '+'); + } else { + c = (type == DBSQL_SO_TEXT ? 'D' : '-'); + } + sort_order[i] = c; + __expr_code(parser, orderby_clause->a[i].pExpr); + } + sort_order[orderby_clause->nExpr] = 0; + __vdbe_add_op(v, OP_SortMakeKey, orderby_clause->nExpr, 0); + __vdbe_change_p3(v, -1, sort_order, strlen(sort_order)); + __dbsql_free(parser->db, sort_order); + __vdbe_add_op(v, OP_SortPut, 0, 0); +} + +/* + * __add_key_type -- + * This routine adds a P3 argument to the last VDBE opcode that was + * inserted. The P3 argument added is a string suitable for the + * OP_MakeKey or OP_MakeIdxKey opcodes. The string consists of + * characters 't' or 'n' depending on whether or not the various + * fields of the key to be generated should be treated as numeric + * or as text. See the OP_MakeKey and OP_MakeIdxKey opcode + * documentation for additional information about the P3 string. + * See also the __add_idx_key_type() routine. + * + * PUBLIC: void __add_key_type __P((vdbe_t *, expr_list_t *)); + */ +void +__add_key_type(v, elist) + vdbe_t *v; + expr_list_t *elist; +{ + int i; + int col = elist->nExpr; + char *type; + if (__dbsql_calloc(NULL, 1, col + 1, &type) == ENOMEM) + return; + for (i = 0; i < col; i++) { + type[i] = (__expr_type(elist->a[i].pExpr) == DBSQL_SO_NUM) ? + 'n' : 't'; + } + type[i] = 0; + __vdbe_change_p3(v, -1, type, col); + __dbsql_free(NULL, type); +} + +/* + * __select_inner_loop -- + * This routine generates the code for the inside of the inner loop + * of a SELECT. + * + * If src_table and num_cols are both zero, then the elist expressions + * are evaluated in order to get the data for this row. If num_cols>0 + * then data is pulled from src_table and elist is used only to get the + * datatypes for each column. + * + * STATIC: static int __select_inner_loop __P((parser_t *, select_t *, + * STATIC: expr_list_t *, int, int, + * STATIC: expr_list_t *, int, int, int, int, + * STATIC: int)); + * + * parser The parser context + * select The complete select statement being coded + * elist List of values being extracted + * src_table Pull data from this table + * num_cols Number of columns in the source table + * orderby_clause If not NULL, sort results using this key + * distinct If >=0, make sure results are distinct + * dest How to dispose of the results + * param An argument to the disposal method + * cont Jump here to continue with next row + * brk Jump here to break out of the inner loop + */ +static int +__select_inner_loop(parser, select, elist, src_table, num_cols, orderby_clause, + distinct, dest, param, cont, brk) + parser_t *parser; + select_t *select; + expr_list_t *elist; + int src_table; + int num_cols; + expr_list_t *orderby_clause; + int distinct; + int dest; + int param; + int cont; + int brk; +{ + int i, addr, addr1, addr2; + vdbe_t *v = parser->pVdbe; + + if (v == 0) + return 0; + DBSQL_ASSERT(elist != 0); + + /* + * If there was a LIMIT clause on the SELECT statement, then do the + * check to see if this row should be output. + */ + if (orderby_clause == 0) { + if (select->iOffset >= 0) { + int addr = __vdbe_current_addr(v); + __vdbe_add_op(v, OP_MemIncr, select->iOffset, + (addr + 2)); + __vdbe_add_op(v, OP_Goto, 0, cont); + } + if (select->iLimit >= 0) { + __vdbe_add_op(v, OP_MemIncr, select->iLimit, brk); + } + } + + /* + * Pull the requested columns. + */ + if (num_cols > 0) { + for (i = 0; i < num_cols; i++) { + __vdbe_add_op(v, OP_Column, src_table, i); + } + } else { + num_cols = elist->nExpr; + for (i = 0; i < elist->nExpr; i++) { + __expr_code(parser, elist->a[i].pExpr); + } + } + + /* + * If the DISTINCT keyword was present on the SELECT statement + * and this row has been seen before, then do not make this row + * part of the result. + */ + if (distinct >= 0 && elist && elist->nExpr > 0) { +#if NULL_ALWAYS_DISTINCT + __vdbe_add_op(v, OP_IsNull, (- elist->nExpr), + (__vdbe_current_addr(v) + 7)); +#endif + __vdbe_add_op(v, OP_MakeKey, elist->nExpr, 1); + __add_key_type(v, elist); + __vdbe_add_op(v, OP_Distinct, distinct, + (__vdbe_current_addr(v) + 3)); + __vdbe_add_op(v, OP_Pop, (elist->nExpr + 1), 0); + __vdbe_add_op(v, OP_Goto, 0, cont); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_add_op(v, OP_PutStrKey, distinct, 0); + } + + switch(dest) { + /* + * In this mode, write each query result to the key of the + * temporary table param. + */ + case SRT_Union: + __vdbe_add_op(v, OP_MakeRecord, num_cols, + NULL_ALWAYS_DISTINCT); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_add_op(v, OP_PutStrKey, param, 0); + break; + /* + * Store the result as data using a unique key. + */ + case SRT_Table: /* FALLTHROUGH */ + case SRT_TempTable: + __vdbe_add_op(v, OP_MakeRecord, num_cols, 0); + if (orderby_clause) { + __push_onto_sorter(parser, v, orderby_clause); + } else { + __vdbe_add_op(v, OP_NewRecno, param, 0); + __vdbe_add_op(v, OP_Pull, 1, 0); + __vdbe_add_op(v, OP_PutIntKey, param, 0); + } + break; + + /* + * Construct a record from the query result, but instead of + * saving that record, use it as a key to delete elements from + * the temporary table param. + */ + case SRT_Except: + addr = __vdbe_add_op(v, OP_MakeRecord, num_cols, + NULL_ALWAYS_DISTINCT); + __vdbe_add_op(v, OP_NotFound, param, (addr + 3)); + __vdbe_add_op(v, OP_Delete, param, 0); + break; + + /* + * If we are creating a set for an "expr IN (SELECT ...)" + * construct, then there should be a single item on the + * stack. Write this item into the set table with bogus data. + */ + case SRT_Set: + addr1 = __vdbe_current_addr(v); + DBSQL_ASSERT(num_cols == 1); + __vdbe_add_op(v, OP_NotNull, -1, (addr1 + 3)); + __vdbe_add_op(v, OP_Pop, 1, 0); + addr2 = __vdbe_add_op(v, OP_Goto, 0, 0); + if (orderby_clause) { + __push_onto_sorter(parser, v, orderby_clause); + } else { + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_add_op(v, OP_PutStrKey, param, 0); + } + __vdbe_change_p2(v, addr2, __vdbe_current_addr(v)); + break; + + /* + * If this is a scalar select that is part of an expression, + * then store the results in the appropriate memory cell and + * break out of the scan loop. + */ + case SRT_Mem: + DBSQL_ASSERT(num_cols == 1); + if (orderby_clause) { + __push_onto_sorter(parser, v, orderby_clause); + } else { + __vdbe_add_op(v, OP_MemStore, param, 1); + __vdbe_add_op(v, OP_Goto, 0, brk); + } + break; + + /* + * Send the data to the callback function. + */ + case SRT_Callback: /* FALLTHROUGH */ + case SRT_Sorter: + if (orderby_clause) { + __vdbe_add_op(v, OP_SortMakeRec, num_cols, 0); + __push_onto_sorter(parser, v, orderby_clause); + } else { + DBSQL_ASSERT(dest == SRT_Callback); + __vdbe_add_op(v, OP_Callback, num_cols, 0); + } + break; + + /* + * Invoke a subroutine to handle the results. The subroutine + * itself is responsible for popping the results off of the + * stack. + */ + case SRT_Subroutine: + if (orderby_clause) { + __vdbe_add_op(v, OP_MakeRecord, num_cols, 0); + __push_onto_sorter(parser, v, orderby_clause); + } else { + __vdbe_add_op(v, OP_Gosub, 0, param); + } + break; + + /* + * Discard the results. This is used for SELECT statements + * inside the body of a TRIGGER. The purpose of such selects + * is to call user-defined functions that have side effects. + * We do not care about the actual results of the select. + */ + default: + DBSQL_ASSERT(dest == SRT_Discard); + __vdbe_add_op(v, OP_Pop, num_cols, 0); + break; + } + return 0; +} + +/* + * __generate_sort_tail -- + * If the inner loop was generated using a non-null orderby_clause + * argument, then the results were placed in a sorter. After the + * loop is terminated we need to run the sorter and output the results. + * The following routine generates the code needed to do that. + * + * STATIC: static void __generate_sort_tail __P((select_t *, vdbe_t *, int, + * STATIC: int, int)); + * + * select The SELECT statement + * v Generate code into this VDBE + * num_cols Number of columns of data + * dest Write the sorted results here + * param Optional parameter associated with dest + */ +static void +__generate_sort_tail(select, v, num_cols, dest, param) + select_t *select; + vdbe_t *v; + int num_cols; + int dest; + int param; +{ + int i, addr; + int end = __vdbe_make_label(v); + if (dest == SRT_Sorter) + return; + __vdbe_add_op(v, OP_Sort, 0, 0); + addr = __vdbe_add_op(v, OP_SortNext, 0, end); + if (select->iOffset >= 0) { + __vdbe_add_op(v, OP_MemIncr, select->iOffset, (addr + 4)); + __vdbe_add_op(v, OP_Pop, 1, 0); + __vdbe_add_op(v, OP_Goto, 0, addr); + } + if (select->iLimit >= 0) { + __vdbe_add_op(v, OP_MemIncr, select->iLimit, end); + } + switch(dest) { + case SRT_Callback: + __vdbe_add_op(v, OP_SortCallback, num_cols, 0); + break; + case SRT_Table: /* FALLTHROUGH */ + case SRT_TempTable: + __vdbe_add_op(v, OP_NewRecno, param, 0); + __vdbe_add_op(v, OP_Pull, 1, 0); + __vdbe_add_op(v, OP_PutIntKey, param, 0); + break; + case SRT_Set: + DBSQL_ASSERT(num_cols == 1); + __vdbe_add_op(v, OP_NotNull, -1, (__vdbe_current_addr(v) + 3)); + __vdbe_add_op(v, OP_Pop, 1, 0); + __vdbe_add_op(v, OP_Goto, 0, (__vdbe_current_addr(v) + 3)); + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_add_op(v, OP_PutStrKey, param, 0); + break; + case SRT_Mem: + DBSQL_ASSERT(num_cols == 1); + __vdbe_add_op(v, OP_MemStore, param, 1); + __vdbe_add_op(v, OP_Goto, 0, end); + break; + case SRT_Subroutine: + for (i = 0; i < num_cols; i++) { + __vdbe_add_op(v, OP_Column, (-1 - i), i); + } + __vdbe_add_op(v, OP_Gosub, 0, param); + __vdbe_add_op(v, OP_Pop, 1, 0); + break; + default: + /* Do nothing. */ + break; + } + __vdbe_add_op(v, OP_Goto, 0, addr); + __vdbe_resolve_label(v, end); + __vdbe_add_op(v, OP_SortReset, 0, 0); +} + +/* + * __generate_column_types -- + * Generate code that will tell the VDBE the datatypes of + * columns in the result set. + * + * This routine only generates code if the "PRAGMA show_datatypes=on" + * has been executed. The datatypes are reported out in the azCol + * parameter to the callback function. The first N azCol[] entries + * are the names of the columns, and the second N entries are the + * datatypes for the columns. + * + * The "datatype" for a result that is a column of a type is the + * datatype definition extracted from the CREATE TABLE statement. + * The datatype for an expression is either TEXT or NUMERIC. The + * datatype for a ROWID field is INTEGER. + * + * STATIC: static void __generate_column_types __P((parser_t *, src_list_t *, + * STATIC: expr_list_t *)); + * + * parser Parser context + * tables List of tables + * elist Expressions defining the result set + */ +static void +__generate_column_types(parser, tables, elist) + parser_t *parser; + src_list_t *tables; + expr_list_t *elist; +{ + int i, j, col; + expr_t *p; + char *type; + table_t *table; + vdbe_t *v = parser->pVdbe; + if (parser->useCallback && + (parser->db->flags & DBSQL_ReportTypes) == 0) { + return; + } + for (i = 0; i < elist->nExpr; i++) { + p = elist->a[i].pExpr; + type = 0; + if (p == 0) + continue; + if (p->op == TK_COLUMN && tables) { + col = p->iColumn; + j = 0; + while (j < tables->nSrc && + tables->a[j].iCursor != p->iTable) { + j++; + } + DBSQL_ASSERT(j < tables->nSrc); + table = tables->a[j].pTab; + if (col < 0) + col = table->iPKey; + DBSQL_ASSERT(col == -1 || (col >= 0 && col < table->nCol)); + if (col < 0) { + type = "INTEGER"; + } else { + type = table->aCol[col].zType; + } + } else { + if (__expr_type(p) == DBSQL_SO_TEXT) { + type = "TEXT"; + } else { + type = "NUMERIC"; + } + } + __vdbe_add_op(v, OP_ColumnName, (i + elist->nExpr), 0); + __vdbe_change_p3(v, -1, type, P3_STATIC); + } +} + +/* + * __generate_column_names -- + * Generate code that will tell the VDBE the names of columns + * in the result set. This information is used to provide the + * azCol[] values in the callback. + * + * STATIC: static void __generate_column_names __P((parser_t *, src_list_t *, + * STATIC: expr_list_t *)); + * + * parser Parser context + * tables List of tables + * elist Expressions defining the result set + */ +static void +__generate_column_names(parser, tables, elist) + parser_t *parser; + src_list_t *tables; + expr_list_t *elist; +{ + int i, j, show_full_names, icol, addr; + char *type, *name, *col, *tab; + char namebuf[30]; /* TODO consider eliminating this */ + expr_t *p; + table_t *table; + vdbe_t *v = parser->pVdbe; + if (parser->colNamesSet || v == 0 || parser->rc == ENOMEM) + return; + parser->colNamesSet = 1; + for (i = 0; i < elist->nExpr; i++) { + type = 0; + p = elist->a[i].pExpr; + if (p == 0) + continue; + if (elist->a[i].zName) { + name = elist->a[i].zName; + __vdbe_add_op(v, OP_ColumnName, i, 0); + __vdbe_change_p3(v, -1, name, strlen(name)); + continue; + } + show_full_names = (parser->db->flags & DBSQL_FullColNames) !=0; + if (p->op == TK_COLUMN && tables) { + icol = p->iColumn; + j = 0; + while (j < tables->nSrc && + tables->a[j].iCursor != p->iTable) { + j++; + } + DBSQL_ASSERT(j < tables->nSrc); + table = tables->a[j].pTab; + if (icol < 0) + icol = table->iPKey; + DBSQL_ASSERT(icol == -1 ||(icol >= 0 && icol < table->nCol)); + if (icol < 0) { + col = "_ROWID_"; + type = "INTEGER"; + } else { + col = table->aCol[icol].zName; + type = table->aCol[icol].zType; + } + if (p->span.z && p->span.z[0] && !show_full_names) { + addr = __vdbe_add_op(v,OP_ColumnName, i, 0); + __vdbe_change_p3(v, -1, p->span.z, p->span.n); + __vdbe_compress_space(v, addr); + } else if (tables->nSrc > 1 || show_full_names) { + name = 0; + tab = 0; + tab = tables->a[j].zAlias; + if (show_full_names || tab == 0) + tab = table->zName; + __str_append(&name, tab, ".", col, 0); + __vdbe_add_op(v, OP_ColumnName, i, 0); + __vdbe_change_p3(v, -1, name, strlen(name)); + __dbsql_free(NULL, name); + } else { + __vdbe_add_op(v, OP_ColumnName, i, 0); + __vdbe_change_p3(v, -1, col, 0); + } + } else if (p->span.z && p->span.z[0]) { + addr = __vdbe_add_op(v, OP_ColumnName, i, 0); + __vdbe_change_p3(v, -1, p->span.z, p->span.n); + __vdbe_compress_space(v, addr); + } else { + DBSQL_ASSERT( p->op!=TK_COLUMN || tables==0 ); + sprintf(namebuf, "column%d", i+1); + __vdbe_add_op(v, OP_ColumnName, i, 0); + __vdbe_change_p3(v, -1, namebuf, strlen(namebuf)); + } + } +} + +/* + * __select_op_name -- + * Name of the connection operator, used for error messages. + * + * STATIC: static const char *__select_op_name __P((int)); + */ +static const char * +__select_op_name(id) + int id; +{ + char *z; + switch(id) { + case TK_ALL: z = "UNION ALL"; break; + case TK_INTERSECT: z = "INTERSECT"; break; + case TK_EXCEPT: z = "EXCEPT"; break; + default: z = "UNION"; break; + } + return z; +} + +/* + * __fill_in_column_list -- + * For the given SELECT statement, do three things. + * + * (1) Fill in the tables->a[].pTab fields in the SrcList that + * defines the set of tables that should be scanned. For views, + * fill tables->a[].pSelect with a copy of the SELECT statement + * that implements the view. A copy is made of the view's SELECT + * statement so that we can freely modify or delete that statement + * without worrying about messing up the presistent representation + * of the view. + * + * (2) Add terms to the WHERE clause to accomodate the NATURAL keyword + * on joins and the ON and USING clause of joins. + * + * (3) Scan the list of columns in the result set (pEList) looking + * for instances of the "*" operator or the TABLE.* operator. + * If found, expand each "*" to be every column in every table + * and TABLE.* to be every column in TABLE. + * + * Return 0 on success. If there are problems, leave an error message + * in parser and return non-zero. + * + * STATIC: static int __file_in_column_list __P((parser_t *, select_t *)); + */ +static int +__fill_in_column_list(parser, select) + parser_t *parser; + select_t *select; +{ + int i, j, k, rc; + src_list_t *tables; + expr_list_t *elist; + table_t *table; + expr_t *e; + struct expr_list_item *a; + expr_list_t *new; + int table_seen; + token_t *name; + table_t *tab; + char *tab_name, *jname; + expr_t *expr, *left, *right; + char fake_name[60]; /* TODO consider replacing this */ + + if (select == 0 || select->pSrc == 0) + return 1; + tables = select->pSrc; + elist = select->pEList; + + /* + * Look up every table in the table list. + */ + for(i = 0; i < tables->nSrc; i++) { + if (tables->a[i].pTab) { + /* This routine has run before! No need to continue. */ + return 0; + } + if (tables->a[i].zName == 0) { + /* A sub-query in the FROM clause of a SELECT. */ + DBSQL_ASSERT(tables->a[i].pSelect != 0); + if (tables->a[i].zAlias == 0) { + sprintf(fake_name, "___subquery_%p_", + (void*)tables->a[i].pSelect); + __str_append(&tables->a[i].zAlias, + fake_name, 0); + } + tables->a[i].pTab = table = + __select_result_set(parser, + tables->a[i].zAlias, + tables->a[i].pSelect); + if (table == 0) { + return 1; + } + /* + * The isTransient flag indicates that the table_t + * structure has been dynamically allocated and may + * be freed at any time. In other words, table is + * not pointing to a persistent table structure that + * defines part of the schema. + */ + table->isTransient = 1; + } else { + /* An ordinary table or view name in the FROM clause.*/ + tables->a[i].pTab = table = + __locate_table(parser, tables->a[i].zName, + tables->a[i].zDatabase); + if (table == 0) { + return 1; + } + if (table->pSelect) { + /* + * We reach here if the named table is a + * really a view. + */ + if (__view_get_column_names(parser, table)) { + return 1; + } + /* + * If tables->a[i].pSelect!=0 it means we are + * dealing with a view within a view. The + * SELECT structure has already been copied by + * the outer view so we can skip the copy step + * here in the inner view. + */ + if (tables->a[i].pSelect == 0) { + tables->a[i].pSelect = + __select_dup(table->pSelect); + } + } + } + } + + /* + * Process NATURAL keywords, and ON and USING clauses of joins. + */ + if (__process_join(parser, select)) + return 1; + + /* + * For every "*" that occurs in the column list, insert the names of + * all columns in all tables. And for every TABLE.* insert the names + * of all columns in TABLE. The parser inserted a special expression + * with the TK_ALL operator for each "*" that it found in the column + * list. The following code just has to locate the TK_ALL expressions + * and expand each one to the list of all columns in all tables. + * + * The first loop just checks to see if there are any "*" operators + * that need expanding. + */ + for (k = 0; k < elist->nExpr; k++) { + e = elist->a[k].pExpr; + if (e->op == TK_ALL) + break; + if (e->op == TK_DOT && e->pRight && e->pRight->op == TK_ALL + && e->pLeft && e->pLeft->op == TK_ID) + break; + } + rc = 0; + if (k < elist->nExpr) { + /* + * If we get here it means the result set contains one or + * more "*" operators that need to be expanded. Loop through + * each expression in the result set and expand them one by + * one. + */ + a = elist->a; + new = 0; + for (k = 0; k < elist->nExpr; k++) { + e = a[k].pExpr; + if (e->op != TK_ALL && (e->op != TK_DOT || + e->pRight == 0 || + e->pRight->op != TK_ALL)) { + /* + * This particular expression does not need + * to be expanded. + */ + new = __expr_list_append(new, a[k].pExpr, 0); + new->a[new->nExpr-1].zName = a[k].zName; + a[k].pExpr = 0; + a[k].zName = 0; + } else { + /* + * This expression is a "*" or a "TABLE.*" and + * needs to be expanded. + */ + /* 'name' is the text of name of TABLE */ + table_seen = 0; /* 1 when TABLE matches */ + if (e->op == TK_DOT && e->pLeft) { + name = &e->pLeft->token; + } else { + name = 0; + } + for (i = 0; i < tables->nSrc; i++) { + tab = tables->a[i].pTab; + tab_name = tables->a[i].zAlias; + if (tab_name==0 || tab_name[0]==0 ){ + tab_name = tab->zName; + } + if (name && + (tab_name == 0 || + tab_name[0] == 0 || + strncasecmp(name->z, + tab_name, + name->n) != + 0 || tab_name[name->n] != 0)) { + continue; + } + table_seen = 1; + for (j = 0; j < tab->nCol; j++) { + jname = tab->aCol[j].zName; + + if (i > 0 && + (tables->a[i-1].jointype & + JT_NATURAL) != 0 && + __column_index( + tables->a[i-1].pTab, + jname) >= 0) { + /* + * In a NATURAL join, omit + * the join columns from + * the table on the right. + */ + continue; + } + if(i > 0 && + __id_list_index( + tables->a[i-1].pUsing, + jname) >= 0) { + /* + * In a join with a USING + * clause, omit columns in + * the using clause from + * the table on the right. + */ + continue; + } + right = __expr(TK_ID, 0, 0, 0); + if (right == 0) + break; + right->token.z = jname; + right->token.n = strlen(jname); + right->token.dyn = 0; + if (tab_name && tables->nSrc > 1) { + left = __expr(TK_ID, 0, + 0, 0); + expr = __expr(TK_DOT, left, + right, 0); + if (expr == 0) + break; + left->token.z = tab_name; + left->token.n = + strlen(tab_name); + left->token.dyn = 0; + __str_append((char**)&expr->span.z, tab_name, ".", jname, 0); + expr->span.n = strlen(expr->span.z); + expr->span.dyn = 1; + expr->token.z = 0; + expr->token.n = 0; + expr->token.dyn = 0; + } else { + expr = right; + expr->span = expr->token; + } + new = __expr_list_append(new, expr, + 0); + } + } + if (!table_seen) { + if (name) { + __error_msg(parser, + "no such table: %T", + name); + } else { + __error_msg(parser, + "no tables specified"); + } + rc = 1; + } + } + } + __expr_list_delete(elist); + select->pEList = new; + } + return rc; +} + +/* + * __select_unbind -- + * This routine recursively unlinks the select_t.pSrc.a[].pTab pointers + * in a select structure. It just sets the pointers to NULL. This + * routine is recursive in the sense that if the select_t.pSrc.a[].pSelect + * pointer is not NULL, this routine is called recursively on that + * pointer. + * + * This routine is called on the select_t structure that defines a + * VIEW in order to undo any bindings to tables. This is necessary + * because those tables might be DROPed by a subsequent SQL command. + * If the bindings are not removed, then the select_t.pSrc->a[].pTab + * field will be left pointing to a deallocated table_t structure after + * the DROP and a coredump will occur the next time the VIEW is used. + * + * PUBLIC: void __select_unbind __P((select_t *)); + */ +void +__select_unbind(select) + select_t *select; +{ + int i; + table_t *table; + src_list_t *src = select->pSrc; + + if (select == 0) + return; + for (i = 0; i < src->nSrc; i++) { + if ((table = src->a[i].pTab) != 0) { + if (table->isTransient) { + __vdbe_delete_table(0, table); + } + src->a[i].pTab = 0; + if (src->a[i].pSelect) { + __select_unbind(src->a[i].pSelect); + } + } + } +} + +/* + * __match_orderby_to_column -- + * This routine associates entries in an ORDER BY expression list with + * columns in a result. For each ORDER BY expression, the opcode of + * the top-level node is changed to TK_COLUMN and the iColumn value of + * the top-level node is filled in with column number and the iTable + * value of the top-level node is filled with iTable parameter. + * + * If there are prior SELECT clauses, they are processed first. A match + * in an earlier SELECT takes precedence over a later SELECT. + * + * Any entry that does not match is flagged as an error. The number + * of errors is returned. + * + * This routine does NOT correctly initialize the expr_t.dataType field + * of the ORDER BY expressions. The __multi_select_sort_order() routine + * must be called to do that after the individual select statements + * have all been analyzed. This routine is unable to compute + * expr_t.dataType because it must be called before the individual + * select statements have been analyzed. + * + * STATIC: static int __match_orderby_to_column __P((parser_t *, select_t *, + * STATIC: expr_list_t *, int, int)); + * + * parser A place to leave error messages + * select Match to result columns of this SELECT + * orderby_clause The ORDER BY values to match against columns + * table_idx Insert this value in table_idx + * must_complete_p If TRUE all ORDER BYs must match + */ +static int +__match_orderby_to_column(parser, select, orderby_clause, table_idx, + must_complete_p) + parser_t *parser; + select_t *select; + expr_list_t *orderby_clause; + int table_idx; + int must_complete_p; +{ + int i, j, col; + int num_err = 0; + expr_list_t *elist; + expr_t *e; + char *name, *label; + + if (select == 0 || orderby_clause == 0) + return 1; + if (must_complete_p) { + for (i = 0; i < orderby_clause->nExpr; i++) { + orderby_clause->a[i].done = 0; + } + } + if (__fill_in_column_list(parser, select)) { + return 1; + } + if (select->pPrior) { + if (__match_orderby_to_column(parser, select->pPrior, + orderby_clause, table_idx, 0)) { + return 1; + } + } + elist = select->pEList; + for (i = 0; i < orderby_clause->nExpr; i++) { + e = orderby_clause->a[i].pExpr; + col = -1; + if (orderby_clause->a[i].done) + continue; + if (__expr_is_integer(e, &col)) { + if (col <= 0 || col > elist->nExpr) { + __error_msg(parser, "ORDER BY position %d " + "should be between 1 and %d", + col, elist->nExpr); + num_err++; + break; + } + if (!must_complete_p) + continue; + col--; + } + for (j = 0; col < 0 && j < elist->nExpr; j++) { + if (elist->a[j].zName && + (e->op == TK_ID || e->op == TK_STRING)) { + name = elist->a[j].zName; + DBSQL_ASSERT(e->token.z); + __dbsql_strndup(NULL, e->token.z, &label, + e->token.n); + __str_unquote(label); + if (strcasecmp(name, label) == 0) { + col = j; + } + __dbsql_free(NULL, label); + } + if (col < 0 && __expr_compare(e, elist->a[j].pExpr)) { + col = j; + } + } + if (col >= 0) { + e->op = TK_COLUMN; + e->iColumn = col; + e->iTable = table_idx; + orderby_clause->a[i].done = 1; + } + if (col < 0 && must_complete_p) { + __error_msg(parser, "ORDER BY term number %d does not " + "match any result column", (i + 1)); + num_err++; + break; + } + } + return num_err; +} + +/* + * __parser_get_vdbe -- + * Get a VDBE for the given parser context. Create a new one if + * necessary. If an error occurs, return NULL and leave a message + * in parser. + * + * PUBLIC: vdbe_t *__parser_get_vdbe __P((parser_t *)); + */ +vdbe_t * +__parser_get_vdbe(parser) + parser_t *parser; +{ + vdbe_t *v = parser->pVdbe; + if (v == 0) { + v = parser->pVdbe = __vdbe_create(parser->db); + } + return v; +} + +/* + * __multi_select_sort_order -- + * This routine sets the expr_t.dataType field on all elements of + * the orderby_clause expression list. The orderby_clause list will + * have been set up by __match_orderby_to_column(). Hence each + * expression has a TK_COLUMN as its root node. The expr_t.iColumn + * refers to a column in the result set. The datatype is set to + * DBSQL_SO_TEXT if the corresponding column in p and every SELECT to + * the left of 'select' has a datatype of DBSQL_SO_TEXT. If the + * cooressponding column in 'select' or any of the left SELECTs is + * DBSQL_SO_NUM, then the datatype of the order-by expression is set + * to DBSQL_SO_NUM. + * + * Examples: + * + * CREATE TABLE one(a INTEGER, b TEXT); + * CREATE TABLE two(c VARCHAR(5), d FLOAT); + * + * SELECT b, b FROM one UNION SELECT d, c FROM two ORDER BY 1, 2; + * + * The primary sort key will use DBSQL_SO_NUM because the "d" in + * the second SELECT is numeric. The 1st column of the first SELECT + * is text but that does not matter because a numeric always overrides + * a text. + * + * The secondary key will use the DBSQL_SO_TEXT sort order because + * both the (second) "b" in the first SELECT and the "c" in the second + * SELECT have a datatype of text. + * + * STATIC: static void __multi_select_sort_order __P((select_t *, + * STATIC: expr_list_t *)); + */ +static void +__multi_select_sort_order(select, orderby_clause) + select_t *select; + expr_list_t *orderby_clause; +{ + int i; + expr_list_t *elist; + expr_t *e; + + if (orderby_clause == 0) + return; + if (select == 0) { + for (i = 0; i < orderby_clause->nExpr; i++) { + orderby_clause->a[i].pExpr->dataType = DBSQL_SO_TEXT; + } + return; + } + __multi_select_sort_order(select->pPrior, orderby_clause); + elist = select->pEList; + for (i = 0; i < orderby_clause->nExpr; i++) { + e = orderby_clause->a[i].pExpr; + if (e->dataType == DBSQL_SO_NUM) + continue; + DBSQL_ASSERT(e->iColumn >= 0); + if (elist->nExpr > e->iColumn) { + e->dataType = __expr_type(elist->a[e->iColumn].pExpr); + } + } +} + +/* + * __compute_limit_registers -- + * Compute the iLimit and iOffset fields of the SELECT based on the + * nLimit and nOffset fields. nLimit and nOffset hold the integers + * that appear in the original SQL statement after the LIMIT and OFFSET + * keywords. Or that hold -1 and 0 if those keywords are omitted. + * iLimit and iOffset are the integer memory register numbers for + * counters used to compute the limit and offset. If there is no + * limit and/or offset, then iLimit and iOffset are negative. + * + * This routine changes the values if iLimit and iOffset only if + * a limit or offset is defined by nLimit and nOffset. iLimit and + * iOffset should have been preset to appropriate default values + * (usually but not always -1) prior to calling this routine. + * Only if nLimit>=0 or nOffset>0 do the limit registers get + * redefined. The UNION ALL operator uses this property to force + * the reuse of the same limit and offset registers across multiple + * SELECT statements. + * + * STATIC: static void __compute_limit_registers __P((parser_t *, select_t *)); + */ +static void +__compute_limit_registers(parser, select) + parser_t *parser; + select_t *select; +{ + int mem; + vdbe_t *v; + + /* + * If the comparison is select->nLimit>0 then "LIMIT 0" shows + * all rows. It is the same as no limit. If the comparision is + * select->nLimit>=0 then "LIMIT 0" show no rows at all. + * "LIMIT -1" always shows all rows. There is some + * contraversy about what the correct behavior should be. + * The current implementation interprets "LIMIT 0" to mean + * no rows. + */ + if (select->nLimit >= 0) { + mem = parser->nMem++; + v = __parser_get_vdbe(parser); + if (v == 0) + return; + __vdbe_add_op(v, OP_Integer, (-select->nLimit), 0); + __vdbe_add_op(v, OP_MemStore, mem, 1); + select->iLimit = mem; + } + if (select->nOffset > 0) { + mem = parser->nMem++; + v = __parser_get_vdbe(parser); + if (v == 0) + return; + __vdbe_add_op(v, OP_Integer, (- select->nOffset), 0); + __vdbe_add_op(v, OP_MemStore, mem, 1); + select->iOffset = mem; + } +} + +/* + * __multi_select -- + * This routine is called to process a query that is really the union + * or intersection of two or more separate queries. + * + * 'select' points to the right-most of the two queries. The query on the + * left is select->pPrior. The left query could also be a compound query + * in which case this routine will be called recursively. + * + * The results of the total query are to be written into a destination + * of type eDest with parameter iParm. + * + * Example 1: Consider a three-way compound SQL statement. + * + * SELECT a FROM t1 UNION SELECT b FROM t2 UNION SELECT c FROM t3 + * + * This statement is parsed up as follows: + * + * SELECT c FROM t3 + * | + * `-----> SELECT b FROM t2 + * | + * `------> SELECT a FROM t1 + * + * The arrows in the diagram above represent the select_t.pPrior pointer. + * So if this routine is called with p equal to the t3 query, then + * pPrior will be the t2 query. select->op will be TK_UNION in this case. + * + * Notice that because of the way we parse compound SELECTs, the + * individual selects always group from left to right. + * + * STATIC: static int __multi_select __P((parser_t *, select_t *, int, int)); + * + */ +static int +__multi_select(parser, select, dest, param) + parser_t *parser; + select_t *select; + int dest; + int param; +{ + int tab1, tab2; + int cont, brk, start; + int rc; /* Success code from a subroutine */ + select_t *prior; /* Another SELECT immediately to our left */ + vdbe_t *v; /* Generate code to this VDBE */ + int union_tab; /* Cursor number of the temporary table + holding result */ + int op; /* One of the SRT_ operations to apply to self */ + int prior_op; /* The SRT_ operation to apply to prior selects */ + int limit, offset; /* Saved values of select->nLimit and + select->nOffset */ + expr_list_t *orderby_clause; /* The ORDER BY clause for the right + SELECT */ + + /* + * Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. + * Only the last SELECT in the series may have an ORDER BY or LIMIT. + */ + if (select == 0 || select->pPrior == 0) + return 1; + prior = select->pPrior; + if (prior->pOrderBy) { + __error_msg(parser, + "ORDER BY clause should come after %s not before", + __select_op_name(select->op)); + return 1; + } + if (prior->nLimit >= 0 || prior->nOffset > 0) { + __error_msg(parser, + "LIMIT clause should come after %s not before", + __select_op_name(select->op)); + return 1; + } + + /* + * Make sure we have a valid query engine. If not, create a new one. + */ + v = __parser_get_vdbe(parser); + if (v == 0) + return 1; + + /* + * Create the destination temporary table if necessary. + */ + if (dest == SRT_TempTable) { + __vdbe_add_op(v, OP_OpenTemp, param, 0); + dest = SRT_Table; + } + + /* + * Generate code for the left and right SELECT statements. + */ + switch(select->op) { + case TK_ALL: + if (select->pOrderBy == 0) { + prior->nLimit = select->nLimit; + prior->nOffset = select->nOffset; + rc = __select(parser, prior, dest, param, 0, 0, 0); + if (rc) + return rc; + select->pPrior = 0; + select->iLimit = prior->iLimit; + select->iOffset = prior->iOffset; + select->nLimit = -1; + select->nOffset = 0; + rc = __select(parser, select, dest, param, 0, 0, 0); + select->pPrior = prior; + if (rc) + return rc; + break; + } + /* For UNION ALL ... ORDER BY fall through to the next case. */ + case TK_EXCEPT: /* FALLTHROUGH */ + case TK_UNION: + prior_op = (select->op == TK_ALL) ? SRT_Table : SRT_Union; + if (dest == prior_op && select->pOrderBy == 0 && + select->nLimit < 0 && select->nOffset == 0) { + /* + * We can reuse a temporary table generated by a + * SELECT to our right. + */ + union_tab = param; + } else { + /* + * We will need to create our own temporary table + * to hold the intermediate results. + */ + union_tab = parser->nTab++; + if (select->pOrderBy && + __match_orderby_to_column(parser, select, + select->pOrderBy, + union_tab, 1)) { + return 1; + } + if (select->op != TK_ALL) { + __vdbe_add_op(v, OP_OpenTemp, union_tab, 1); + __vdbe_add_op(v, OP_KeyAsData, union_tab, 1); + } else { + __vdbe_add_op(v, OP_OpenTemp, union_tab, 0); + } + } + + /* + * Code the SELECT statements to our left. + */ + rc = __select(parser, prior, prior_op, union_tab, 0, 0, 0); + if (rc) + return rc; + + /* + * Code the current SELECT statement. + */ + switch(select->op) { + case TK_EXCEPT: op = SRT_Except; break; + case TK_UNION: op = SRT_Union; break; + case TK_ALL: op = SRT_Table; break; + } + select->pPrior = 0; + orderby_clause = select->pOrderBy; + select->pOrderBy = 0; + limit = select->nLimit; + select->nLimit = -1; + offset = select->nOffset; + select->nOffset = 0; + rc = __select(parser, select, op, union_tab, 0, 0, 0); + select->pPrior = prior; + select->pOrderBy = orderby_clause; + select->nLimit = limit; + select->nOffset = offset; + if (rc) + return rc; + + /* + * Convert the data in the temporary table into whatever form + * it is that we currently need. + */ + if (dest != prior_op || union_tab != param) { + DBSQL_ASSERT(select->pEList); + if (dest == SRT_Callback) { + __generate_column_names(parser, 0, + select->pEList); + __generate_column_types(parser, + select->pSrc, + select->pEList); + } + brk = __vdbe_make_label(v); + cont = __vdbe_make_label(v); + __vdbe_add_op(v, OP_Rewind, union_tab, brk); + __compute_limit_registers(parser, select); + start = __vdbe_current_addr(v); + __multi_select_sort_order(select, select->pOrderBy); + rc = __select_inner_loop(parser, select, + select->pEList, union_tab, + select->pEList->nExpr, + select->pOrderBy, -1, + dest, param, cont, brk); + if (rc) + return 1; + __vdbe_resolve_label(v, cont); + __vdbe_add_op(v, OP_Next, union_tab, start); + __vdbe_resolve_label(v, brk); + __vdbe_add_op(v, OP_Close, union_tab, 0); + if (select->pOrderBy) { + __generate_sort_tail(select, v, + select->pEList->nExpr, + dest, param); + } + } + break; + case TK_INTERSECT: + + /* + * INTERSECT is different from the others since it requires + * two temporary tables. Hence it has its own case. Begin + * by allocating the tables we will need. + */ + tab1 = parser->nTab++; + tab2 = parser->nTab++; + if (select->pOrderBy && + __match_orderby_to_column(parser, select, + select->pOrderBy, tab1, 1)) { + return 1; + } + __vdbe_add_op(v, OP_OpenTemp, tab1, 1); + __vdbe_add_op(v, OP_KeyAsData, tab1, 1); + + /* + * Code the SELECTs to our left into temporary table "tab1". + */ + rc = __select(parser, prior, SRT_Union, tab1, 0, 0, 0); + if (rc) + return rc; + + /* + * Code the current SELECT into temporary table "tab2". + */ + __vdbe_add_op(v, OP_OpenTemp, tab2, 1); + __vdbe_add_op(v, OP_KeyAsData, tab2, 1); + select->pPrior = 0; + limit = select->nLimit; + select->nLimit = -1; + offset = select->nOffset; + select->nOffset = 0; + rc = __select(parser, select, SRT_Union, tab2, 0, 0, 0); + select->pPrior = prior; + select->nLimit = limit; + select->nOffset = offset; + if (rc) + return rc; + + /* + * Generate code to take the intersection of the two temporary + * tables. + */ + DBSQL_ASSERT(select->pEList); + if (dest == SRT_Callback) { + __generate_column_names(parser, 0, select->pEList); + __generate_column_types(parser, select->pSrc, + select->pEList); + } + brk = __vdbe_make_label(v); + cont = __vdbe_make_label(v); + __vdbe_add_op(v, OP_Rewind, tab1, brk); + __compute_limit_registers(parser, select); + start = __vdbe_add_op(v, OP_FullKey, tab1, 0); + __vdbe_add_op(v, OP_NotFound, tab2, cont); + __multi_select_sort_order(select, select->pOrderBy); + rc = __select_inner_loop(parser, select, select->pEList, + tab1, select->pEList->nExpr, + select->pOrderBy, -1, dest, param, + cont, brk); + if (rc) + return 1; + __vdbe_resolve_label(v, cont); + __vdbe_add_op(v, OP_Next, tab1, start); + __vdbe_resolve_label(v, brk); + __vdbe_add_op(v, OP_Close, tab2, 0); + __vdbe_add_op(v, OP_Close, tab1, 0); + if (select->pOrderBy) { + __generate_sort_tail(select, v, select->pEList->nExpr, + dest, param); + } + break; + } + DBSQL_ASSERT(select->pEList && prior->pEList); + if (select->pEList->nExpr != prior->pEList->nExpr) { + __error_msg(parser, "SELECTs to the left and right of %s" + " do not have the same number of result columns", + __select_op_name(select->op)); + return 1; + } + + /* + * Issue a null callback if that is what the user wants. + */ + if (dest == SRT_Callback && + (parser->useCallback==0 || + (parser->db->flags & DBSQL_NullCallback) != 0)) { + __vdbe_add_op(v, OP_NullCallback, select->pEList->nExpr, 0); + } + return 0; +} + +static void __subst_expr_list(expr_list_t*,int,expr_list_t*); + +/* + * __subst_expr -- + * Scan through the expression expr. Replace every reference to + * a column in table number table with a copy of the iColumn-th + * entry in elist. (But leave references to the ROWID column + * unchanged.) + * + * This routine is part of the flattening procedure. A subquery + * whose result set is defined by pEList appears as entry in the + * FROM clause of a SELECT such that the VDBE cursor assigned to that + * FORM clause entry is iTable. This routine make the necessary + * changes to pExpr so that it refers directly to the source table + * of the subquery rather the result set of the subquery. + * + * STATIC: void __subst_expr __P((expr_t *, int, expr_list_t *)); + */ +static void +__subst_expr(expr, table, elist) + expr_t *expr; + int table; + expr_list_t *elist; +{ + expr_t *new; + + if (expr == 0) + return; + if (expr->op == TK_COLUMN && + expr->iTable == table && + expr->iColumn >= 0) { + DBSQL_ASSERT(elist != 0 && expr->iColumn < elist->nExpr); + DBSQL_ASSERT(expr->pLeft == 0 && + expr->pRight == 0 && + expr->pList == 0); + new = elist->a[expr->iColumn].pExpr; + DBSQL_ASSERT(new != 0); + expr->op = new->op; + expr->dataType = new->dataType; + DBSQL_ASSERT(expr->pLeft == 0); + expr->pLeft = __expr_dup(new->pLeft); + DBSQL_ASSERT(expr->pRight == 0); + expr->pRight = __expr_dup(new->pRight); + DBSQL_ASSERT(expr->pList == 0); + expr->pList = __expr_list_dup(new->pList); + expr->iTable = new->iTable; + expr->iColumn = new->iColumn; + expr->iAgg = new->iAgg; + __token_copy(&expr->token, &new->token); + __token_copy(&expr->span, &new->span); + } else { + __subst_expr(expr->pLeft, table, elist); + __subst_expr(expr->pRight, table, elist); + __subst_expr_list(expr->pList, table, elist); + } +} + +/* + * __subst_expr_list -- + * + * STATIC: static void __subst_expr_list __P((expr_list_t *, int, + * STATIC: expr_list_t *)); + */ +static void +__subst_expr_list(list, table, elist) + expr_list_t *list; + int table; + expr_list_t *elist; +{ + int i; + if (list == 0) + return; + for (i = 0; i < list->nExpr; i++) { + __subst_expr(list->a[i].pExpr, table, elist); + } +} + +/* + * __flatten_subquery -- + * This routine attempts to flatten subqueries in order to speed + * execution. It returns 1 if it makes changes and 0 if no flattening + * occurs. + * + * To understand the concept of flattening, consider the following + * query: + * + * SELECT a FROM (SELECT x+y AS a FROM t1 WHERE z<100) WHERE a>5 + * + * The default way of implementing this query is to execute the + * subquery first and store the results in a temporary table, then + * run the outer query on that temporary table. This requires two + * passes over the data. Furthermore, because the temporary table + * has no indices, the WHERE clause on the outer query cannot be + * optimized. + * + * This routine attempts to rewrite queries such as the above into + * a single flat select, like this: + * + * SELECT x+y AS a FROM t1 WHERE z<100 AND a>5 + * + * The code generated for this simpification gives the same result + * but only has to scan the data once. And because indices might + * exist on the table t1, a complete scan of the data might be + * avoided. + * + * Flattening is only attempted if all of the following are true: + * + * (1) The subquery and the outer query do not both use aggregates. + * + * (2) The subquery is not an aggregate or the outer query is not a join. + * + * (3) The subquery is not the right operand of a left outer join, or + * the subquery is not itself a join. (Ticket #306) + * + * (4) The subquery is not DISTINCT or the outer query is not a join. + * + * (5) The subquery is not DISTINCT or the outer query does not use + * aggregates. + * + * (6) The subquery does not use aggregates or the outer query is not + * DISTINCT. + * + * (7) The subquery has a FROM clause. + * + * (8) The subquery does not use LIMIT or the outer query is not a join. + * + * (9) The subquery does not use LIMIT or the outer query does not use + * aggregates. + * + * (10) The subquery does not use aggregates or the outer query does not + * use LIMIT. + * + * (11) The subquery and the outer query do not both have ORDER BY clauses. + * + * (12) The subquery is not the right term of a LEFT OUTER JOIN or the + * subquery has no WHERE clause. (added by ticket #350) + * + * In this routine, the 'select' parameter is a pointer to the outer + * query. The subquery is p->pSrc->a[iFrom]. isAgg is true if the + * outer query uses aggregates and subqueryIsAgg is true if the subquery + * uses aggregates. + * + * If flattening is not attempted, this routine is a no-op and returns 0. + * If flattening is attempted this routine returns 1. + * + * All of the expression analysis must occur on both the outer query and + * the subquery before this routine runs. + * + * STATIC: static int __flatten_subquery __P((parser_t *, select_t *, int, + * STATIC: int, int)); + * + * parser The parsing context + * select The parent or outer SELECT statement + * from Index in p->pSrc->a[] of the inner subquery + * agg_p True if outer SELECT uses aggregate functions + * subquery_agg_p True if the subquery uses aggregate functions + */ +static int +__flatten_subquery(parser, select, from, agg_p, subquery_agg_p) + parser_t *parser; + select_t *select; + int from; + int agg_p; + int subquery_agg_p; +{ + select_t *sub_select; /* The inner query or "subquery" */ + src_list_t *outer_from_clause; /* The FROM clause of the outer query */ + src_list_t *sub_from_clause; /* The FROM clause of the subquery */ + expr_list_t *outer_query_results;/* The result set of the outer query*/ + int parent; /* VDBE cursor number of the pSub + result set temp table */ + int i, nsub_src, jointype, extra; + expr_t *where, *expr, *having; + + /* + * Check to see if flattening is permitted. Return 0 if not. + */ + if (select == 0) + return 0; + outer_from_clause = select->pSrc; + DBSQL_ASSERT(outer_from_clause && + from >= 0 && + from < outer_from_clause->nSrc); + sub_select = outer_from_clause->a[from].pSelect; + DBSQL_ASSERT(sub_select != 0); + if (agg_p && subquery_agg_p) + return 0; + if (subquery_agg_p && outer_from_clause->nSrc > 1) + return 0; + sub_from_clause = sub_select->pSrc; + DBSQL_ASSERT(sub_from_clause); + if (sub_from_clause->nSrc == 0) + return 0; + if ((sub_select->isDistinct || sub_select->nLimit >= 0) && + (outer_from_clause->nSrc > 1 || agg_p)) { + return 0; + } + if ((select->isDistinct || select->nLimit >= 0) + && subquery_agg_p ) + return 0; + if (select->pOrderBy && sub_select->pOrderBy) + return 0; + + /* + * Restriction 3: If the subquery is a join, make sure the subquery + * is not used as the right operand of an outer join. Examples of + * why this is not allowed: + * + * t1 LEFT OUTER JOIN (t2 JOIN t3) + * + * If we flatten the above, we would get + * + * (t1 LEFT OUTER JOIN t2) JOIN t3 + * + * which is not at all the same thing. + */ + if (sub_from_clause->nSrc > 1 && from > 0 && + (outer_from_clause->a[from-1].jointype & JT_OUTER) != 0) { + return 0; + } + + /* + * Restriction 12: If the subquery is the right operand of a left + * outer join, make sure the subquery has no WHERE clause. + * An examples of why this is not allowed: + * + * t1 LEFT OUTER JOIN (SELECT * FROM t2 WHERE t2.x>0) + * + * If we flatten the above, we would get + * + * (t1 LEFT OUTER JOIN t2) WHERE t2.x>0 + * + * But the t2.x>0 test will always fail on a NULL row of t2, which + * effectively converts the OUTER JOIN into an INNER JOIN. + */ + if (from > 0 && + (outer_from_clause->a[from-1].jointype & JT_OUTER) != 0 && + sub_select->pWhere != 0) { + return 0; + } + + /* + * If we reach this point, it means flattening is permitted for the + * from-th entry of the FROM clause in the outer query. + */ + + /* + * Move all of the FROM elements of the subquery into the + * the FROM clause of the outer query. Before doing this, remember + * the cursor number for the original outer query FROM element in + * parent. The parent cursor will never be used. Subsequent code + * will scan expressions looking for parent references and replace + * those references with expressions that resolve to the subquery FROM + * elements we are now copying in. + */ + parent = outer_from_clause->a[from].iCursor; + nsub_src = sub_from_clause->nSrc; + jointype = outer_from_clause->a[from].jointype; + + if (outer_from_clause->a[from].pTab && + outer_from_clause->a[from].pTab->isTransient) { + __vdbe_delete_table(0, outer_from_clause->a[from].pTab); + } + __dbsql_free(NULL, outer_from_clause->a[from].zDatabase); + __dbsql_free(NULL, outer_from_clause->a[from].zName); + __dbsql_free(NULL, outer_from_clause->a[from].zAlias); + if (nsub_src > 1) { + extra = nsub_src - 1; + for (i = 1; i < nsub_src; i++) { + outer_from_clause = + __src_list_append(outer_from_clause, 0, 0); + } + select->pSrc = outer_from_clause; + for (i = (outer_from_clause->nSrc - 1); + (i - extra) >= from; i--) { + outer_from_clause->a[i] =outer_from_clause->a[i-extra]; + } + } + for(i = 0; i < nsub_src; i++) { + outer_from_clause->a[i+from] = sub_from_clause->a[i]; + memset(&sub_from_clause->a[i], 0, + sizeof(sub_from_clause->a[i])); + } + outer_from_clause->a[(from + nsub_src - 1)].jointype = jointype; + + /* + * Now begin substituting subquery result set expressions for + * references to the parent in the outer query. + * + * Example: + * + *SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b; + *\ \_____________ subquery __________/ / + * \_____________________ outer query ______________________________/ + * + * We look at every expression in the outer query and every place we + * see "a" we substitute "x*3" and every place we see "b" we + * substitute "y+10". + */ + __subst_expr_list(select->pEList, parent, sub_select->pEList); + outer_query_results = select->pEList; + for(i = 0; i < outer_query_results->nExpr; i++) { + if (outer_query_results->a[i].zName == 0 && + (expr = outer_query_results->a[i].pExpr)->span.z != 0) { + __dbsql_strndup(NULL, expr->span.z, + &outer_query_results->a[i].zName, + expr->span.n); + } + } + if (agg_p) { + __subst_expr_list(select->pGroupBy, parent, + sub_select->pEList); + __subst_expr(select->pHaving, parent, sub_select->pEList); + } + if (sub_select->pOrderBy) { + DBSQL_ASSERT(select->pOrderBy == 0); + select->pOrderBy = sub_select->pOrderBy; + sub_select->pOrderBy = 0; + } else if (select->pOrderBy) { + __subst_expr_list(select->pOrderBy, parent, + sub_select->pEList); + } + if (sub_select->pWhere) { + where = __expr_dup(sub_select->pWhere); + } else { + where = 0; + } + if (subquery_agg_p) { + DBSQL_ASSERT(select->pHaving == 0); + select->pHaving = select->pWhere; + select->pWhere = where; + __subst_expr(select->pHaving, parent, sub_select->pEList); + if (sub_select->pHaving) { + having = __expr_dup(sub_select->pHaving); + if (select->pHaving) { + select->pHaving = __expr(TK_AND, + select->pHaving, + having, 0); + } else { + select->pHaving = having; + } + } + DBSQL_ASSERT(select->pGroupBy == 0); + select->pGroupBy = __expr_list_dup(sub_select->pGroupBy); + } else if (select->pWhere == 0) { + select->pWhere = where; + } else { + __subst_expr(select->pWhere, parent, sub_select->pEList); + if (where) { + select->pWhere = __expr(TK_AND, select->pWhere, + where, 0); + } + } + + /* + * The flattened query is distinct if either the inner or the + * outer query is distinct. + */ + select->isDistinct = select->isDistinct || sub_select->isDistinct; + + /* + * Transfer the limit expression from the subquery to the outer + * query. + */ + if (sub_select->nLimit >= 0) { + if (select->nLimit < 0) { + select->nLimit = sub_select->nLimit; + } else if ((select->nLimit + select->nOffset) > + (sub_select->nLimit + sub_select->nOffset)) { + select->nLimit = sub_select->nLimit + + sub_select->nOffset - select->nOffset; + } + } + select->nOffset += sub_select->nOffset; + + /* + * Finially, delete what is left of the subquery and return success. + */ + __select_delete(sub_select); + return 1; +} + +/* + * __min_max_query -- + * Analyze the SELECT statement passed in as an argument to see if it + * is a simple min() or max() query. If it is and this query can be + * satisfied using a single seek to the beginning or end of an index, + * then generate the code for this SELECT and return 1. If this is not a + * simple min() or max() query, then return 0; + * + * A simply min() or max() query looks like this: + * + * SELECT min(a) FROM table; + * SELECT max(a) FROM table; + * + * The query may have only a single table in its FROM argument. There + * can be no GROUP BY or HAVING or WHERE clauses. The result set must + * be the min() or max() of a single column of the table. The column + * in the min() or max() function must be indexed. + * + * The parameters to this routine are the same as for __select(). + * See the header comment on that routine for additional information. + * + * STATIC: static int __min_max_query __P((parser_t *, select_t *, int, int)); + */ +static int +__min_max_query(parser, select, dest, param) + parser_t *parser; + select_t *select; + int dest; + int param; +{ + expr_t *expr; + int col; + table_t *table; + index_t *index; + int base; + vdbe_t *v; + int seek_op; + int cont; + expr_list_t elist; + struct expr_list_item list_item; + + /* + * Check to see if this query is a simple min() or max() query. Return + * zero if it is not. + */ + if (select->pGroupBy || select->pHaving || select->pWhere) + return 0; + if (select->pSrc->nSrc != 1) + return 0; + if (select->pEList->nExpr != 1) + return 0; + expr = select->pEList->a[0].pExpr; + if (expr->op != TK_AGG_FUNCTION) + return 0; + if (expr->pList == 0 || expr->pList->nExpr != 1) + return 0; + if (expr->token.n != 3) + return 0; + if (strncasecmp(expr->token.z, "min", 3) == 0) { + seek_op = OP_Rewind; + } else if (strncasecmp(expr->token.z, "max", 3) == 0) { + seek_op = OP_Last; + } else { + return 0; + } + expr = expr->pList->a[0].pExpr; + if (expr->op != TK_COLUMN) + return 0; + col = expr->iColumn; + table = select->pSrc->a[0].pTab; + + /* + * If we get to here, it means the query is of the correct form. + * Check to make sure we have an index and make index point to the + * appropriate index. If the min() or max() is on an INTEGER PRIMARY + * key column, no index is necessary so set index to NULL. If no + * usable index is found, return 0. + */ + if (col < 0) { + index = 0; + } else { + for (index = table->pIndex; index; index = index->pNext) { + DBSQL_ASSERT(index->nColumn >= 1); + if (index->aiColumn[0] == col) + break; + } + if (index == 0) + return 0; + } + + /* + * Identify column types if we will be using the callback. This + * step is skipped if the output is going to a table or a memory cell. + * The column names have already been generated in the calling + * function. + */ + v = __parser_get_vdbe(parser); + if (v == 0) + return 0; + if (dest == SRT_Callback) { + __generate_column_types(parser, select->pSrc, select->pEList); + } + + /* + * If the output is destined for a temporary table, open that table. + */ + if (dest == SRT_TempTable) { + __vdbe_add_op(v, OP_OpenTemp, param, 0); + } + + /* + * Generating code to find the min or the max. Basically all we have + * to do is find the first or the last entry in the chosen index. If + * the min() or max() is on the INTEGER PRIMARY KEY, then find the + * first or last entry in the main table. + */ + __code_verify_schema(parser, table->iDb); + base = select->pSrc->a[0].iCursor; + __compute_limit_registers(parser, select); + __vdbe_add_op(v, OP_Integer, table->iDb, 0); + __vdbe_add_op(v, OP_OpenRead, base, table->tnum); + __vdbe_change_p3(v, -1, table->zName, P3_STATIC); + cont = __vdbe_make_label(v); + if (index == 0) { + __vdbe_add_op(v, seek_op, base, 0); + } else { + __vdbe_add_op(v, OP_Integer, index->iDb, 0); + __vdbe_add_op(v, OP_OpenRead, (base + 1), index->tnum); + __vdbe_change_p3(v, -1, index->zName, P3_STATIC); + __vdbe_add_op(v, seek_op, (base + 1), 0); + __vdbe_add_op(v, OP_IdxRecno, (base + 1), 0); + __vdbe_add_op(v, OP_Close, (base + 1), 0); + __vdbe_add_op(v, OP_MoveTo, base, 0); + } + elist.nExpr = 1; + memset(&list_item, 0, sizeof(list_item)); + elist.a = &list_item; + elist.a[0].pExpr = expr; + __select_inner_loop(parser, select, &elist, 0, 0, 0, -1, dest, param, + cont, cont); + __vdbe_resolve_label(v, cont); + __vdbe_add_op(v, OP_Close, base, 0); + return 1; +} + +/* + * __select -- + * Generate code for the given SELECT statement. + * + * The results are distributed in various ways depending on the + * value of dest and param. + * + * dest Value Result + * ------------ ------------------------------------------- + * SRT_Callback Invoke the callback for each row of the result. + * + * SRT_Mem Store first result in memory cell param + * + * SRT_Set Store results as keys of a table with cursor param + * + * SRT_Union Store results as a key in a temporary table param + * + * SRT_Except Remove results from the temporary table param. + * + * SRT_Table Store results in temporary table param + * + * NOTE: The table above is incomplete. Additional dist value have be + * added since this comment was written. See the __select_inner_loop() + * function for a complete listing of the allowed values of dest and + * their meanings. + * + * This routine returns the number of errors. If any errors are + * encountered, then an appropriate error message is left in + * parser->zErrMsg. + * + * This routine does NOT free the select_t structure passed in. The + * calling function needs to do that. + * + * The pParent, parentTab, and *pParentAgg fields are filled in if this + * SELECT is a subquery. This routine may try to combine this SELECT + * with its parent to form a single flat query. In so doing, it might + * change the parent query from a non-aggregate to an aggregate query. + * For that reason, the pParentAgg flag is passed as a pointer, so it + * can be changed. + * + * Example 1: The meaning of the pParent parameter. + * + * SELECT * FROM t1 JOIN (SELECT x, count(*) FROM t2) JOIN t3; + * \ \_______ subquery _______/ / + * \ / + * \____________________ outer query ___________________/ + * + * This routine is called for the outer query first. For that call, + * pParent will be NULL. During the processing of the outer query, this + * routine is called recursively to handle the subquery. For the + * recursive call, pParent will point to the outer query. Because the + * subquery is the second element in a three-way join, the parentTab + * parameter will be 1 (the 2nd value of a 0-indexed array.) + * + * PUBLIC: int __select __P((parser_t *, select_t *, int, int, select_t *, + * PUBLIC: int, int *)); + * + * parser The parser context + * select The SELECT statement being coded + * dest How to dispose of the results + * param A parameter used by the dest disposal method + * parent Another SELECT for which this is a sub-query + * parent_tab Index in parent->pSrc of this query + * parent_agg_p True if parent uses aggregate functions + */ +int __select(parser, select, dest, param, parent, parent_tab, parent_agg_p) + parser_t *parser; + select_t *select; + int dest; + int param; + select_t *parent; + int parent_tab; + int *parent_agg_p; +{ + int i, j, col; + vdbe_t *v; + where_info_t *where_info; + int agg_p = 0; /* True for select lists like "count(*)" */ + expr_list_t *elist; /* List of columns to extract. */ + src_list_t *tables; /* List of tables to select from */ + expr_t *where; /* The WHERE clause. May be NULL */ + expr_list_t *orderby_clause;/* The ORDER BY clause. May be NULL */ + expr_list_t *groupby_clause;/* The GROUP BY clause. May be NULL */ + expr_t *having_clause; /* The HAVING clause. May be NULL */ + int distinct_p; /* True if DISTINCT keyword is present */ + int distinct; /* Table to use for the distinct set */ + int rc = 1; /* Value to return from this function */ + expr_t *e; + const char *saveauth_context; + int need_restore_context_p; + func_def_t *func; + int lbl1; + int endagg, startagg; + + if (parser->rc == ENOMEM || parser->nErr || select == 0) + return 1; + if (__auth_check(parser, DBSQL_SELECT, 0, 0, 0)) + return 1; + + /* + * If there is are a sequence of queries, do the earlier ones first. + */ + if (select->pPrior) { + return __multi_select(parser, select, dest, param); + } + + /* + * Make local copies of the parameters for this query. + */ + tables = select->pSrc; + where = select->pWhere; + orderby_clause = select->pOrderBy; + groupby_clause = select->pGroupBy; + having_clause = select->pHaving; + distinct_p = select->isDistinct; + + /* + * Allocate VDBE cursors for each table in the FROM clause. + */ + __src_list_assign_cursors(parser, tables); + + /* + * Do not even attempt to generate any code if we have already seen + * errors before this routine starts. + */ + if (parser->nErr > 0) + goto select_end; + + /* + * Expand any "*" terms in the result set. (For example the "*" in + * "SELECT * FROM t1") The fill_in_column_list() routine also does + * some other housekeeping - see the header comment for details. + */ + if (__fill_in_column_list(parser, select)) { + goto select_end; + } + where = select->pWhere; + elist = select->pEList; + if (elist == 0) + goto select_end; + + /* + * If writing to memory or generating a set + * only a single column may be output. + */ + if ((dest == SRT_Mem || dest == SRT_Set) && elist->nExpr > 1) { + __error_msg(parser, "only a single result allowed for " + "a SELECT that is part of an expression"); + goto select_end; + } + + /* + * ORDER BY is ignored for some destinations. + */ + switch(dest) { + case SRT_Union: /* FALLTHROUGH */ + case SRT_Except: /* FALLTHROUGH */ + case SRT_Discard: + orderby_clause = 0; + break; + default: + break; + } + + /* + * At this point, we should have allocated all the cursors that we + * need to handle subquerys and temporary tables. + * + * Resolve the column names and do a semantics check on all the + * expressions. + */ + for (i = 0; i < elist->nExpr; i++) { + if (__expr_resolve_ids(parser, tables, 0, elist->a[i].pExpr)) { + goto select_end; + } + if (__expr_check(parser, elist->a[i].pExpr, 1, &agg_p)) { + goto select_end; + } + } + if (where) { + if (__expr_resolve_ids(parser, tables, elist, where)) { + goto select_end; + } + if (__expr_check(parser, where, 0, 0)) { + goto select_end; + } + } + if (having_clause) { + if (groupby_clause == 0) { + __error_msg(parser, + "a GROUP BY clause is required before HAVING"); + goto select_end; + } + if (__expr_resolve_ids(parser, tables, elist, having_clause)) { + goto select_end; + } + if (__expr_check(parser, having_clause, 1, &agg_p)) { + goto select_end; + } + } + if (orderby_clause) { + for (i = 0; i < orderby_clause->nExpr; i++) { + e = orderby_clause->a[i].pExpr; + if (__expr_is_integer(e, &col) && col > 0 && + col <= elist->nExpr) { + __expr_delete(e); + e = orderby_clause->a[i].pExpr = + __expr_dup(elist->a[col-1].pExpr); + } + if (__expr_resolve_ids(parser, tables, elist, e)) { + goto select_end; + } + if (__expr_check(parser, e, agg_p, 0)) { + goto select_end; + } + if (__expr_is_constant(e)) { + if (__expr_is_integer(e, &col) == 0) { + __error_msg(parser, + "ORDER BY terms must not " + "be non-integer constants"); + goto select_end; + } else if (col <= 0 || col > elist->nExpr) { + __error_msg(parser, + "ORDER BY column number " + "%d out of range - should " + "be between 1 and %d", + col, elist->nExpr); + goto select_end; + } + } + } + } + if (groupby_clause) { + for (i = 0; i < groupby_clause->nExpr; i++) { + e = groupby_clause->a[i].pExpr; + if (__expr_is_integer(e, &col) && col > 0 && + col <= elist->nExpr) { + __expr_delete(e); + e = groupby_clause->a[i].pExpr = + __expr_dup(elist->a[col-1].pExpr); + } + if (__expr_resolve_ids(parser, tables, elist, e)) { + goto select_end; + } + if (__expr_check(parser, e, agg_p, 0)) { + goto select_end; + } + if (__expr_is_constant(e)) { + if (__expr_is_integer(e, &col) == 0) { + __error_msg(parser, + "GROUP BY terms must not " + "be non-integer constants"); + goto select_end; + } else if (col <= 0 || col > elist->nExpr) { + __error_msg(parser, + "GROUP BY column number " + "%d out of range - should " + "be between 1 and %d", + col, elist->nExpr); + goto select_end; + } + } + } + } + + /* + * Begin generating code. + */ + v = __parser_get_vdbe(parser); + if (v == 0) + goto select_end; + + /* + * Identify column names if we will be using them in a callback. This + * step is skipped if the output is going to some other destination. + */ + if (dest == SRT_Callback) { + __generate_column_names(parser, tables, elist); + } + + /* + * Check for the special case of a min() or max() function by itself + * in the result set. + */ + if (__min_max_query(parser, select, dest, param)) { + rc = 0; + goto select_end; + } + + /* + * Generate code for all sub-queries in the FROM clause + */ + for (i = 0; i < tables->nSrc; i++) { + if (tables->a[i].pSelect == 0) + continue; + if (tables->a[i].zName != 0) { + saveauth_context = parser->zAuthContext; + parser->zAuthContext = tables->a[i].zName; + need_restore_context_p = 1; + } else { + need_restore_context_p = 0; + } + __select(parser, tables->a[i].pSelect, SRT_TempTable, + tables->a[i].iCursor, select, i, &agg_p); + if (need_restore_context_p) { + parser->zAuthContext = saveauth_context; + } + tables = select->pSrc; + where = select->pWhere; + if (dest != SRT_Union && dest != SRT_Except && + dest != SRT_Discard) { + orderby_clause = select->pOrderBy; + } + groupby_clause = select->pGroupBy; + having_clause = select->pHaving; + distinct_p = select->isDistinct; + } + + /* + * Check to see if this is a subquery that can be "flattened" into + * its parent. If flattening is a possiblity, do so and return + * immediately. + */ + if (parent && parent_agg_p && + __flatten_subquery(parser, parent, parent_tab, + *parent_agg_p, agg_p)) { + if (agg_p) + *parent_agg_p = 1; + return rc; + } + + /* + * Set the limiter. + */ + __compute_limit_registers(parser, select); + + /* + * Identify column types if we will be using a callback. This + * step is skipped if the output is going to a destination other + * than a callback. + * + * We have to do this separately from the creation of column names + * above because if the tables contains views then they will not + * have been resolved and we will not know the column types until + * now. + */ + if (dest == SRT_Callback) { + __generate_column_types(parser, tables, elist); + } + + /* + * If the output is destined for a temporary table, open that table. + */ + if (dest == SRT_TempTable) { + __vdbe_add_op(v, OP_OpenTemp, param, 0); + } + + /* + * Do an analysis of aggregate expressions. + */ + __aggregate_info_reset(parser); + if (agg_p || groupby_clause) { + DBSQL_ASSERT(parser->nAgg == 0); + agg_p = 1; + for(i = 0; i < elist->nExpr; i++) { + if (__expr_analyze_aggregates(parser, + elist->a[i].pExpr)) { + goto select_end; + } + } + if (groupby_clause) { + for (i = 0; i < groupby_clause->nExpr; i++) { + if (__expr_analyze_aggregates(parser, + groupby_clause->a[i].pExpr)) { + goto select_end; + } + } + } + if (having_clause && __expr_analyze_aggregates(parser, + having_clause)) { + goto select_end; + } + if (orderby_clause) { + for (i = 0; i < orderby_clause->nExpr; i++) { + if (__expr_analyze_aggregates(parser, + orderby_clause->a[i].pExpr)) { + goto select_end; + } + } + } + } + + /* + * Reset the aggregator. + */ + if (agg_p) { + __vdbe_add_op(v, OP_AggReset, 0, parser->nAgg); + for (i = 0; i < parser->nAgg; i++) { + if ((func = parser->aAgg[i].pFunc) != 0 && + func->xFinalize != 0) { + __vdbe_add_op(v, OP_AggInit, 0, i); + __vdbe_change_p3(v, -1, (char*)func, + P3_POINTER); + } + } + if (groupby_clause == 0) { + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_add_op(v, OP_AggFocus, 0, 0); + } + } + + /* + * Initialize the memory cell to NULL. + */ + if (dest == SRT_Mem) { + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_add_op(v, OP_MemStore, param, 1); + } + + /* + * Open a temporary table to use for the distinct set. + */ + if (distinct_p) { + distinct = parser->nTab++; + __vdbe_add_op(v, OP_OpenTemp, distinct, 1); + } else { + distinct = -1; + } + + /* + * Begin the database scan. + */ + where_info = __where_begin(parser, tables, where, 0, + (groupby_clause ? 0 : &orderby_clause)); + if (where_info == 0) + goto select_end; + + /* + * Use the standard inner loop if we are not dealing with aggregates. + */ + if (!agg_p) { + if (__select_inner_loop(parser, select, elist, 0, 0, + orderby_clause, distinct, dest, + param, where_info->iContinue, + where_info->iBreak)) { + goto select_end; + } + } else { + /* + * If we are dealing with aggregates, then do the special + * aggregate processing. + */ + if (groupby_clause) { + for (i = 0; i < groupby_clause->nExpr; i++) { + __expr_code(parser, + groupby_clause->a[i].pExpr); + } + __vdbe_add_op(v, OP_MakeKey, groupby_clause->nExpr, 0); + __add_key_type(v, groupby_clause); + lbl1 = __vdbe_make_label(v); + __vdbe_add_op(v, OP_AggFocus, 0, lbl1); + for (i = 0; i < parser->nAgg; i++) { + if (parser->aAgg[i].isAgg) + continue; + __expr_code(parser, parser->aAgg[i].pExpr); + __vdbe_add_op(v, OP_AggSet, 0, i); + } + __vdbe_resolve_label(v, lbl1); + } + for (i = 0; i < parser->nAgg; i++) { + if (!parser->aAgg[i].isAgg) + continue; + e = parser->aAgg[i].pExpr; + DBSQL_ASSERT(e->op == TK_AGG_FUNCTION); + if (e->pList) { + for(j = 0; j < e->pList->nExpr; j++) { + __expr_code(parser, + e->pList->a[j].pExpr); + } + } + __vdbe_add_op(v, OP_Integer, i, 0); + __vdbe_add_op(v, OP_AggFunc, 0, + (e->pList ? e->pList->nExpr : 0)); + DBSQL_ASSERT(parser->aAgg[i].pFunc != 0); + DBSQL_ASSERT(parser->aAgg[i].pFunc->xStep != 0); + __vdbe_change_p3(v, -1, (char*)parser->aAgg[i].pFunc, + P3_POINTER); + } + } + + /* + * End the database scan loop. + */ + __where_end(where_info); + + /* + * If we are processing aggregates, we need to set up a second loop + * over all of the aggregate values and process them. + */ + if (agg_p) { + endagg = __vdbe_make_label(v); + startagg = __vdbe_add_op(v, OP_AggNext, 0, endagg); + parser->useAgg = 1; + if (having_clause) { + __expr_if_false(parser, having_clause, startagg, 1); + } + if (__select_inner_loop(parser, select, elist, 0, 0, + orderby_clause, distinct, dest, + param, startagg, endagg)) { + goto select_end; + } + __vdbe_add_op(v, OP_Goto, 0, startagg); + __vdbe_resolve_label(v, endagg); + __vdbe_add_op(v, OP_Noop, 0, 0); + parser->useAgg = 0; + } + + /* + * If there is an ORDER BY clause, then we need to sort the results + * and send them to the callback one by one. + */ + if (orderby_clause) { + __generate_sort_tail(select, v, elist->nExpr, dest, param); + } + + + /* + * Issue a null callback if that is what the user wants. + */ + if (dest == SRT_Callback && + (parser->useCallback == 0 || + (parser->db->flags & DBSQL_NullCallback) != 0)) { + __vdbe_add_op(v, OP_NullCallback, elist->nExpr, 0); + } + + /* + * The SELECT was successfully coded. Set the return code to 0 + * to indicate no errors. + */ + rc = 0; + + /* + * Control jumps to here if an error is encountered above, or upon + * successful coding of the SELECT. + */ + select_end: + __aggregate_info_reset(parser); + return rc; +} + +/* + * __select_result_set -- + * Given a SELECT statement, generate a table_t structure that describes + * the result set of that SELECT. + * + * PUBLIC: table_t *__select_result_set __P((parser_t *, char *, select_t *)); + */ +table_t * +__select_result_set(parser, tab_name, select) + parser_t *parser; + char *tab_name; + select_t *select; +{ + int i, j, n, cnt; + table_t *table; + expr_list_t *elist; + column_t *column; + expr_t *p, *pr; + char buf[30]; /* TODO, consider replacing */ + + if (__fill_in_column_list(parser, select)) { + return 0; + } + if (__dbsql_calloc(NULL, 1, sizeof(table_t), &table) == ENOMEM) { + return 0; + } + table->zName = 0; + if (tab_name) + if (__dbsql_strdup(NULL, tab_name, &table->zName) == ENOMEM) { + __dbsql_free(NULL, table); + return 0; + } + elist = select->pEList; + table->nCol = elist->nExpr; + DBSQL_ASSERT(table->nCol > 0); + __dbsql_calloc(NULL, table->nCol, sizeof(table->aCol[0]), + &table->aCol); + column = table->aCol; + for (i = 0; i < table->nCol; i++) { + if (elist->a[i].zName) { + __dbsql_strdup(NULL, elist->a[i].zName, &column[i].zName); + } else if ((p = elist->a[i].pExpr)->op == TK_DOT && + (pr = p->pRight) != 0 && + pr->token.z && pr->token.z[0]) { + __str_nappend(&column[i].zName, pr->token.z, + pr->token.n, NULL); + for (j = cnt = 0; j < i; j++) { + if (strcasecmp(column[j].zName, + column[i].zName) == 0) { + sprintf(buf, "_%d", ++cnt); + n = strlen(buf); + __str_nappend(&column[i].zName, + pr->token.z, + pr->token.n, buf, + n, NULL); + j = -1; + } + } + } else if (p->span.z && p->span.z[0]) { + __str_nappend(&table->aCol[i].zName, p->span.z, + p->span.n, NULL); + } else { + sprintf(buf, "column%d", i+1); + __dbsql_strdup(NULL, buf, &table->aCol[i].zName); + } + } + table->iPKey = -1; + return table; +} + diff --git a/src/cg_trigger.c b/src/cg_trigger.c new file mode 100644 index 0000000..4ec3474 --- /dev/null +++ b/src/cg_trigger.c @@ -0,0 +1,978 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * $Id: cg_trigger.c 7 2007-02-03 13:34:17Z gburd $ + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +/* + * __vdbe_delete_trigger_step -- + * Delete a linked list of TriggerStep structures. + * + * PUBLIC: void __vdbe_delete_trigger_step __P((trigger_step_t *)); + */ +void +__vdbe_delete_trigger_step(ts) + trigger_step_t *ts; +{ + while(ts) { + trigger_step_t * tmp = ts; + ts = ts->pNext; + + if (tmp->target.dyn) + __dbsql_free(NULL, (char *)tmp->target.z); + __expr_delete(tmp->pWhere); + __expr_list_delete(tmp->pExprList); + __select_delete(tmp->pSelect); + __id_list_delete(tmp->pIdList); + + __dbsql_free(NULL, tmp); + } +} + +/* + * __begin_trigger -- + * This is called by the parser when it sees a CREATE TRIGGER statement + * up to the point of the BEGIN before the trigger actions. A trigger_t + * structure is generated based on the information available and stored + * in parser->pNewTrigger. After the trigger actions have been parsed, + * the __finish_trigger() function is called to complete the trigger + * construction process. + * + * PUBLIC: void __begin_trigger __P((parser_t *, token_t *, int, int, + * PUBLIC: id_list_t *, src_list_t *, int, expr_t *, int)); + * + * parser The parse context of the CREATE TRIGGER + * statement + * trigger The trigger of the trigger + * tr_tm One of TK_BEFORE, TK_AFTER, TK_INSTEAD + * op One of TK_INSERT, TK_UPDATE, TK_DELETE + * columns Column list if this is an UPDATE OF trigger + * tab_name The table name of the table/view for this + * trigger + * foreach One of TK_ROW or TK_STATEMENT + * when_clause WHEN clause + * temp_p True if the TEMPORARY keyword is present + */ +void +__begin_trigger(parser, trigger, tr_tm, op, columns, tab_name, foreach, + when_clause, temp_p) + parser_t *parser; + token_t *trigger; + int tr_tm; + int op; + id_list_t *columns; + src_list_t *tab_name; + int foreach; + expr_t *when_clause; + int temp_p; +{ + trigger_t *nt; + table_t *table; + ref_normalizer_ctx_t normctx; + DBSQL *dbp = parser->db; + char *name = 0; /* Name of the trigger */ + int db_idx; /* When database to store the trigger in */ + + /* + * Check that: + * 1. The trigger name does not already exist. + * 2. The table (or view) does exist in the same database as the + * trigger. + * 3. That we are not trying to create a trigger on either the + * master or master temp tables. + * 4. That we are not trying to create an INSTEAD OF trigger on a + * table. + * 5. That we are not trying to create a BEFORE or AFTER trigger on + * a view. + */ + if (parser->rc == ENOMEM) + goto trigger_cleanup; + DBSQL_ASSERT(tab_name->nSrc == 1); + if (parser->initFlag && + __ref_normalizer_ctx_init(&normctx, parser, parser->iDb, + "trigger", trigger) && + __ref_normalize_src_list(&normctx, tab_name)) { + goto trigger_cleanup; + } + table = __src_list_lookup(parser, tab_name); + if (!table) { + goto trigger_cleanup; + } + db_idx = (temp_p ? 1 : table->iDb); + if (db_idx >= 2 && !parser->initFlag) { + __error_msg(parser, "triggers may not be added to auxiliary " + "database %s", dbp->aDb[table->iDb].zName); + goto trigger_cleanup; + } + + __dbsql_strndup(dbp, trigger->z, &name, trigger->n); + __str_unquote(name); + if( __hash_find(&(dbp->aDb[db_idx].trigHash), name,trigger->n+1) ){ + __error_msg(parser, "trigger %T already exists", trigger); + goto trigger_cleanup; + } + if (strncasecmp(table->zName, MASTER_NAME, + strlen(MASTER_NAME)) == 0) { + __error_msg(parser, "cannot create trigger on system table"); + parser->nErr++; + goto trigger_cleanup; + } + if (strncasecmp(table->zName, TEMP_MASTER_NAME, + strlen(TEMP_MASTER_NAME)) == 0) { + __error_msg(parser, "cannot create trigger on system table"); + parser->nErr++; + goto trigger_cleanup; + } + if (table->pSelect && tr_tm != TK_INSTEAD) { + __error_msg(parser, "cannot create %s trigger on view: %S", + ((tr_tm == TK_BEFORE) ? "BEFORE" : "AFTER"), + tab_name, 0); + goto trigger_cleanup; + } + if (!table->pSelect && tr_tm == TK_INSTEAD) { + __error_msg(parser, "cannot create INSTEAD OF" + " trigger on table: %S", tab_name, 0); + goto trigger_cleanup; + } +#ifndef DBSQL_NO_AUTH + { + int code = DBSQL_CREATE_TRIGGER; + const char *db = dbp->aDb[table->iDb].zName; + const char *db_trig = temp_p ? dbp->aDb[1].zName : db; + if (table->iDb == 1 || temp_p) + code = DBSQL_CREATE_TEMP_TRIGGER; + if (__auth_check(parser, code, name, table->zName, db_trig)) { + goto trigger_cleanup; + } + if (__auth_check(parser, DBSQL_INSERT, + SCHEMA_TABLE(table->iDb), 0, db)) { + goto trigger_cleanup; + } + } +#endif + + /* + * INSTEAD OF triggers can only appear on views and BEGIN triggers + * cannot appear on views. So we might as well translate every + * INSTEAD OF trigger into a BEFORE trigger. It simplifies code + * elsewhere. + */ + if (tr_tm == TK_INSTEAD) { + tr_tm = TK_BEFORE; + } + + /* + * Build the Trigger object. + */ + __dbsql_calloc(dbp, 1, sizeof(trigger_t), &nt); + if (nt == 0) + goto trigger_cleanup; + nt->name = name; + name = 0; + if (__dbsql_strdup(dbp, tab_name->a[0].zName, &nt->table) == ENOMEM) + goto trigger_cleanup; + nt->iDb = db_idx; + nt->iTabDb = table->iDb; + nt->op = op; + nt->tr_tm = tr_tm; + nt->pWhen = __expr_dup(when_clause); + nt->pColumns = __id_list_dup(columns); + nt->foreach = foreach; + __token_copy(&nt->nameToken,trigger); + DBSQL_ASSERT( parser->pNewTrigger==0 ); + parser->pNewTrigger = nt; + + trigger_cleanup: + __dbsql_free(dbp, name); + __src_list_delete(tab_name); + __id_list_delete(columns); + __expr_delete(when_clause); +} + +/* + * __finish_trigger -- + * This routine is called after all of the trigger actions have been + * parsed in order to complete the process of building the trigger. + * + * PUBLIC: void __finish_trigger __P((parser_t *, trigger_step_t *, + * PUBLIC: token_t *)); + * + * parser The parse context of the CREATE TRIGGER + * statement + * steplist The triggered program + * all Token that describes the complete + * CREATE TRIGGER + */ +void +__finish_trigger(parser, steplist, all) + parser_t *parser; + trigger_step_t *steplist; + token_t *all; +{ + ref_normalizer_ctx_t normctx; + trigger_t *nt = 0; /* The trigger whose construction is finishing up */ + DBSQL *dbp = parser->db; + + if (parser->nErr || parser->pNewTrigger == 0) + goto triggerfinish_cleanup; + nt = parser->pNewTrigger; + parser->pNewTrigger = 0; + nt->step_list = steplist; + while(steplist) { + steplist->pTrig = nt; + steplist = steplist->pNext; + } + if (__ref_normalizer_ctx_init(&normctx, parser, nt->iDb, + "trigger", &nt->nameToken) && + __ref_normalize_trigger_step(&normctx, nt->step_list)) { + goto triggerfinish_cleanup; + } + + /* + * if we are not initializing, and this trigger is not on a TEMP + * table, build the master entry. + */ + if (!parser->initFlag) { + static vdbe_op_t insert_trig[] = { + { OP_NewRecno, 0, 0, 0 }, + { OP_String, 0, 0, "trigger" }, + { OP_String, 0, 0, 0 }, /* 2: trigger name */ + { OP_String, 0, 0, 0 }, /* 3: table name */ + { OP_Integer, 0, 0, 0 }, + { OP_String, 0, 0, 0 }, /* 5: SQL */ + { OP_MakeRecord, 5, 0, 0 }, + { OP_PutIntKey, 0, 0, 0 }, + }; + int addr; + vdbe_t *v; + + /* + * Make an entry in the master table. + */ + v = __parser_get_vdbe(parser); + if (v == 0) + goto triggerfinish_cleanup; + __vdbe_prepare_write(parser, 0, 0); + __open_master_table(v, nt->iDb); + addr = __vdbe_add_op_list(v, ARRAY_SIZE(insert_trig), + insert_trig); + __vdbe_change_p3(v, (addr + 2), nt->name, 0); + __vdbe_change_p3(v, (addr + 3), nt->table, 0); + __vdbe_change_p3(v, (addr + 5), all->z, all->n); + if (nt->iDb == 0) { + __change_schema_signature(dbp, v); + } + __vdbe_add_op(v, OP_Close, 0, 0); + __vdbe_conclude_write(parser); + } + + if (!parser->explain) { + table_t *table; + __hash_insert(&dbp->aDb[nt->iDb].trigHash, + nt->name, (strlen(nt->name) + 1), nt); + table = __locate_table(parser, nt->table, + dbp->aDb[nt->iTabDb].zName); + DBSQL_ASSERT(table != 0); + nt->pNext = table->pTrigger; + table->pTrigger = nt; + nt = 0; + } + + triggerfinish_cleanup: + __vdbe_delete_trigger(nt); + __vdbe_delete_trigger(parser->pNewTrigger); + parser->pNewTrigger = 0; + __vdbe_delete_trigger_step(steplist); +} + +/* + * __persist_trigger_step -- + * Make a copy of all components of the given trigger step. This has + * the effect of copying all expr_t.token.z values into memory obtained + * from __dbsql_calloc(). As initially created, the expr_t.token.z values + * all point to the input string that was fed to the parser. But that + * string is ephemeral - it will go away as soon as the dbsql_exec() + * call that started the parser exits. This routine makes a persistent + * copy of all the Expr.token.z strings so that the trigger_step_t + * structure will be valid even after the dbsql_exec() call returns. + * + * STATIC: static void __persist_trigger_step __P((trigger_step_t *)); + */ +static void +__persist_trigger_step(ts) + trigger_step_t *ts; +{ + if (ts->target.z) { + __dbsql_strndup(NULL, ts->target.z, &ts->target.z, ts->target.n); + ts->target.dyn = 1; + } + if (ts->pSelect) { + select_t *new = __select_dup(ts->pSelect); + __select_delete(ts->pSelect); + ts->pSelect = new; + } + if( ts->pWhere ){ + expr_t *new = __expr_dup(ts->pWhere); + __expr_delete(ts->pWhere); + ts->pWhere = new; + } + if (ts->pExprList) { + expr_list_t *new = __expr_list_dup(ts->pExprList); + __expr_list_delete(ts->pExprList); + ts->pExprList = new; + } + if (ts->pIdList) { + id_list_t *new = __id_list_dup(ts->pIdList); + __id_list_delete(ts->pIdList); + ts->pIdList = new; + } +} + +/* + * __trigger_select_step -- + * Turn a SELECT statement (that the 'select' parameter points to) into + * a trigger step. Return a pointer to a trigger_step_t structure. + * + * The parser calls this routine when it finds a SELECT statement in + * body of a TRIGGER. + * + * PUBLIC: trigger_step_t * __trigger_select_step __P((select_t *)); + */ +trigger_step_t * +__trigger_select_step(select) + select_t *select; +{ + trigger_step_t *ts; + + if (__dbsql_calloc(NULL, 1, sizeof(trigger_step_t), &ts) == ENOMEM) + return 0; + + ts->op = TK_SELECT; + ts->pSelect = select; + ts->orconf = OE_Default; + __persist_trigger_step(ts); + + return ts; +} + +/* + * __trigger_insert_step -- + * Build a trigger step out of an INSERT statement. Return a pointer + * to the new trigger step. + * + * The parser calls this routine when it sees an INSERT inside the + * body of a trigger. + * + * PUBLIC: trigger_step_t *__trigger_insert_step __P((token_t *, id_list_t *, + * PUBLIC: expr_list_t *, select_t *, int)); + * + * tab_name Name of the table into which we insert + * column List of columns in tab_name to insert into + * elist The VALUE clause: a list of values to be + * inserted + * select A SELECT statement that supplies values + * orconf The conflict algorithm (OE_Abort, OE_Replace, + * etc.) + */ +trigger_step_t * +__trigger_insert_step(tab_name, column, elist, select, orconf) + token_t *tab_name; + id_list_t *column; + expr_list_t *elist; + select_t *select; + int orconf; +{ + trigger_step_t *ts; + + if (__dbsql_calloc(NULL, 1, sizeof(trigger_step_t), &ts) == ENOMEM) + return 0; + + DBSQL_ASSERT(elist == 0 || select == 0); + DBSQL_ASSERT(elist != 0 || select != 0); + + ts->op = TK_INSERT; + ts->pSelect = select; + ts->target = *tab_name; + ts->pIdList = column; + ts->pExprList = elist; + ts->orconf = orconf; + __persist_trigger_step(ts); + + return ts; +} + +/* + * __trigger_update_step -- + * Construct a trigger step that implements an UPDATE statement and return + * a pointer to that trigger step. The parser calls this routine when it + * sees an UPDATE statement inside the body of a CREATE TRIGGER. + * + * PUBLIC: trigger_step_t *__trigger_update_step __P((token_t *, expr_list_t *, + * PUBLIC: expr_t *, int)); + * + * tab_name Name of the table to be updated + * elist The SET clause: list of column and new values + * where_clause The WHERE clause + * orconf The conflict algorithm. (OE_Abort, OE_Ignore, + * etc) + */ +trigger_step_t * +__trigger_update_step(tab_name, elist, where_clause, orconf) + token_t *tab_name; + expr_list_t *elist; + expr_t *where_clause; + int orconf; +{ + trigger_step_t *ts; + + if (__dbsql_calloc(NULL, 1, sizeof(trigger_step_t), &ts) == ENOMEM) + return 0; + + ts->op = TK_UPDATE; + ts->target = *tab_name; + ts->pExprList = elist; + ts->pWhere = where_clause; + ts->orconf = orconf; + __persist_trigger_step(ts); + + return ts; +} + +/* + * __trigger_delete_step -- + * Construct a trigger step that implements a DELETE statement and return + * a pointer to that trigger step. The parser calls this routine when it + * sees a DELETE statement inside the body of a CREATE TRIGGER. + * + * PUBLIC: trigger_step_t *__trigger_delete_step __P((token_t *, expr_t *)); + */ +trigger_step_t * +__trigger_delete_step(tab_name, where_clause) + token_t *tab_name; + expr_t *where_clause; +{ + trigger_step_t *ts; + + if (__dbsql_calloc(NULL, 1, sizeof(trigger_step_t), &ts) == ENOMEM) + return 0; + + ts->op = TK_DELETE; + ts->target = *tab_name; + ts->pWhere = where_clause; + ts->orconf = OE_Default; + __persist_trigger_step(ts); + + return ts; +} + +/* + * __vdbe_delete_trigger -- + * Recursively delete a trigger_t structure + * + * PUBLIC: void __vdbe_delete_trigger __P((trigger_t *)); + */ +void +__vdbe_delete_trigger(trigger) + trigger_t *trigger; +{ + if (trigger == 0) + return; + __vdbe_delete_trigger_step(trigger->step_list); + __dbsql_free(NULL, trigger->name); + __dbsql_free(NULL, trigger->table); + __expr_delete(trigger->pWhen); + __id_list_delete(trigger->pColumns); + if (trigger->nameToken.dyn) + __dbsql_free(NULL, (char*)trigger->nameToken.z); + __dbsql_free(NULL, trigger); +} + +/* + * __drop_trigger -- + * This function is called to drop a trigger from the database schema. + * + * This may be called directly from the parser and therefore identifies + * the trigger by name. The __drop_trigger_ptr() routine does the + * same job as this routine except it take a spointer to the trigger + * instead of the trigger name. + * + * Note that this function does not delete the trigger entirely. Instead + * it removes it from the internal schema and places it in the trigDrop + * hash table. This is so that the trigger can be restored into the + * database schema if the transaction is rolled back. + * + * PUBLIC: void __drop_trigger __P((parser_t *, src_list_t *)); + */ +void +__drop_trigger(parser, trig_list) + parser_t *parser; + src_list_t *trig_list; +{ + int i; + trigger_t *trigger; + const char *db_name; + const char *trig_name; + int name_len; + DBSQL *dbp = parser->db; + + if (parser->rc == ENOMEM) + goto err; + DBSQL_ASSERT(trig_list->nSrc == 1); + db_name = trig_list->a[0].zDatabase; + trig_name = trig_list->a[0].zName; + name_len = strlen(trig_name); + for (i = 0; i < dbp->nDb; i++) { + int j = (i < 2) ? (i ^ 1) : i; /* Search TEMP before MAIN. */ + if (db_name && + strcasecmp(dbp->aDb[j].zName, db_name)) + continue; + trigger = __hash_find(&(dbp->aDb[j].trigHash), trig_name, + (name_len + 1)); + if (trigger) + break; + } + if (!trigger) { + __error_msg(parser, "no such trigger: %S", trig_list, 0); + goto err; + } + __drop_trigger_ptr(parser, trigger, 0); + + err: + __src_list_delete(trig_list); +} + +/* + * __drop_trigger_ptr -- + * Drop a trigger given a pointer to that trigger. If nested is false, + * then also generate code to remove the trigger from the DBSQL_MASTER + * table. + * + * PUBLIC: void __drop_trigger_ptr __P((parser_t *, trigger_t *, int)); + */ +void +__drop_trigger_ptr(parser, trigger, nested) + parser_t *parser; + trigger_t *trigger; + int nested; +{ + table_t *table; + vdbe_t *v; + DBSQL *dbp = parser->db; + + DBSQL_ASSERT(trigger->iDb < dbp->nDb); + if (trigger->iDb >= 2) { + __error_msg(parser, "triggers may not be removed from " + "auxiliary database %s", + dbp->aDb[trigger->iDb].zName); + return; + } + table = __find_table(dbp, trigger->table, + dbp->aDb[trigger->iTabDb].zName); + DBSQL_ASSERT(table); + DBSQL_ASSERT(table->iDb == trigger->iDb || trigger->iDb == 1); +#ifndef DBSQL_NO_AUTH + { + int code = DBSQL_DROP_TRIGGER; + const char *db = dbp->aDb[trigger->iDb].zName; + const char *tab = SCHEMA_TABLE(trigger->iDb); + if (trigger->iDb) + code = DBSQL_DROP_TEMP_TRIGGER; + if (__auth_check(parser, code, trigger->name, + table->zName, db) || + __auth_check(parser, DBSQL_DELETE, tab, 0, db)) { + return; + } + } +#endif + + /* + * Generate code to destroy the database record of the trigger. + */ + if (table != 0 && !nested && (v = __parser_get_vdbe(parser)) != 0) { + int base; + static vdbe_op_t drop_trigger[] = { + { OP_Rewind, 0, ADDR(9), 0}, + { OP_String, 0, 0, 0}, /* 1 */ + { OP_Column, 0, 1, 0}, + { OP_Ne, 0, ADDR(8), 0}, + { OP_String, 0, 0, "trigger"}, + { OP_Column, 0, 0, 0}, + { OP_Ne, 0, ADDR(8), 0}, + { OP_Delete, 0, 0, 0}, + { OP_Next, 0, ADDR(1), 0}, /* 8 */ + }; + + __vdbe_prepare_write(parser, 0, 0); + __open_master_table(v, trigger->iDb); + base = __vdbe_add_op_list(v, ARRAY_SIZE(drop_trigger), + drop_trigger); + __vdbe_change_p3(v, base+1, trigger->name, 0); + if (trigger->iDb == 0) { + __change_schema_signature(dbp, v); + } + __vdbe_add_op(v, OP_Close, 0, 0); + __vdbe_conclude_write(parser); + } + + /* + * If this is not an "explain", then delete the trigger structure. + */ + if (!parser->explain) { + const char *name = trigger->name; + int len = strlen(name); + if (table->pTrigger == trigger) { + table->pTrigger = trigger->pNext; + } else { + trigger_t *cc = table->pTrigger; + while(cc) { + if (cc->pNext == trigger) { + cc->pNext = cc->pNext->pNext; + break; + } + cc = cc->pNext; + } + DBSQL_ASSERT(cc); + } + __hash_insert(&(dbp->aDb[trigger->iDb].trigHash), name, + (len + 1), 0); + __vdbe_delete_trigger(trigger); + } +} + +/* + * __check_column_overlap -- + * 'elist' is the SET clause of an UPDATE statement. Each entry + * in 'elist' is of the format =. If any of the entries + * in 'elist' have an which matches an identifier in 'id_list', + * then return TRUE. If 'id_list'==NULL, then it is considered a + * wildcard that matches anything. Likewise if elist==NULL then + * it matches anything so always return true. Return false only + * if there is no match. + * + * STATIC: static int __check_column_overlap __P((id_list_t *, expr_list_t *)); + */ +static int +__check_column_overlap(id_list, elist) + id_list_t *id_list; + expr_list_t *elist; +{ + int e; + if (!id_list || !elist) + return 1; + for (e = 0; e < elist->nExpr; e++) { + if (__id_list_index(id_list, elist->a[e].zName) >= 0) + return 1; + } + return 0; +} + +/* + * A global variable that is TRUE if we should always set up temp tables for + * for triggers, even if there are no triggers to code. This is used to test + * how much overhead the triggers algorithm is causing. + * + * This flag can be set or cleared using the "trigger_overhead_test" pragma. + * The pragma is not documented since it is not really part of the public + * interface, just the test procedure. + */ +int always_code_trigger_setup = 0; /* TODO, remove this global, place it + in the environment. */ + +/* + * __triggers_exist -- + * Returns true if a trigger matching op, tr_tm and foreach that is NOT + * already on the parser_t objects trigger-stack (to prevent recursive + * trigger firing) is found in the list specified as trigger. + * + * PUBLIC: int __triggers_exist __P((parser_t *, trigger_t *, int, int, int, + * PUBLIC: expr_list_t *)); + * + * parser Used to check for recursive triggers + * trigger A list of triggers associated with a table + * op One of TK_DELETE, TK_INSERT, TK_UPDATE + * tr_tm One of TK_BEFORE, TK_AFTER + * foreach One of TK_ROW or TK_STATEMENT + * changes Columns that change in an UPDATE statement + */ +int __triggers_exist(parser, trigger, op, tr_tm, foreach, changes) + parser_t *parser; + trigger_t *trigger; + int op; + int tr_tm; + int foreach; + expr_list_t *changes; +{ + trigger_t * trig_cursor; + + if (always_code_trigger_setup) { + return 1; + } + trig_cursor = trigger; + while (trig_cursor) { + if (trig_cursor->op == op && + trig_cursor->tr_tm == tr_tm && + trig_cursor->foreach == foreach && + __check_column_overlap(trig_cursor->pColumns, changes)) { + trigger_stack_t *ss; + ss = parser->trigStack; + while (ss && ss->pTrigger != trigger) { + ss = ss->pNext; + } + if (!ss) + return 1; + } + trig_cursor = trig_cursor->pNext; + } + return 0; +} + +/* + * __target_src_list -- + * Convert the pStep->target token into a src_list_t and return a pointer + * to that src_list_t. + * + * This routine adds a specific database name, if needed, to the target + * when forming the src_list_t. This prevents a trigger in one database + * from referring to a target in another database. An exception is when + * the trigger is in TEMP in which case it can refer to any other database + * it wants. + * + * STATIC: static src_list_t *__target_src_list __P((parser_t *, + * STATIC: trigger_step_t *)); + * + * parser The parsing context + * step The trigger containing the target token + */ +static src_list_t *targetSrcList(parser, step) + parser_t *parser; + trigger_step_t *step; +{ + token_t db; /* Dummy database name token */ + int db_idx; /* Index of the database to use */ + src_list_t *src; /* SrcList to be returned */ + + db_idx = step->pTrig->iDb; + if (db_idx == 0 || db_idx >= 2) { + DBSQL_ASSERT(db_idx < parser->db->nDb); + db.z = parser->db->aDb[db_idx].zName; + db.n = strlen(db.z); + src = __src_list_append(0, &db, &step->target); + } else { + src = __src_list_append(0, &step->target, 0); + } + return src; +} + +/* + * __code_trigger_prigram -- + * Generate VDBE code for zero or more statements inside the body of a + * trigger. + * + * STATIC: static int __code_trigger_prigram __P(()); + * + * parser The parser context + * steplist List of statements inside the trigger body + * orconfin Conflict algorithm. (OE_Abort, etc) + */ +static int +__code_trigger_program(parser, steplist, orconfin) + parser_t *parser; + trigger_step_t *steplist; + int orconfin; +{ + int orconf; + trigger_step_t * ts = steplist; + + while (ts) { + int saveNTab = parser->nTab; + orconf = (orconfin == OE_Default)?ts->orconf:orconfin; + parser->trigStack->orconf = orconf; + switch(ts->op) { + case TK_SELECT: { + select_t * ss = __select_dup(ts->pSelect); + DBSQL_ASSERT(ss); + DBSQL_ASSERT(ss->pSrc); + __select(parser, ss, SRT_Discard, 0, 0, 0, 0); + __select_delete(ss); + break; + } + case TK_UPDATE: { + src_list_t *src; + src = targetSrcList(parser, ts); + __vdbe_add_op(parser->pVdbe, OP_ListPush, 0, 0); + __update(parser, src, + __expr_list_dup(ts->pExprList), + __expr_dup(ts->pWhere), orconf); + __vdbe_add_op(parser->pVdbe, OP_ListPop, 0, 0); + break; + } + case TK_INSERT: { + src_list_t *src; + src = targetSrcList(parser, ts); + __insert(parser, src, + __expr_list_dup(ts->pExprList), + __select_dup(ts->pSelect), + __id_list_dup(ts->pIdList), orconf); + break; + } + case TK_DELETE: { + src_list_t *src; + __vdbe_add_op(parser->pVdbe, OP_ListPush, 0, 0); + src = targetSrcList(parser, ts); + __delete_from(parser, src, __expr_dup(ts->pWhere)); + __vdbe_add_op(parser->pVdbe, OP_ListPop, 0, 0); + break; + } + default: + DBSQL_ASSERT(0); + } + parser->nTab = saveNTab; + ts = ts->pNext; + } + return 0; +} + +/* + * __code_row_trigger -- + * This is called to code FOR EACH ROW triggers. + * + * When the code that this function generates is executed, the following + * must be true: + * + * 1. No cursors may be open in the main database. (But newIdx and oldIdx + * can be indices of cursors in temporary tables. See below.) + * + * 2. If the triggers being coded are ON INSERT or ON UPDATE triggers, + * then a temporary vdbe cursor (index newIdx) must be open and + * pointing at a row containing values to be substituted for new.* + * expressions in the trigger program(s). + * + * 3. If the triggers being coded are ON DELETE or ON UPDATE triggers, + * then a temporary vdbe cursor (index oldIdx) must be open and + * pointing at a row containing values to be substituted for old.* + * expressions in the trigger program(s). + * + * PUBlIC: int __code_row_trigger __P(()); + * + * parser Parser context + * op One of TK_UPDATE, TK_INSERT, TK_DELETE + * changes Changes list for any UPDATE OF triggers + * tr_tm One of TK_BEFORE, TK_AFTER + * table The table to code triggers from + * new_idx The indice of the "new" row to access + * old_idx The indice of the "old" row to access + * orconf ON CONFLICT policy + * ignore_jump Instruction to jump to for RAISE(IGNORE) + */ +int __code_row_trigger(parser, op, changes, tr_tm, table, new_idx, old_idx, + orconf, ignore_jump) + parser_t *parser; + int op; + expr_list_t *changes; + int tr_tm; + table_t *table; + int new_idx; + int old_idx; + int orconf; + int ignore_jump; +{ + trigger_t * trigger; + trigger_stack_t * trig_stack; + DBSQL *dbp = parser->db; + + DBSQL_ASSERT(op == TK_UPDATE || op == TK_INSERT || op == TK_DELETE); + DBSQL_ASSERT(tr_tm == TK_BEFORE || tr_tm == TK_AFTER ); + + DBSQL_ASSERT(new_idx != -1 || old_idx != -1); + + trigger = table->pTrigger; + while(trigger) { + int fire_this = 0; + + /* + * Determine whether we should code this trigger. + */ + if (trigger->op == op && trigger->tr_tm == tr_tm && + trigger->foreach == TK_ROW) { + fire_this = 1; + trig_stack = parser->trigStack; + while(trig_stack) { + if (trig_stack->pTrigger == trigger) { + fire_this = 0; + } + trig_stack = trig_stack->pNext; + } + if (op == TK_UPDATE && trigger->pColumns && + !__check_column_overlap(trigger->pColumns, + changes)) { + fire_this = 0; + } + } + + if (fire_this && __dbsql_calloc(dbp, 1,sizeof(trigger_stack_t), + &trig_stack) != ENOMEM) { + int end_trigger; + src_list_t dummy_tab_list; + expr_t * when_expr; + auth_context_t authctx; + + dummy_tab_list.nSrc = 0; + + /* + * Push an entry on to the trigger stack. + */ + trig_stack->pTrigger = trigger; + trig_stack->newIdx = new_idx; + trig_stack->oldIdx = old_idx; + trig_stack->pTab = table; + trig_stack->pNext = parser->trigStack; + trig_stack->ignoreJump = ignore_jump; + parser->trigStack = trig_stack; + __auth_context_push(parser, &authctx, trigger->name); + + /* + * Code the WHEN clause. + */ + end_trigger = __vdbe_make_label(parser->pVdbe); + when_expr = __expr_dup(trigger->pWhen); + if (__expr_resolve_ids(parser, &dummy_tab_list, 0, + when_expr)) { + parser->trigStack = parser->trigStack->pNext; + __dbsql_free(dbp, trig_stack); + __expr_delete(when_expr); + return 1; + } + __expr_if_false(parser, when_expr, end_trigger, 1); + __expr_delete(when_expr); + + __code_trigger_program(parser, trigger->step_list, + orconf); + + /* + * Pop the entry off the trigger stack. + */ + parser->trigStack = parser->trigStack->pNext; + __auth_context_pop(&authctx); + __dbsql_free(dbp, trig_stack); + + __vdbe_resolve_label(parser->pVdbe, end_trigger); + } + trigger = trigger->pNext; + } + return 0; +} diff --git a/src/cg_update.c b/src/cg_update.c new file mode 100644 index 0000000..f50642d --- /dev/null +++ b/src/cg_update.c @@ -0,0 +1,531 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_update.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains routines that handle UPDATE statements. + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +/* + * __update -- + * Process an UPDATE statement. + * + * UPDATE OR IGNORE table_wxyz SET a=b, c=d WHERE e<5 AND f NOT NULL; + * \_______/ \________/ \______/ \________________/ + * on_error tab_list changes where + * + * PUBLIC: void __update __P((parser_t *, src_list_t *, expr_list_t *, + * PUBLIC: expr_t *, int)); + * + * parser The parser context + * tab_list The table in which we should change things + * changes Things to be changed + * where The WHERE clause. May be null + * on_error How to handle constraint errors + */ +void __update(parser, tab_list, changes, where, on_error) + parser_t *parser; + src_list_t *tab_list; + expr_list_t *changes; + expr_t *where; + int on_error; +{ + int rc; + int i, j; /* Loop counters */ + table_t *table; /* The table to be updated */ + int addr; /* VDBE instruction address of the start of + the loop */ + where_info_t *winfo; /* Information about the WHERE clause */ + vdbe_t *v; /* The virtual database engine */ + index_t *idx; /* For looping over indices */ + int num_idx; /* Number of indices that need updating */ + int total_num_idx; /* Total number of indices */ + int cur; /* VDBE Cursor number of table */ + DBSQL *dbp; /* The database structure */ + index_t **indices = 0;/* An array of indices that need updating too */ + char *idx_used = 0; /* idx_used[i]==1 if the i-th index is used */ + int *xref = 0; /* xref[i] is the index in changes->a[] of the + an expression for the i-th column of the + table. xref[i]==-1 if the i-th column is not + changed. */ + int recno_will_change_p;/* True if the record number is being changed*/ + expr_t *recno; /* Expression defining the new record number */ + int open_all_p; /* True if all indices need to be opened */ + int is_view_p; /* Trying to update a view */ + auth_context_t auth; /* The authorization context */ + + int before_triggers; /* True if there are any BEFORE triggers */ + int after_triggers; /* True if there are any AFTER triggers */ + int row_triggers_exist = 0;/* True if any row triggers exist */ + + int new_idx = -1;/* index of trigger "new" temp table */ + int old_idx = -1;/* index of trigger "old" temp table */ + select_t *view; + + auth.pParse = 0; + if (parser->nErr || parser->rc == ENOMEM) + goto update_cleanup; + dbp = parser->db; + DBSQL_ASSERT(tab_list->nSrc == 1); + + /* + * Locate the table which we want to update. + */ + table = __src_list_lookup(parser, tab_list); + if (table == 0) + goto update_cleanup; + before_triggers = __triggers_exist(parser, table->pTrigger, + TK_UPDATE, TK_BEFORE, TK_ROW, + changes); + after_triggers = __triggers_exist(parser, table->pTrigger, + TK_UPDATE, TK_AFTER, TK_ROW, + changes); + row_triggers_exist = before_triggers || after_triggers; + is_view_p = (table->pSelect != 0); + if (__is_table_read_only(parser, table, before_triggers)) { + goto update_cleanup; + } + if (is_view_p) { + if (__view_get_column_names(parser, table)) { + goto update_cleanup; + } + } + if (__dbsql_calloc(dbp, table->nCol, sizeof(int), &xref) == ENOMEM) + goto update_cleanup; + for (i = 0; i < table->nCol; i++) { + xref[i] = -1; + } + + /* + * If there are FOR EACH ROW triggers, allocate cursors for the + * special OLD and NEW tables. + */ + if (row_triggers_exist) { + new_idx = parser->nTab++; + old_idx = parser->nTab++; + } + + /* + * Allocate a cursors for the main database table and for all indices. + * The index cursors might not be used, but if they are used they + * need to occur right after the database cursor. So go ahead and + * allocate enough space, just in case. + */ + tab_list->a[0].iCursor = cur = parser->nTab++; + for (idx = table->pIndex; idx; idx = idx->pNext) { + parser->nTab++; + } + + /* + * Resolve the column names in all the expressions of the + * of the UPDATE statement. Also find the column index + * for each column to be updated in the changes array. For each + * column to be updated, make sure we have authorization to change + * that column. + */ + recno_will_change_p = 0; + for (i = 0; i < changes->nExpr; i++) { + if (__expr_resolve_ids(parser, tab_list, 0, + changes->a[i].pExpr)) { + goto update_cleanup; + } + if (__expr_check(parser, changes->a[i].pExpr, 0, 0)) { + goto update_cleanup; + } + for (j = 0; j < table->nCol; j++) { + if (strcasecmp(table->aCol[j].zName, + changes->a[i].zName) == 0) { + if (j == table->iPKey) { + recno_will_change_p = 1; + recno = changes->a[i].pExpr; + } + xref[j] = i; + break; + } + } + if (j >= table->nCol) { + if (__is_row_id(changes->a[i].zName)) { + recno_will_change_p = 1; + recno = changes->a[i].pExpr; + } else { + __error_msg(parser, "no such column: %s", + changes->a[i].zName); + goto update_cleanup; + } + } +#ifndef DBSQL_NO_AUTH + rc = __auth_check(parser, DBSQL_UPDATE, table->zName, + table->aCol[j].zName, + dbp->aDb[table->iDb].zName); + if (rc == DBSQL_DENY) { + goto update_cleanup; + } else if (rc == DBSQL_IGNORE) { + xref[j] = -1; + } +#endif + } + + /* + * Allocate memory for the array indices[] and fill it with pointers + * to every index that needs to be updated. Indices only need + * updating if their key includes one of the columns named in changes + * or if the record number of the original table entry is changing. + */ + for (num_idx = total_num_idx = 0, idx = table->pIndex; + idx; idx = idx->pNext, total_num_idx++) { + if (recno_will_change_p) { + i = 0; + } else { + for (i = 0; i < idx->nColumn; i++) { + if (xref[idx->aiColumn[i]] >= 0) + break; + } + } + if (i < idx->nColumn) + num_idx++; + } + if (total_num_idx > 0) { /* TODO, is this the right amt to alloc? */ + if (__dbsql_calloc(dbp, num_idx + total_num_idx, + sizeof(index_t *), &indices) == ENOMEM) + goto update_cleanup; + idx_used = (char*)&indices[num_idx]; + } + for (num_idx = j = 0, idx = table->pIndex; idx; idx = idx->pNext, j++){ + if (recno_will_change_p) { + i = 0; + } else { + for (i = 0; i < idx->nColumn; i++) { + if (xref[idx->aiColumn[i]] >= 0) + break; + } + } + if (i < idx->nColumn) { + indices[num_idx++] = idx; + idx_used[j] = 1; + } else { + idx_used[j] = 0; + } + } + + /* + * Resolve the column names in all the expressions in the + * WHERE clause. + */ + if (where) { + if (__expr_resolve_ids(parser, tab_list, 0, where)) { + goto update_cleanup; + } + if (__expr_check(parser, where, 0, 0)) { + goto update_cleanup; + } + } + + /* + * Start the view context. + */ + if (is_view_p) { + __auth_context_push(parser, &auth, table->zName); + } + + /* + * Begin generating code. + */ + v = __parser_get_vdbe(parser); + if (v == 0) + goto update_cleanup; + __vdbe_prepare_write(parser, 1, table->iDb); + + /* + * If we are trying to update a view, construct that view into + * a temporary table. + */ + if (is_view_p) { + view = __select_dup(table->pSelect); + __select(parser, view, SRT_TempTable, cur, 0, 0, 0); + __select_delete(view); + } + + /* + * Begin the database scan. + */ + winfo = __where_begin(parser, tab_list, where, 1, 0); + if (winfo == 0) + goto update_cleanup; + + /* + * Remember the index of every item to be updated. + */ + __vdbe_add_op(v, OP_ListWrite, 0, 0); + + /* + * End the database scan loop. + */ + __where_end(winfo); + + /* + * Initialize the count of updated rows. + */ + if (dbp->flags & DBSQL_CountRows && !parser->trigStack) { + __vdbe_add_op(v, OP_Integer, 0, 0); + } + + if (row_triggers_exist) { + /* + * Create pseudo-tables for NEW and OLD + */ + __vdbe_add_op(v, OP_OpenPseudo, old_idx, 0); + __vdbe_add_op(v, OP_OpenPseudo, new_idx, 0); + + /* + * The top of the update loop for when there are triggers. + */ + __vdbe_add_op(v, OP_ListRewind, 0, 0); + addr = __vdbe_add_op(v, OP_ListRead, 0, 0); + __vdbe_add_op(v, OP_Dup, 0, 0); + + /* + * Open a cursor and make it point to the record that is + * being updated. + */ + __vdbe_add_op(v, OP_Dup, 0, 0); + if(!is_view_p) { + __vdbe_add_op(v, OP_Integer, table->iDb, 0); + __vdbe_add_op(v, OP_OpenRead, cur, table->tnum); + } + __vdbe_add_op(v, OP_MoveTo, cur, 0); + + /* + * Generate the OLD table. + */ + __vdbe_add_op(v, OP_Recno, cur, 0); + __vdbe_add_op(v, OP_RowData, cur, 0); + __vdbe_add_op(v, OP_PutIntKey, old_idx, 0); + + /* + * Generate the NEW table. + */ + if (recno_will_change_p) { + __expr_code(parser, recno); + } else { + __vdbe_add_op(v, OP_Recno, cur, 0); + } + for(i = 0; i < table->nCol; i++) { + if (i == table->iPKey) { + __vdbe_add_op(v, OP_String, 0, 0); + continue; + } + j = xref[i]; + if (j < 0) { + __vdbe_add_op(v, OP_Column, cur, i); + }else{ + __expr_code(parser, changes->a[j].pExpr); + } + } + __vdbe_add_op(v, OP_MakeRecord, table->nCol, 0); + __vdbe_add_op(v, OP_PutIntKey, new_idx, 0); + if (!is_view_p) { + __vdbe_add_op(v, OP_Close, cur, 0); + } + + /* + * Fire the BEFORE and INSTEAD OF triggers. + */ + if (__code_row_trigger(parser, TK_UPDATE, changes, + TK_BEFORE, table, new_idx, old_idx, + on_error, addr)) { + goto update_cleanup; + } + } + + if (!is_view_p) { + /* + * Open every index that needs updating. Note that if any + * index could potentially invoke a REPLACE conflict resolution + * action, then we need to open all indices because we might + * need to be deleting some records. + */ + __vdbe_add_op(v, OP_Integer, table->iDb, 0); + __vdbe_add_op(v, OP_OpenWrite, cur, table->tnum); + if (on_error == OE_Replace) { + open_all_p = 1; + } else { + open_all_p = 0; + for (idx = table->pIndex; idx; idx = idx->pNext) { + if (idx->onError == OE_Replace) { + open_all_p = 1; + break; + } + } + } + for(i = 0, idx = table->pIndex; idx; idx = idx->pNext, i++) { + if (open_all_p || idx_used[i]) { + __vdbe_add_op(v, OP_Integer, idx->iDb, 0); + __vdbe_add_op(v, OP_OpenWrite, (cur + i + 1), + idx->tnum); + DBSQL_ASSERT(parser->nTab > (cur + i + 1)); + } + } + + /* + * Loop over every record that needs updating. We have to load + * the old data for each record to be updated because some + * columns might not change and we will need to copy the old + * value. Also, the old data is needed to delete the old index + * entires. So make the cursor point at the old record. + */ + if (!row_triggers_exist) { + __vdbe_add_op(v, OP_ListRewind, 0, 0); + addr = __vdbe_add_op(v, OP_ListRead, 0, 0); + __vdbe_add_op(v, OP_Dup, 0, 0); + } + __vdbe_add_op(v, OP_NotExists, cur, addr); + + /* + * If the record number will change, push the record number + * as it will be after the update. (The old record number is + * currently on top of the stack.) + */ + if (recno_will_change_p) { + __expr_code(parser, recno); + __vdbe_add_op(v, OP_MustBeInt, 0, 0); + } + + /* + * Compute new data for this record. + */ + for (i = 0; i < table->nCol; i++) { + if (i == table->iPKey) { + __vdbe_add_op(v, OP_String, 0, 0); + continue; + } + j = xref[i]; + if (j < 0) { + __vdbe_add_op(v, OP_Column, cur, i); + } else { + __expr_code(parser, changes->a[j].pExpr); + } + } + + /* + * Do constraint checks. + */ + __generate_constraint_checks(parser, table, cur, idx_used, + recno_will_change_p, 1, on_error, + addr); + + /* + * Delete the old indices for the current record. + */ + __generate_row_index_delete(dbp, v, table, cur, idx_used); + + /* + * If changing the record number, delete the old record. + */ + if (recno_will_change_p) { + __vdbe_add_op(v, OP_Delete, cur, 0); + } + + /* + * Create the new index entries and the new record. + */ + __complete_insertion(parser, table, cur, idx_used, + recno_will_change_p, 1, -1); + } + + /* + * Increment the row counter. + */ + if (dbp->flags & DBSQL_CountRows && !parser->trigStack) { + __vdbe_add_op(v, OP_AddImm, 1, 0); + } + + /* + * If there are triggers, close all the cursors after each iteration + * through the loop. The fire the after triggers. + */ + if (row_triggers_exist) { + if (!is_view_p) { + for(i = 0, idx = table->pIndex; idx; + idx = idx->pNext, i++) { + if (open_all_p || idx_used[i]) { + __vdbe_add_op(v, OP_Close, + (cur + i + 1), 0); + } + } + __vdbe_add_op(v, OP_Close, cur, 0); + parser->nTab = cur; + } + if (__code_row_trigger(parser, TK_UPDATE, changes, + TK_AFTER, table, new_idx, old_idx, + on_error, addr)) { + goto update_cleanup; + } + } + + /* + * Repeat the above with the next record to be updated, until + * all record selected by the WHERE clause have been updated. + */ + __vdbe_add_op(v, OP_Goto, 0, addr); + __vdbe_change_p2(v, addr, __vdbe_current_addr(v)); + __vdbe_add_op(v, OP_ListReset, 0, 0); + + /* + * Close all tables if there were no FOR EACH ROW triggers. + */ + if (!row_triggers_exist) { + for (i = 0, idx = table->pIndex; idx; idx = idx->pNext, i++) { + if (open_all_p || idx_used[i]) { + __vdbe_add_op(v, OP_Close, (cur + i + 1), 0); + } + } + __vdbe_add_op(v, OP_Close, cur, 0); + parser->nTab = cur; + } else { + __vdbe_add_op(v, OP_Close, new_idx, 0); + __vdbe_add_op(v, OP_Close, old_idx, 0); + } + + __vdbe_conclude_write(parser); + + /* + * Return the number of rows that were changed. + */ + if (dbp->flags & DBSQL_CountRows && !parser->trigStack) { + __vdbe_add_op(v, OP_ColumnName, 0, 0); + __vdbe_change_p3(v, -1, "rows updated", P3_STATIC); + __vdbe_add_op(v, OP_Callback, 1, 0); + } + + update_cleanup: + __auth_context_pop(&auth); + __dbsql_free(NULL, indices); + __dbsql_free(NULL, xref); + __src_list_delete(tab_list); + __expr_list_delete(changes); + __expr_delete(where); + return; +} diff --git a/src/cg_vacuum.c b/src/cg_vacuum.c new file mode 100644 index 0000000..5b10768 --- /dev/null +++ b/src/cg_vacuum.c @@ -0,0 +1,86 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_vacuum.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains code used to implement the VACUUM command. + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +#if !defined(DBSQL_OMIT_VACUUM) || DBSQL_OMIT_VACUUM + +/* + * __vacuum -- + * The non-standard VACUUM command is used to clean up the database, + * collapse free space, etc. It is modelled after the VACUUM command + * in PostgreSQL. + * + * PUBLIC: void __vacuum __P((parser_t *, token_t *)); + */ +void +__vacuum(parser, tab_name) + parser_t *parser; + token_t *tab_name; +{ + vdbe_t *v = __parser_get_vdbe(parser); + __vdbe_add_op(v, OP_Vacuum, 0, 0); + return; +} + +/* + * __execute_vacuum -- + * This routine implements the OP_Vacuum opcode of the VDBE. It works + * by running through each database asking each to reclaim space. + * + * PUBLIC: int __execute_vacuum __P((char **, DBSQL *)); + */ +int +__execute_vacuum(err_msgs, dbp) + char **err_msgs; + DBSQL *dbp; +{ + return DBSQL_SUCCESS; /* NOTE: When DB implements compaction (someday) + then this will be the place to invoke the + __sm_compact() function. For now, its + a no-op. */ +} + +#else + +/* + * __execute_vacuum -- + * A no-op. + * + * PUBLIC: int __execute_vacuum __P((char **, DBSQL *)); + */ +int +__execute_vacuum(err_msgs, dbp) + char **err_msgs; + DBSQL *dbp; +{ + return DBSQL_SUCCESS; +} + +#endif diff --git a/src/cg_where.c b/src/cg_where.c new file mode 100644 index 0000000..cd19604 --- /dev/null +++ b/src/cg_where.c @@ -0,0 +1,1450 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: cg_where.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * This file contains routines that handle WHERE statements. + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +/* + * The query generator uses an array of instances of this structure to + * help it analyze the subexpressions of the WHERE clause. Each WHERE + * clause subexpression is separated from the others by an AND operator. + */ +typedef struct expr_info { + expr_t *p; /* Pointer to the subexpression */ + u_int8_t indexable; /* True if this subexprssion is usable + by an index */ + short int idxLeft; /* p->pLeft is a column in this table + number. -1 if p->pLeft is not the + column of any table */ + short int idxRight; /* p->pRight is a column in this table + number. -1 if p->pRight is not the + column of any table */ + unsigned prereqLeft; /* Bitmask of tables referenced by p->pLeft */ + unsigned prereqRight; /* Bitmask of tables referenced by p->pRight */ + unsigned prereqAll; /* Bitmask of tables referenced by p */ +} expr_info_t; + +/* + * An instance of the following structure keeps track of a mapping + * between VDBE cursor numbers and bitmasks. The VDBE cursor numbers + * are small integers contained in src_list_item.iCursor and Expr.iTable + * fields. For any given WHERE clause, we want to track which cursors + * are being used, so we assign a single bit in a 32-bit word to track + * that cursor. Then a 32-bit integer is able to show the set of all + * cursors being used. + */ +typedef struct expr_mask_set { + int n; /* Number of assigned cursor values */ + int ix[32]; /* Cursor assigned to each bit */ +} expr_mask_set_t; + +/* __expr_split -- + * This routine is used to divide the WHERE expression into subexpressions + * separated by the AND operator. + * + * slot[] is an array of subexpressions structures. There are num_slot + * spaces left in this array. This routine attempts to split expr into + * subexpressions and fills slot[] with those subexpressions. + * The return value is the number of slots filled. + * + * STATIC: static int __expr_split __P((int, expr_info_t *, expr_t *)); + */ +static int +__expr_split(num_slot, slot, expr) + int num_slot; + expr_info_t *slot; + expr_t *expr; +{ + int cnt = 0; + if (expr == 0 || num_slot < 1) + return 0; + if (num_slot == 1 || expr->op != TK_AND) { + slot[0].p = expr; + return 1; + } + if (expr->pLeft->op != TK_AND) { + slot[0].p = expr->pLeft; + cnt = 1 + __expr_split((num_slot - 1), &slot[1], expr->pRight); + } else { + cnt = __expr_split(num_slot, slot, expr->pLeft); + cnt += __expr_split(num_slot-cnt, &slot[cnt], expr->pRight); + } + return cnt; +} + +/* + * __get_cursor_bitmask -- + * Return the bitmask for the given cursor. Assign a new bitmask + * if this is the first time the cursor has been seen. + * + * STATIC: static int __get_cursor_bitmask __P((expr_mask_set_t *, int)); + */ +static int +__get_cursor_bitmask(mask_set, cursor) + expr_mask_set_t *mask_set; + int cursor; +{ + int i; + for (i = 0; i < mask_set->n; i++) { + if (mask_set->ix[i] == cursor) + return (1 << i); + } + if (i == mask_set->n && i < ARRAY_SIZE(mask_set->ix)) { + mask_set->n++; + mask_set->ix[i] = cursor; + return (1 << i); + } + return 0; +} + +/* + * __free_mask_set -- + * Destroy an expression mask set. This is a no-op. + */ +#define __free_mask_set(P) + +/* + * __expr_table_usage -- + * This routine walks (recursively) an expression tree and generates + * a bitmask indicating which tables are used in that expression + * tree. + * + * In order for this routine to work, the calling function must have + * previously invoked __expr_resolve_ids() on the expression. See + * the header comment on that routine for additional information. + * The __expr_resolve_ids() routines looks for column names and + * sets their opcodes to TK_COLUMN and their expr_t.iTable fields to + * the VDBE cursor number of the table. + * + * STATIC: static int __expr_table_usage __P((expr_mask_set_t *, expr_t *)); + */ +static int +__expr_table_usage(mask_set, p) + expr_mask_set_t *mask_set; + expr_t *p; +{ + int i; + unsigned int mask = 0; + if(p == 0) + return 0; + if (p->op == TK_COLUMN) { + return __get_cursor_bitmask(mask_set, p->iTable); + } + if (p->pRight) { + mask = __expr_table_usage(mask_set, p->pRight); + } + if (p->pLeft) { + mask |= __expr_table_usage(mask_set, p->pLeft); + } + if (p->pList) { + for(i = 0; i < p->pList->nExpr; i++) { + mask |= __expr_table_usage(mask_set, + p->pList->a[i].pExpr); + } + } + return mask; +} + +/* + * __allowed_op -- + * Return TRUE if the given operator is one of the operators that is + * allowed for an indexable WHERE clause. The allowed operators are + * "=", "<", ">", "<=", ">=", and "IN". + * + * STATIC: static int __allowed_op __P((int)); + */ +static int +__allowed_op(op) + int op; +{ + switch(op) { + case TK_LT: /* FALLTHROUGH */ + case TK_LE: /* FALLTHROUGH */ + case TK_GT: /* FALLTHROUGH */ + case TK_GE: /* FALLTHROUGH */ + case TK_EQ: /* FALLTHROUGH */ + case TK_IN: + return 1; + default: + return 0; + } +} + +/* + * __expr_analyze -- + * The input to this routine is an expr_info_t structure with only the + * "p" field filled in. The job of this routine is to analyze the + * subexpression and populate all the other fields of the expr_info_t + * structure. + * + * STATIC: static void expr_analyze __P((expr_mask_set_t *, expr_info_t *)); + */ +static void +__expr_analyze(mask_set, info) + expr_mask_set_t *mask_set; + expr_info_t *info; +{ + expr_t *expr = info->p; + info->prereqLeft = __expr_table_usage(mask_set, expr->pLeft); + info->prereqRight = __expr_table_usage(mask_set, expr->pRight); + info->prereqAll = __expr_table_usage(mask_set, expr); + info->indexable = 0; + info->idxLeft = -1; + info->idxRight = -1; + if (__allowed_op(expr->op) && + (info->prereqRight & info->prereqLeft) == 0) { + if (expr->pRight && expr->pRight->op == TK_COLUMN) { + info->idxRight = expr->pRight->iTable; + info->indexable = 1; + } + if (expr->pLeft->op == TK_COLUMN) { + info->idxLeft = expr->pLeft->iTable; + info->indexable = 1; + } + } +} + +/* + * __find_sorting_index -- + * 'orderby_clause' is an ORDER BY clause from a SELECT statement. + * 'table' is the left-most table in the FROM clause of that same + * SELECT statement and the 'table' has a cursor number of 'base'. + * + * This routine attempts to find an index for table that generates the + * correct record sequence for the given ORDER BY clause. The return + * value is a pointer to an index that does the job. NULL is returned + * if the table has no index that will generate the correct sort order. + * + * If there are two or more indices that generate the correct sort order + * and 'preferred_idx' is one of those indices, then return + * 'preferred_idx'. + * + * 'num_eq_col' is the number of columns of 'preferred_idx' that are + * used as equality constraints. Any index returned must have exactly + * this same set of columns. The ORDER BY clause only matches index + * columns beyond the the first 'num_eq_col columns'. + * + * All terms of the ORDER BY clause must be either ASC or DESC. The + * '*orderby_desc_p' value is set to 1 if the ORDER BY clause is all + * DESC and it is set to 0 if the ORDER BY clause is all ASC. + * + * STATIC: static index_t *__find_sorting_index __P((table_t *, int, + * STATIC: expr_list_t *, index_t *, int, + * STATIC: int)); + * + * table The table to be sorted + * base Cursor number for table + * orderby_clause The ORDER BY clause + * preferred_idx Use this index, if possible and not NULL + * num_eq_col Number of index columns used with + * == constraints + * orderby_desc_p Set to 1 if ORDER BY is DESC + */ +static index_t *__find_sorting_index(table, base, orderby_clause, + preferred_idx, num_eq_col, orderby_desc_p) + table_t *table; + int base; + expr_list_t *orderby_clause; + index_t *preferred_idx; + int num_eq_col; + int *orderby_desc_p; +{ + int i, j; + index_t *match; + index_t *idx; + int sort_order; + expr_t *p; + int num_expr; + + DBSQL_ASSERT(orderby_clause != 0); + DBSQL_ASSERT(orderby_clause->nExpr > 0); + sort_order = (orderby_clause->a[0].sortOrder & DBSQL_SO_DIRMASK); + for (i = 0; i < orderby_clause->nExpr; i++) { + if ((orderby_clause->a[i].sortOrder & DBSQL_SO_DIRMASK) != + sort_order) { + /* + * Indices can only be used if all ORDER BY terms are + * either DESC or ASC. Indices cannot be used on a + * mixture. + */ + return 0; + } + if ((orderby_clause->a[i].sortOrder & DBSQL_SO_TYPEMASK) != + DBSQL_SO_UNK) { + /* Do not sort by index if there is a COLLATE clause */ + return 0; + } + p = orderby_clause->a[i].pExpr; + if (p->op != TK_COLUMN || p->iTable != base) { + /* + * Can not use an index sort on anything that is not + * a column in the left-most table of the FROM clause. + */ + return 0; + } + } + + /* + * If we get this far, it means the ORDER BY clause consists only of + * ascending columns in the left-most table of the FROM clause. Now + * check for a matching index. + */ + match = 0; + for (idx = table->pIndex; idx; idx = idx->pNext) { + num_expr = orderby_clause->nExpr; + if (idx->nColumn < num_eq_col || idx->nColumn < num_expr) + continue; + for (i = j = 0; i < num_eq_col; i++) { + if (preferred_idx->aiColumn[i] != idx->aiColumn[i]) + break; + if (j < num_expr && + (orderby_clause->a[j].pExpr->iColumn == + idx->aiColumn[i])) { + j++; + } + } + if (i < num_eq_col) + continue; + for (i = 0; (i + j) < num_expr; i++) { + if (orderby_clause->a[(i + j)].pExpr->iColumn != + idx->aiColumn[(i + num_eq_col)]) + break; + } + if ((i + j) >= num_expr) { + match = idx; + if (idx == preferred_idx) + break; + } + } + if (match && orderby_desc_p) { + *orderby_desc_p = (sort_order==DBSQL_SO_DESC); + } + return match; +} + +/* + * __where_begin -- + * Generate the beginning of the loop used for WHERE clause processing. + * The return value is a pointer to an (opaque) structure that contains + * information needed to terminate the loop. Later, the calling routine + * should invoke __where_end() with the return value of this function + * in order to complete the WHERE clause processing. + * + * If an error occurs, this routine returns NULL. + * + * The basic idea is to do a nested loop, one loop for each table in + * the FROM clause of a select. (INSERT and UPDATE statements are the + * same as a SELECT with only a single table in the FROM clause.) For + * example, if the SQL is this: + * + * SELECT * FROM t1, t2, t3 WHERE ...; + * + * Then the code generated is conceptually like the following: + * + * foreach row1 in t1 do \ Code generated + * foreach row2 in t2 do |-- by __where_begin() + * foreach row3 in t3 do / + * ... + * end \ Code generated + * end |-- by __where_end() + * end / + * + * There are Btree cursors associated with each table. t1 uses cursor + * number tab_list->a[0].iCursor. t2 uses the cursor + * tab_list->a[1].iCursor. And so forth. This routine generates code + * to open those VDBE cursors and __where_end() generates the code to + * close them. + * + * If the WHERE clause is empty, the foreach loops must each scan their + * entire tables. Thus a three-way join is an O(N^3) operation. But if + * the tables have indices and there are terms in the WHERE clause that + * refer to those indices, a complete table scan can be avoided and the + * code will run much faster. Most of the work of this routine is + * checking to see if there are indices that can be used to speed up + * the loop. + * + * Terms of the WHERE clause are also used to limit which rows actually + * make it to the "..." in the middle of the loop. After each "foreach", + * terms of the WHERE clause that use only terms in that loop and outer + * loops are evaluated and if false a jump is made around all subsequent + * inner loops (or around the "..." if the test occurs within the inner- + * most loop) + * + * OUTER JOINS + * + * An outer join of tables t1 and t2 is conceptally coded as follows: + * + * foreach row1 in t1 do + * flag = 0 + * foreach row2 in t2 do + * start: + * ... + * flag = 1 + * end + * if flag==0 then + * move the row2 cursor to a null row + * goto start + * fi + * end + * + * ORDER BY CLAUSE PROCESSING + * + * *orderby_clause is a pointer to the ORDER BY clause of a SELECT + * statement, if there is one. If there is no ORDER BY clause or if + * this routine is called from an UPDATE or DELETE statement, then + * orderby_clause is NULL. + * + * If an index can be used so that the natural output order of the table + * scan is correct for the ORDER BY clause, then that index is used and + * *orderby_clause is set to NULL. This is an optimization that prevents + * an unnecessary sort of the result set if an index appropriate for the + * ORDER BY clause already exists. + * + * If the where clause loops cannot be arranged to provide the correct + * output order, then the *orderby_clause is unchanged. + * + * PUBLIC: where_info_t *__where_begin __P((parser_t *, src_list_t *, expr_t *, + * PUBLIC: int, expr_list_t **)); + * + * parser The parser context + * tab_list A list of all tables to be scanned + * where_clause The WHERE clause + * push_key_p If TRUE, leave the table key on the stack + * orderby_clause An ORDER BY clause, or NULL + */ +where_info_t *__where_begin(parser, tab_list, where_clause, push_key_p, + orderby_clause) + parser_t *parser; + src_list_t *tab_list; + expr_t *where_clause; + int push_key_p; + expr_list_t **orderby_clause; +{ + int i; /* Loop counter */ + where_info_t *where_info; /* Will become the return value of this + function */ + vdbe_t *v = parser->pVdbe;/* The virtual database engine */ + int brk, cont = 0; /* Addresses used during code generation */ + int num_expr; /* Number of subexpressions in the WHERE + clause */ + int loop_mask; /* One bit set for each outer loop */ + int have_key_p; /* True if KEY is on the stack */ + expr_mask_set_t mask_set; /* The expression mask set */ + int direct_eq[32]; /* Term of the form ROWID==X for the + N-th table */ + int direct_lt[32]; /* Term of the form ROWIDX or ROWID>=X */ + expr_info_t wc_exprs[101];/* The WHERE clause is divided into these + expressions */ + char buf[50]; + int x, mask, j, cur, best_score; + table_t *table; + index_t *idx, *best_idx; + int eq_mask; /* Index columns covered by an x=... term */ + int lt_mask; /* Index columns covered by an x<... term */ + int gt_mask; /* Index columns covered by an x>... term */ + int in_mask; /* Index columns covered by an x IN .. term */ + int num_eq, m, score; + int col, k; + index_t *sort_idx; + int rev = 0; + int num_col_eq; + where_level_t *level; + expr_t *ex, *expr; + int start, test_op, col_num; + int eqcols; + int le_flag, ge_flag; + + /* + * 'push_key_p' is only allowed if there is a single table + * (as in an INSERT or UPDATE statement). + */ + DBSQL_ASSERT(push_key_p == 0 || tab_list->nSrc == 1); + + /* + * Split the WHERE clause into separate subexpressions where each + * subexpression is separated by an AND operator. If the wc_exprs[] + * array fills up, the last entry might point to an expression which + * contains additional unfactored AND operators. + */ + memset(&mask_set, 0, sizeof(mask_set)); + memset(wc_exprs, 0, sizeof(wc_exprs)); + num_expr = __expr_split(ARRAY_SIZE(wc_exprs), wc_exprs, where_clause); + if (num_expr == ARRAY_SIZE(wc_exprs)) { + sprintf(buf, "%d", (int)(ARRAY_SIZE(wc_exprs) - 1)); + __str_append(&parser->zErrMsg, + "WHERE clause too complex - no more " + "than ", buf, " terms allowed", (char*)0); + parser->nErr++; + return 0; + } + + /* + * Allocate and initialize the where_info_t structure that will + * become the return value. + */ + if (__dbsql_calloc(parser->db, 1, sizeof(where_info_t) + + (tab_list->nSrc * sizeof(where_level_t)), + &where_info) == ENOMEM) { + __dbsql_free(parser->db, where_info); + return 0; + } + where_info->pParse = parser; + where_info->pTabList = tab_list; + where_info->peakNTab = where_info->savedNTab = parser->nTab; + where_info->iBreak = __vdbe_make_label(v); + + /* + * Special case: a WHERE clause that is constant. Evaluate the + * expression and either jump over all of the code or fall thru. + */ + if (where_clause && + (tab_list->nSrc == 0 || __expr_is_constant(where_clause))) { + __expr_if_false(parser, where_clause, where_info->iBreak, 1); + where_clause = 0; + } + + /* + * Analyze all of the subexpressions. + */ + for(i = 0; i < num_expr; i++) { + __expr_analyze(&mask_set, &wc_exprs[i]); + + /* + * If we are executing a trigger body, remove all references + * to new.* and old.* tables from the prerequisite masks. + */ + if (parser->trigStack) { + if ((x = parser->trigStack->newIdx) >= 0 ) { + mask = ~__get_cursor_bitmask(&mask_set, x); + wc_exprs[i].prereqRight &= mask; + wc_exprs[i].prereqLeft &= mask; + wc_exprs[i].prereqAll &= mask; + } + if ((x = parser->trigStack->oldIdx) >= 0) { + mask = ~__get_cursor_bitmask(&mask_set, x); + wc_exprs[i].prereqRight &= mask; + wc_exprs[i].prereqLeft &= mask; + wc_exprs[i].prereqAll &= mask; + } + } + } + + /* + * Figure out what index to use (if any) for each nested loop. + * Make where_info->a[i].pIdx point to the index to use for the i-th + * nested loop where i==0 is the outer loop and i==tab_list->nSrc-1 + * is the inner loop. + * + * If terms exist that use the ROWID of any table, then set the + * direct_eq[], direct_lt[], or direct_gt[] elements for that table + * to the index of the term containing the ROWID. We always prefer + * to use a ROWID which can directly access a table rather than an + * index which requires reading an index first to get the rowid then + * doing a second read of the actual database table. + * + * Actually, if there are more than 32 tables in the join, only the + * first 32 tables are candidates for indices. This is (again) due + * to the limit of 32 bits in an integer bitmask. + */ + loop_mask = 0; + for(i = 0; i < tab_list->nSrc && i < ARRAY_SIZE(direct_eq); i++) { + cur = tab_list->a[i].iCursor; /* The cursor for this table */ + mask = __get_cursor_bitmask(&mask_set, cur); + table = tab_list->a[i].pTab; + best_idx = 0; + best_score = 0; + + /* + * Check to see if there is an expression that uses only the + * ROWID field of this table. For terms of the form + * ROWID==expr set direct_eq[i] to the index of the term. + * For terms of the form ROWIDexpr or ROWID>=expr set direct_gt[i]. + * + * Additionally, treat ROWID IN expr like ROWID=expr. + */ + where_info->a[i].iCur = -1; + direct_eq[i] = -1; + direct_lt[i] = -1; + direct_gt[i] = -1; + for (j = 0; j < num_expr; j++) { + if (wc_exprs[j].idxLeft == cur && + wc_exprs[j].p->pLeft->iColumn < 0 && + ((wc_exprs[j].prereqRight & loop_mask) == + wc_exprs[j].prereqRight)) { + switch(wc_exprs[j].p->op) { + case TK_IN: /* FALLTHROUGH */ + case TK_EQ: + direct_eq[i] = j; + break; + case TK_LE: /* FALLTHROUGH */ + case TK_LT: + direct_lt[i] = j; + break; + case TK_GE: /* FALLTHROUGH */ + case TK_GT: + direct_gt[i] = j; + break; + } + } + if (wc_exprs[j].idxRight == cur && + wc_exprs[j].p->pRight->iColumn < 0 && + ((wc_exprs[j].prereqLeft & loop_mask) == + wc_exprs[j].prereqLeft)) { + switch(wc_exprs[j].p->op) { + case TK_EQ: + direct_eq[i] = j; + break; + case TK_LE: /* FALLTHROUGH */ + case TK_LT: + direct_gt[i] = j; + break; + case TK_GE: /* FALLTHROUGH */ + case TK_GT: + direct_lt[i] = j; + break; + } + } + } + if (direct_eq[i] >= 0) { + loop_mask |= mask; + where_info->a[i].pIdx = 0; + continue; + } + + /* + * Do a search for usable indices. Leave 'best_idx' pointing + * to the "best" index. 'best_idx' is left set to NULL if no + * indices are usable. + * + * The best index is determined as follows. For each of the + * left-most terms that is fixed by an equality operator, add + * 8 to the score. The right-most term of the index may be + * constrained by an inequality. Add 1 if for an + * "x<..." constraint and add 2 for an "x>..." constraint. + * Chose the index that gives the best score. + * + * This scoring system is designed so that the score can + * later be used to determine how the index is used. If the + * score&7 is 0 then all constraints are equalities. If + * score&1 is not 0 then there is an inequality used as a + * termination key. (ex: "x<...") If score&2 is not 0 then + * there is an inequality used as the start key. + * (ex: "x>..."). A score or 4 is the special case of an IN + * operator constraint. (ex: "x IN ..."). + * + * The IN operator (as in " IN (...)") is treated the + * same as an equality comparison except that it can only be + * used on the left-most column of an index and other terms + * of the WHERE clause cannot be used in conjunction with the + * IN operator to help satisfy other columns of the index. + */ + for(idx = table->pIndex; idx; idx = idx->pNext) { + eq_mask = 0; + lt_mask = 0; + gt_mask = 0; + in_mask = 0; + if (idx->nColumn > 32) + continue;/* Ignore indices too many columns */ + for (j = 0; j < num_expr; j++) { + if (wc_exprs[j].idxLeft == cur && + ((wc_exprs[j].prereqRight & loop_mask) == + wc_exprs[j].prereqRight)) { + col = wc_exprs[j].p->pLeft->iColumn; + for (k = 0; k < idx->nColumn; k++) { + if (idx->aiColumn[k] == col) { + switch(wc_exprs[j].p->op){ + case TK_IN: + if(k == 0) + in_mask |= 1; + break; + case TK_EQ: + eq_mask |= 1<pRight->iColumn; + for (k = 0; k < idx->nColumn; k++) { + if (idx->aiColumn[k] == col) { + switch(wc_exprs[j].p->op) { + case TK_EQ: + eq_mask |= 1<nColumn; num_eq++) { + m = (1 << (num_eq + 1)) - 1; + if ((m & eq_mask) != m) + break; + } + score = (num_eq * 8); /* Base score is 8 times + number of == constraints. */ + m = (1 << num_eq); + if (m & lt_mask) + score++; /* Increase score for a + < constraint. */ + if (m & gt_mask) + score+=2; /* Increase score for a + > constraint. */ + if (score == 0 && in_mask) + score = 4; /* Default score for IN + constraint. */ + if (score > best_score ) { + best_idx = idx; + best_score = score; + } + } + where_info->a[i].pIdx = best_idx; + where_info->a[i].score = best_score; + where_info->a[i].bRev = 0; + loop_mask |= mask; + if (best_idx) { + where_info->a[i].iCur = parser->nTab++; + where_info->peakNTab = parser->nTab; + } + } + + /* + * Check to see if the ORDER BY clause is or can be satisfied by the + * use of an index on the first table. + */ + if (orderby_clause && *orderby_clause && tab_list->nSrc > 0) { + rev = 0; + table = tab_list->a[0].pTab; + idx = where_info->a[0].pIdx; + if (idx && where_info->a[0].score == 4) { + /* + * If there is already an IN index on the left-most + * table, it will not give the correct sort order. + * So, pretend that no suitable index is found. + */ + sort_idx = 0; + } else if (direct_eq[0] >= 0 || direct_lt[0] >= 0 || + direct_gt[0] >= 0) { + /* + * If the left-most column is accessed using its + * ROWID, then donot try to sort by index. + */ + sort_idx = 0; + } else { + num_col_eq = (where_info->a[0].score + 4) / 8; + sort_idx = __find_sorting_index(table, + tab_list->a[0].iCursor, + *orderby_clause, idx, + num_col_eq, &rev); + } + if (sort_idx && (idx == 0 || idx == sort_idx)) { + if (idx == 0) { + where_info->a[0].pIdx = sort_idx; + where_info->a[0].iCur = parser->nTab++; + where_info->peakNTab = parser->nTab; + } + where_info->a[0].bRev = rev; + *orderby_clause = 0; + } + } + + /* + * Open all tables in the tab_list and all indices used by those + * tables. + */ + for (i = 0; i < tab_list->nSrc; i++) { + table = tab_list->a[i].pTab; + if (table->isTransient || table->pSelect ) + continue; + __vdbe_add_op(v, OP_Integer, table->iDb, 0); + __vdbe_add_op(v, OP_OpenRead, tab_list->a[i].iCursor, + table->tnum); + __vdbe_change_p3(v, -1, table->zName, P3_STATIC); + __code_verify_schema(parser, table->iDb); + if (where_info->a[i].pIdx != 0) { + __vdbe_add_op(v, OP_Integer, + where_info->a[i].pIdx->iDb, 0); + __vdbe_add_op(v, OP_OpenRead, where_info->a[i].iCur, + where_info->a[i].pIdx->tnum); + __vdbe_change_p3(v, -1, where_info->a[i].pIdx->zName, + P3_STATIC); + } + } + + /* + * Generate the code to do the search. + */ + loop_mask = 0; + for (i = 0; i < tab_list->nSrc; i++) { + cur = tab_list->a[i].iCursor; + level = &where_info->a[i]; + + /* + * If this is the right table of a LEFT OUTER JOIN, allocate + * and initialize a memory cell that records if this table + * matches any row of the left table of the join. + */ + if (i > 0 && (tab_list->a[(i - 1)].jointype & JT_LEFT) != 0) { + if (!parser->nMem) + parser->nMem++; + level->iLeftJoin = parser->nMem++; + __vdbe_add_op(v, OP_String, 0, 0); + __vdbe_add_op(v, OP_MemStore, level->iLeftJoin, 1); + } + + idx = level->pIdx; + level->inOp = OP_Noop; + if (i < ARRAY_SIZE(direct_eq) && direct_eq[i] >= 0) { + /* + * Case 1: We can directly reference a single row + * using an equality comparison against the ROWID + * field. Or we reference multiple rows using a + * "rowid IN (...)" construct. + */ + k = direct_eq[i]; + DBSQL_ASSERT(k < num_expr); + DBSQL_ASSERT(wc_exprs[k].p != 0); + DBSQL_ASSERT(wc_exprs[k].idxLeft == cur || + wc_exprs[k].idxRight == cur); + brk = level->brk = __vdbe_make_label(v); + if (wc_exprs[k].idxLeft == cur) { + ex = wc_exprs[k].p; + if (ex->op != TK_IN) { + __expr_code(parser, + wc_exprs[k].p->pRight); + } else if (ex->pList) { + __vdbe_add_op(v, OP_SetFirst, + ex->iTable, brk); + level->inOp = OP_SetNext; + level->inP1 = ex->iTable; + level->inP2 = __vdbe_current_addr(v); + } else { + DBSQL_ASSERT(ex->pSelect); + __vdbe_add_op(v, OP_Rewind, + ex->iTable, brk); + __vdbe_add_op(v, OP_KeyAsData, + ex->iTable, 1); + level->inP2 = + __vdbe_add_op(v, OP_FullKey, + ex->iTable, 0); + level->inOp = OP_Next; + level->inP1 = ex->iTable; + } + } else { + __expr_code(parser, wc_exprs[k].p->pLeft); + } + wc_exprs[k].p = 0; + cont = level->cont = __vdbe_make_label(v); + __vdbe_add_op(v, OP_MustBeInt, 1, brk); + have_key_p = 0; + __vdbe_add_op(v, OP_NotExists, cur, brk); + level->op = OP_Noop; + } else if (idx != 0 && level->score > 0 && + ((level->score % 4) == 0)) { + /* + * Case 2: There is an index and all terms of the + * WHERE clause that refer to the index use the + * "==" or "IN" operators. + */ + col_num = (level->score+4)/8; + brk = level->brk = __vdbe_make_label(v); + for (j = 0; j < col_num; j++) { + for (k = 0; k < num_expr; k++) { + ex = wc_exprs[k].p; + if (ex == 0) + continue; + if (wc_exprs[k].idxLeft == cur && + ((wc_exprs[k].prereqRight & + loop_mask) == + wc_exprs[k].prereqRight) && + (ex->pLeft->iColumn == + idx->aiColumn[j])) { + if (ex->op == TK_EQ) { + __expr_code(parser, + ex->pRight); + wc_exprs[k].p = 0; + break; + } + if (ex->op == TK_IN && + col_num == 1) { + if (ex->pList) { + __vdbe_add_op(v, OP_SetFirst, ex->iTable, brk); + level->inOp = OP_SetNext; + level->inP1 = ex->iTable; + level->inP2 = __vdbe_current_addr(v); + } else { + DBSQL_ASSERT(ex->pSelect); + __vdbe_add_op(v, OP_Rewind, ex->iTable, brk); + __vdbe_add_op(v, OP_KeyAsData, ex->iTable, 1); + level->inP2 = __vdbe_add_op(v, OP_FullKey, ex->iTable, 0); + level->inOp = OP_Next; + level->inP1 = ex->iTable; + } + wc_exprs[k].p = 0; + break; + } + } + if (wc_exprs[k].idxRight ==cur && + wc_exprs[k].p->op == TK_EQ && + ((wc_exprs[k].prereqLeft & + loop_mask) == + wc_exprs[k].prereqLeft) && + (wc_exprs[k].p->pRight->iColumn == + idx->aiColumn[j])) { + __expr_code(parser, wc_exprs[k].p->pLeft); + wc_exprs[k].p = 0; + break; + } + } + } + level->iMem = parser->nMem++; + cont = level->cont = __vdbe_make_label(v); + __vdbe_add_op(v, OP_NotNull, -col_num, + (__vdbe_current_addr(v) + 3)); + __vdbe_add_op(v, OP_Pop, col_num, 0); + __vdbe_add_op(v, OP_Goto, 0, brk); + __vdbe_add_op(v, OP_MakeKey, col_num, 0); + __add_idx_key_type(v, idx); + if (col_num == idx->nColumn || level->bRev) { + __vdbe_add_op(v, OP_MemStore, level->iMem, 0); + test_op = OP_IdxGT; + } else { + __vdbe_add_op(v, OP_Dup, 0, 0); + __vdbe_add_op(v, OP_IncrKey, 0, 0); + __vdbe_add_op(v, OP_MemStore, level->iMem, 1); + test_op = OP_IdxGE; + } + if (level->bRev) { + /* Scan in reverse order */ + __vdbe_add_op(v, OP_IncrKey, 0, 0); + __vdbe_add_op(v, OP_MoveLt, level->iCur, brk); + start = __vdbe_add_op(v, OP_MemLoad, + level->iMem, 0); + __vdbe_add_op(v, OP_IdxLT, level->iCur, brk); + level->op = OP_Prev; + } else { + /* Scan in the forward order */ + __vdbe_add_op(v, OP_MoveTo, level->iCur, brk); + start = __vdbe_add_op(v, OP_MemLoad, + level->iMem, 0); + __vdbe_add_op(v, test_op, level->iCur, brk); + level->op = OP_Next; + } + __vdbe_add_op(v, OP_RowKey, level->iCur, 0); + __vdbe_add_op(v, OP_IdxIsNull, col_num, cont); + __vdbe_add_op(v, OP_IdxRecno, level->iCur, 0); + if (i == tab_list->nSrc-1 && push_key_p) { + have_key_p = 1; + } else { + __vdbe_add_op(v, OP_MoveTo, cur, 0); + have_key_p = 0; + } + level->p1 = level->iCur; + level->p2 = start; + } else if (i < ARRAY_SIZE(direct_lt) && + (direct_lt[i] >= 0 || direct_gt[i] >= 0)) { + /* + * Case 3: We have an inequality comparison against + * the ROWID field. + */ + test_op = OP_Noop; + brk = level->brk = __vdbe_make_label(v); + cont = level->cont = __vdbe_make_label(v); + if (direct_gt[i] >= 0) { + k = direct_gt[i]; + DBSQL_ASSERT(k < num_expr); + DBSQL_ASSERT(wc_exprs[k].p != 0); + DBSQL_ASSERT(wc_exprs[k].idxLeft == cur || + wc_exprs[k].idxRight == cur); + if (wc_exprs[k].idxLeft == cur) { + __expr_code(parser, + wc_exprs[k].p->pRight); + } else { + __expr_code(parser, + wc_exprs[k].p->pLeft); + } + __vdbe_add_op(v, OP_ForceInt, + ((wc_exprs[k].p->op == TK_LT) || + (wc_exprs[k].p->op == TK_GT)), + brk); + __vdbe_add_op(v, OP_MoveTo, cur, brk); + wc_exprs[k].p = 0; + } else { + __vdbe_add_op(v, OP_Rewind, cur, brk); + } + if (direct_lt[i] >= 0) { + k = direct_lt[i]; + DBSQL_ASSERT(k < num_expr); + DBSQL_ASSERT(wc_exprs[k].p != 0); + DBSQL_ASSERT(wc_exprs[k].idxLeft == cur || + wc_exprs[k].idxRight == cur); + if (wc_exprs[k].idxLeft == cur) { + __expr_code(parser, + wc_exprs[k].p->pRight); + } else { + __expr_code(parser, + wc_exprs[k].p->pLeft); + } + /*TODO: __vdbe_add_op(v, OP_MustBeInt, 0, __vdbe_current_addr(v)+1); */ + level->iMem = parser->nMem++; + __vdbe_add_op(v, OP_MemStore, level->iMem, 1); + if (((wc_exprs[k].p->op == TK_LT) || + (wc_exprs[k].p->op == TK_GT))) { + test_op = OP_Ge; + } else { + test_op = OP_Gt; + } + wc_exprs[k].p = 0; + } + start = __vdbe_current_addr(v); + level->op = OP_Next; + level->p1 = cur; + level->p2 = start; + if (test_op != OP_Noop) { + __vdbe_add_op(v, OP_Recno, cur, 0); + __vdbe_add_op(v, OP_MemLoad, level->iMem, 0); + __vdbe_add_op(v, test_op, 0, brk); + } + have_key_p = 0; + } else if (idx == 0) { + /* + * Case 4: There is no usable index. We must do a + * complete scan of the entire database table. + */ + brk = level->brk = __vdbe_make_label(v); + cont = level->cont = __vdbe_make_label(v); + __vdbe_add_op(v, OP_Rewind, cur, brk); + start = __vdbe_current_addr(v); + level->op = OP_Next; + level->p1 = cur; + level->p2 = start; + have_key_p = 0; + } else { + /* + * Case 5: The WHERE clause term that refers to the + * right-most column of the index is an inequality. + * For example, if the index is on (x,y,z) and the + * WHERE clause is of the form "x=5 AND y<10" then + * this case is used. Only the right-most column + * can be an inequality - the rest must use the + * "==" operator. + * + * This case is also used when there are no WHERE + * clause constraints but an index is selected anyway, + * in order to force the output order to conform to an + * ORDER BY. + */ + + score = level->score; + eqcols = score/8; + + /* + * Evaluate the equality constraints + */ + for (j = 0; j < eqcols; j++) { + for (k = 0; k < num_expr; k++) { + if (wc_exprs[k].p == 0) + continue; + if (wc_exprs[k].idxLeft == cur && + wc_exprs[k].p->op == TK_EQ && + ((wc_exprs[k].prereqRight & + loop_mask) == + wc_exprs[k].prereqRight) && + (wc_exprs[k].p->pLeft->iColumn == + idx->aiColumn[j])) { + __expr_code(parser, + wc_exprs[k].p->pRight); + wc_exprs[k].p = 0; + break; + } + if (wc_exprs[k].idxRight == cur && + wc_exprs[k].p->op == TK_EQ && + ((wc_exprs[k].prereqLeft & + loop_mask) == + wc_exprs[k].prereqLeft) && + (wc_exprs[k].p->pRight->iColumn == + idx->aiColumn[j])) { + __expr_code(parser, + wc_exprs[k].p->pLeft); + wc_exprs[k].p = 0; + break; + } + } + } + + /* + * Duplicate the equality term values because they + * will all be used twice: once to make the termination + * key and once to make the start key. + */ + for (j = 0; j < eqcols; j++) { + __vdbe_add_op(v, OP_Dup, eqcols-1, 0); + } + + /* + * Labels for the beginning and end of the loop. + */ + cont = level->cont = __vdbe_make_label(v); + brk = level->brk = __vdbe_make_label(v); + + /* + * Generate the termination key. This is the key + * value that will end the search. There is no + * termination key if there are no equality terms and + * no "X<..." term. + * + * On a reverse-order scan, the so-called "termination" + * key computed here really ends up being the start + * key. + */ + if ((score & 1) != 0) { + for (k = 0; k < num_expr; k++) { + expr = wc_exprs[k].p; + if (expr == 0) + continue; + if (wc_exprs[k].idxLeft == cur && + (expr->op == TK_LT || + expr->op == TK_LE) && + ((wc_exprs[k].prereqRight & + loop_mask) == + wc_exprs[k].prereqRight) && + (expr->pLeft->iColumn == + idx->aiColumn[j])) { + __expr_code(parser, + expr->pRight); + le_flag = expr->op==TK_LE; + wc_exprs[k].p = 0; + break; + } + if (wc_exprs[k].idxRight == cur && + ((expr->op == TK_GT || + expr->op == TK_GE)) && + ((wc_exprs[k].prereqLeft & + loop_mask) == + wc_exprs[k].prereqLeft) && + (expr->pRight->iColumn == + idx->aiColumn[j])) { + __expr_code(parser, + expr->pLeft); + le_flag = expr->op==TK_GE; + wc_exprs[k].p = 0; + break; + } + } + test_op = OP_IdxGE; + } else { + test_op = (eqcols > 0) ? OP_IdxGE : OP_Noop; + le_flag = 1; + } + if (test_op != OP_Noop) { + col = eqcols + (score & 1); + level->iMem = parser->nMem++; + __vdbe_add_op(v, OP_NotNull, -col, + (__vdbe_current_addr(v) + 3)); + __vdbe_add_op(v, OP_Pop, col, 0); + __vdbe_add_op(v, OP_Goto, 0, brk); + __vdbe_add_op(v, OP_MakeKey, col, 0); + __add_idx_key_type(v, idx); + if (le_flag) { + __vdbe_add_op(v, OP_IncrKey, 0, 0); + } + if (level->bRev) { + __vdbe_add_op(v, OP_MoveLt, + level->iCur, brk); + } else { + __vdbe_add_op(v, OP_MemStore, + level->iMem, 1); + } + } else if (level->bRev) { + __vdbe_add_op(v, OP_Last, level->iCur, brk); + } + + /* + * Generate the start key. This is the key that + * defines the lower bound on the search. There is + * no start key if there are no equality terms and if + * there is no "X>..." term. In that case, generate + * a "Rewind" instruction in place of the start key + * search. + * + * In the case of a reverse-order search, the so-called + * "start" key really ends up being used as the + * termination key. + */ + if ((score & 2) != 0) { + for (k = 0; k < num_expr; k++) { + expr = wc_exprs[k].p; + if (expr == 0) + continue; + if (wc_exprs[k].idxLeft == cur && + ((expr->op == TK_GT || + expr->op == TK_GE)) && + ((wc_exprs[k].prereqRight & + loop_mask) == + wc_exprs[k].prereqRight) && + (expr->pLeft->iColumn == + idx->aiColumn[j])) { + __expr_code(parser, + expr->pRight); + ge_flag = expr->op==TK_GE; + wc_exprs[k].p = 0; + break; + } + if (wc_exprs[k].idxRight == cur && + ((expr->op == TK_LT || + expr->op == TK_LE)) && + ((wc_exprs[k].prereqLeft & + loop_mask) == + wc_exprs[k].prereqLeft) && + (expr->pRight->iColumn == + idx->aiColumn[j])) { + __expr_code(parser, + expr->pLeft); + ge_flag = expr->op==TK_LE; + wc_exprs[k].p = 0; + break; + } + } + } else { + ge_flag = 1; + } + if (eqcols > 0 || (score & 2) != 0) { + col = eqcols + ((score & 2) != 0); + __vdbe_add_op(v, OP_NotNull, -col, + (__vdbe_current_addr(v) + 3)); + __vdbe_add_op(v, OP_Pop, col, 0); + __vdbe_add_op(v, OP_Goto, 0, brk); + __vdbe_add_op(v, OP_MakeKey, col, 0); + __add_idx_key_type(v, idx); + if (!ge_flag) { + __vdbe_add_op(v, OP_IncrKey, 0, 0); + } + if (level->bRev) { + level->iMem = parser->nMem++; + __vdbe_add_op(v, OP_MemStore, + level->iMem, 1); + test_op = OP_IdxLT; + } else { + __vdbe_add_op(v, OP_MoveTo, + level->iCur, brk); + } + } else if (level->bRev) { + test_op = OP_Noop; + } else { + __vdbe_add_op(v, OP_Rewind, level->iCur, brk); + } + + /* + * Generate the the top of the loop. If there is a + * termination key we have to test for that key and + * abort at the top of the loop. + */ + start = __vdbe_current_addr(v); + if (test_op != OP_Noop) { + __vdbe_add_op(v, OP_MemLoad, level->iMem, 0); + __vdbe_add_op(v, test_op, level->iCur, brk); + } + __vdbe_add_op(v, OP_RowKey, level->iCur, 0); + __vdbe_add_op(v, OP_IdxIsNull, (eqcols + (score & 1)), + cont); + __vdbe_add_op(v, OP_IdxRecno, level->iCur, 0); + if (i == (tab_list->nSrc - 1) && push_key_p) { + have_key_p = 1; + } else { + __vdbe_add_op(v, OP_MoveTo, cur, 0); + have_key_p = 0; + } + + /* + * Record the instruction used to terminate the loop. + */ + level->op = level->bRev ? OP_Prev : OP_Next; + level->p1 = level->iCur; + level->p2 = start; + } + loop_mask |= __get_cursor_bitmask(&mask_set, cur); + + /* + * Insert code to test every subexpression that can be + * completely computed using the current set of tables. + */ + for (j = 0; j < num_expr; j++) { + if (wc_exprs[j].p == 0) + continue; + if ((wc_exprs[j].prereqAll & loop_mask) != + wc_exprs[j].prereqAll) + continue; + if (level->iLeftJoin && + !ExprHasProperty(wc_exprs[j].p, EP_FromJoin)) { + continue; + } + if (have_key_p) { + have_key_p = 0; + __vdbe_add_op(v, OP_MoveTo, cur, 0); + } + __expr_if_false(parser, wc_exprs[j].p, cont, 1); + wc_exprs[j].p = 0; + } + brk = cont; + + /* + * For a LEFT OUTER JOIN, generate code that will record the + * fact that at least one row of the right table has matched + * the left table. + */ + if (level->iLeftJoin) { + level->top = __vdbe_current_addr(v); + __vdbe_add_op(v, OP_Integer, 1, 0); + __vdbe_add_op(v, OP_MemStore, level->iLeftJoin, 1); + for (j = 0; j < num_expr; j++) { + if (wc_exprs[j].p == 0) + continue; + if ((wc_exprs[j].prereqAll & loop_mask) != + wc_exprs[j].prereqAll ) + continue; + if (have_key_p) { + /* + * Cannot happen. 'have_key_p' can + * only be true if push_key_p is true + * an push_key_p can only be true for + * DELETE and UPDATE and there are no + * outer joins with DELETE and UPDATE. + */ + have_key_p = 0; + __vdbe_add_op(v, OP_MoveTo, cur, 0); + } + __expr_if_false(parser, wc_exprs[j].p, cont,1); + wc_exprs[j].p = 0; + } + } + } + where_info->iContinue = cont; + if (push_key_p && !have_key_p) { + __vdbe_add_op(v, OP_Recno, tab_list->a[0].iCursor, 0); + } + __free_mask_set(&mask_set); + return where_info; +} + +/* + * __where_end -- + * Generate the end of the WHERE loop. See comments on + * __where_begin() for additional information. + * + * PUBLIC: void __where_end __P((where_info_t *)); + */ +void +__where_end(winfo) + where_info_t *winfo; +{ + int i, addr; + where_level_t *level; + table_t *table; + vdbe_t *v = winfo->pParse->pVdbe; + src_list_t *tab_list = winfo->pTabList; + + for (i = (tab_list->nSrc - 1); i >= 0; i--) { + level = &winfo->a[i]; + __vdbe_resolve_label(v, level->cont); + if (level->op != OP_Noop) { + __vdbe_add_op(v, level->op, level->p1, level->p2); + } + __vdbe_resolve_label(v, level->brk); + if (level->inOp != OP_Noop) { + __vdbe_add_op(v, level->inOp, level->inP1, + level->inP2); + } + if (level->iLeftJoin) { + addr = __vdbe_add_op(v, OP_MemLoad, + level->iLeftJoin, 0); + __vdbe_add_op(v, OP_NotNull, 1, + (addr + 4 + (level->iCur >= 0))); + __vdbe_add_op(v, OP_NullRow, tab_list->a[i].iCursor, + 0); + if (level->iCur >= 0) { + __vdbe_add_op(v, OP_NullRow, level->iCur, 0); + } + __vdbe_add_op(v, OP_Goto, 0, level->top); + } + } + __vdbe_resolve_label(v, winfo->iBreak); + for (i = 0; i < tab_list->nSrc; i++) { + table = tab_list->a[i].pTab; + DBSQL_ASSERT(table != 0); + if (table->isTransient || table->pSelect) + continue; + level = &winfo->a[i]; + __vdbe_add_op(v, OP_Close, tab_list->a[i].iCursor, 0); + if (level->pIdx != 0) { + __vdbe_add_op(v, OP_Close, level->iCur, 0); + } + } +#if 0 /* NOTE: Never reuse a cursor */ + if( winfo->pParse->nTab==winfo->peakNTab ){ + winfo->pParse->nTab = winfo->savedNTab; + } +#endif + __dbsql_free(winfo->pParse->db, winfo); + return; +} diff --git a/src/clib/getopt.c b/src/clib/getopt.c new file mode 100644 index 0000000..e32d8db --- /dev/null +++ b/src/clib/getopt.c @@ -0,0 +1,213 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: getopt.c 7 2007-02-03 13:34:17Z gburd $ + */ +/* + * Copyright (c) 1990-2004 + * Sleepycat Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Redistributions in any form must be accompanied by information on + * how to obtain complete source code for the DB software and any + * accompanying software that uses the DB software. The source code + * must either be included in the distribution or be available for no + * more than the cost of distribution plus a nominal fee, and must be + * freely redistributable under reasonable conditions. For an + * executable file, complete source code means the source code for all + * modules it contains. It does not include source code for modules or + * files that typically accompany the major components of the operating + * system on which the executable file runs. + * + * THIS SOFTWARE IS PROVIDED BY ORACLE CORPORATION ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + * NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL ORACLE CORPORATION + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * Copyright (c) 1990, 1993, 1994, 1995 + *The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * Copyright (c) 1995, 1996 + *The President and Fellows of Harvard University. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions + */ + +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#include +#endif + +#include "dbsql_int.h" + +int __dbsql_getopt_reset; /* global reset for VxWorks. */ + +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt, /* character checked for validity */ + optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ + +#undef BADCH +#define BADCH (int)'?' +#undef BADARG +#define BADARG (int)':' +#undef EMSG +#define EMSG "" + +/* + * getopt -- + * Parse argc/argv argument vector. + * + * PUBLIC: #ifndef HAVE_GETOPT + * PUBLIC: int getopt __P((int, char * const *, const char *)); + * PUBLIC: #endif + */ +int +getopt(nargc, nargv, ostr) + int nargc; + char * const *nargv; + const char *ostr; +{ + static char *progname; + static char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ + + /* + * VxWorks needs to be able to repeatedly call getopt from multiple + * programs within its global name space. + */ + if (__dbsql_getopt_reset) { + __dbsql_getopt_reset = 0; + + opterr = optind = 1; + optopt = optreset = 0; + optarg = NULL; + progname = NULL; + place = EMSG; + } + if (!progname) { + if ((progname = __os_rpath(*nargv)) == NULL) + progname = *nargv; + else + ++progname; + } + + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return (EOF); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return (EOF); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = strchr(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means EOF. + */ + if (optopt == (int)'-') + return (EOF); + if (!*place) + ++optind; + if (opterr && *ostr != ':') + (void)fprintf(stderr, + "%s: illegal option -- %c\n", progname, optopt); + return (BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (*ostr == ':') + return (BADARG); + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + progname, optopt); + return (BADCH); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return (optopt); /* dump back option letter */ +} diff --git a/src/clib/memcmp.c b/src/clib/memcmp.c new file mode 100644 index 0000000..45fbf70 --- /dev/null +++ b/src/clib/memcmp.c @@ -0,0 +1,128 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: memcmp.c 7 2007-02-03 13:34:17Z gburd $ + */ +/* + * Copyright (c) 1990-2004 + * Sleepycat Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Redistributions in any form must be accompanied by information on + * how to obtain complete source code for the DB software and any + * accompanying software that uses the DB software. The source code + * must either be included in the distribution or be available for no + * more than the cost of distribution plus a nominal fee, and must be + * freely redistributable under reasonable conditions. For an + * executable file, complete source code means the source code for all + * modules it contains. It does not include source code for modules or + * files that typically accompany the major components of the operating + * system on which the executable file runs. + * + * THIS SOFTWARE IS PROVIDED BY ORACLE CORPORATION ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + * NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL ORACLE CORPORATION + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * Copyright (c) 1990, 1993, 1994, 1995 + *The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * Copyright (c) 1995, 1996 + *The President and Fellows of Harvard University. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions + */ + +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +/* + * memcmp -- + * + * PUBLIC: #ifndef HAVE_MEMCMP + * PUBLIC: int memcmp __P((const void *, const void *, size_t)); + * PUBLIC: #endif + */ +#ifndef HAVE_MEMCMP +int +memcmp(s1, s2, n) + char *s1, *s2; + size_t n; +{ + if (n != 0) { + unsigned char *p1 = (unsigned char *)s1, + *p2 = (unsigned char *)s2; + do { + if (*p1++ != *p2++) + return (*--p1 - *--p2); + } while (--n != 0); + } + return (0); +} +#endif diff --git a/src/clib/random.c b/src/clib/random.c new file mode 100644 index 0000000..0e7dedb --- /dev/null +++ b/src/clib/random.c @@ -0,0 +1,241 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + */ +/* + * Copyright (c) 1990-2004 + * Sleepycat Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Redistributions in any form must be accompanied by information on + * how to obtain complete source code for the DB software and any + * accompanying software that uses the DB software. The source code + * must either be included in the distribution or be available for no + * more than the cost of distribution plus a nominal fee, and must be + * freely redistributable under reasonable conditions. For an + * executable file, complete source code means the source code for all + * modules it contains. It does not include source code for modules or + * files that typically accompany the major components of the operating + * system on which the executable file runs. + * + * THIS SOFTWARE IS PROVIDED BY ORACLE CORPORATION ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + * NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL ORACLE CORPORATION + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * Copyright (c) 1990, 1993, 1994, 1995 + *The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * Copyright (c) 1995, 1996 + *The President and Fellows of Harvard University. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions + */ + +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "dbsql_int.h" + +#define SEED_SZ 256 + +/* + * __rng_seed -- + * Produce a sutable seed for our random number generator. In + * this case that means using the current time. The seed is + * written to a char[SEED_SZ] buffer passed by the caller. + * Note that when testing its useful to generate the same pattern + * of random numbers. We accomplish that by initializing the contents + * of 'buf' to '\0' when CONFIG_TEST is defined. In this way, tests + * are repeatable. + */ +#ifndef HAVE_SRAND48_R +void +__rng_seed(buf) + char *buf; +{ + u_int32_t pid; + double jt; + u_int32_t i; + + memset(buf, 0, SEED_SZ); +#ifdef CONFIG_TEST + return; +#else + __os_pid(&pid); + __os_jtime(&jt); + for (i = 0; i < SEED_SZ; i++) { + if (i % 2) + buf[i] = (char)(pid & 0xf); + else + buf[i] = (char)((u_int32_t)jt & 0xf); + } + return; +#endif +} +#endif + +/* + * srand48_r -- + * Seed the random number generator before use. + * + * PUBLIC: #ifndef HAVE_SRAND48_R + * PUBLIC: int srand48_r __P((struct drand48_data *)); + * PUBLIC: #endif + */ +#ifndef HAVE_SRAND48_R +int +srand48_r(seedval, buffer) + struct drand48_data *buffer; +{ + int i; + char k[SEED_SZ]; + buffer->j = 0; + buffer->i = 0; + __rng_seed(k); + for(i = 0; i < 256; i++) { + buffer->s[i] = i; + } + for(i = 0; i < 256; i++) { + int t; + buffer->j = (buffer->j + buffer->s[i] + k[i]) & 0xff; + t = buffer->s[buffer->j]; + buffer->s[buffer->j] = buffer->s[i]; + buffer->s[i] = t; + } + buffer->init_p = 1; +} +#endif + +/* + * lrand48_r -- + * A re-entrant version of a random number generator. This + * random number generator is based on the RC4 algorithm. + * + * STATIC: #ifndef HAVE_LRAND48_R + * STATIC: int lrand48_r __P((struct drand48_data *, double *)); + * STATIC: #endif + */ +#ifndef HAVE_LRAND48_R +static int +lrand48_r(buffer, result) + struct drand48_data *buffer; + double *result; +{ + /* TODO: am I sure there isn't a race in here? */ + int t; + buffer->i = (buffer->i + 1) & 0xff; + buffer->j = (buffer->j + buffer->s[buffer->i]) & 0xff; + t = buffer->s[buffer->i]; + buffer->s[buffer->i] = buffer->s[buffer->j]; + buffer->s[buffer->j] = t; + t = buffer->s[buffer->i] + buffer->s[buffer->j]; + *result = buffer->s[t & 0xff]; + return 0; +} +#endif + +/* + * rand8_r -- + * + * PUBLIC: int rand8_r __P((struct drand48_data *, u_int8_t *)); + */ +int +rand8_r(buffer, result) + struct drand48_data *buffer; + u_int8_t *result; +{ + long int i; + int rc = lrand48_r(buffer, &i); + *result = i & 0xf; + return 0; +} + +/* + * rand32_r -- + * + * PUBLIC: int rand32_r __P((struct drand48_data *, u_int32_t *)); + */ +int +rand32_r(buffer, result) + struct drand48_data *buffer; + u_int32_t *result; +{ + int rc, i; + long int r, s; + rc = lrand48_r(buffer, &r); + for(i = 1; i < 4; i++) { + rc = lrand48_r(buffer, &s); + r = (r << 8) + s; + } + *result = r; + return rc; +} + diff --git a/src/clib/snprintf.c b/src/clib/snprintf.c new file mode 100644 index 0000000..b13c0ce --- /dev/null +++ b/src/clib/snprintf.c @@ -0,0 +1,159 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + */ +/* + * Copyright (c) 1990-2004 + * Sleepycat Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Redistributions in any form must be accompanied by information on + * how to obtain complete source code for the DB software and any + * accompanying software that uses the DB software. The source code + * must either be included in the distribution or be available for no + * more than the cost of distribution plus a nominal fee, and must be + * freely redistributable under reasonable conditions. For an + * executable file, complete source code means the source code for all + * modules it contains. It does not include source code for modules or + * files that typically accompany the major components of the operating + * system on which the executable file runs. + * + * THIS SOFTWARE IS PROVIDED BY ORACLE CORPORATION ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + * NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL ORACLE CORPORATION + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * Copyright (c) 1990, 1993, 1994, 1995 + *The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * Copyright (c) 1995, 1996 + *The President and Fellows of Harvard University. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions + */ + +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "dbsql_int.h" + +/* + * snprintf -- + * Bounded version of sprintf. + * + * PUBLIC: #ifndef HAVE_SNPRINTF + * PUBLIC: int snprintf __P((char *, size_t, const char *, ...)); + * PUBLIC: #endif + */ +#ifndef HAVE_SNPRINTF +int +#ifdef STDC_HEADERS +snprintf(char *str, size_t n, const char *fmt, ...) +#else +snprintf(str, n, fmt, va_alist) + char *str; + size_t n; + const char *fmt; + va_dcl +#endif +{ + static int ret_charpnt = -1; + va_list ap; + int len; + + COMPQUIET(n, 0); + + /* + * Some old versions of sprintf return a pointer to the first argument + * instead of a character count. Assume the return value of snprintf, + * vsprintf, etc. will be the same as sprintf, and check the easy one. + * + * We do this test at run-time because it's not a test we can do in a + * cross-compilation environment. + */ + if (ret_charpnt == -1) { + char buf[10]; + + ret_charpnt = + (int)sprintf(buf, "123") != 3 || + (int)sprintf(buf, "123456789") != 9 || + (int)sprintf(buf, "1234") != 4; + } + +#ifdef STDC_HEADERS + va_start(ap, fmt); +#else + va_start(ap); +#endif + len = vsprintf(str, fmt, ap); + va_end(ap); + return (ret_charpnt ? (int)strlen(str) : len); +} +#endif diff --git a/src/clib/strcasecmp.c b/src/clib/strcasecmp.c new file mode 100644 index 0000000..b8262a8 --- /dev/null +++ b/src/clib/strcasecmp.c @@ -0,0 +1,155 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + */ +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: strcasecmp.c 7 2007-02-03 13:34:17Z gburd $ + */ + +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +/* + * This array is designed for mapping upper and lower case letter + * together for a case independent comparison. The mappings are + * based upon ascii character sequences. + */ +static const unsigned char charmap[] = { + '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', + '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', + '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', + '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', + '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', + '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', + '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', + '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', + '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', + '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', + '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', + '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', + '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', + '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', + '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', + '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', + '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', + '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', + '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', + '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', + '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', + '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', + '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', + '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', + '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', + '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' +}; + +/* + * strcasecmp -- + * Do strcmp(3) in a case-insensitive manner. + * + * PUBLIC: #ifndef HAVE_STRCASECMP + * PUBLIC: int strcasecmp __P((const char *, const char *)); + * PUBLIC: #endif + */ +#ifndef HAVE_STRCASECMP +int +strcasecmp(s1, s2) + const char *s1, *s2; +{ + register const unsigned char *cm = charmap, + *us1 = (const unsigned char *)s1, + *us2 = (const unsigned char *)s2; + + while (cm[*us1] == cm[*us2++]) + if (*us1++ == '\0') + return (0); + return (cm[*us1] - cm[*--us2]); +} +#endif + +/* + * strncasecmp -- + * Do strncmp(3) in a case-insensitive manner. + * + * PUBLIC: #ifndef HAVE_STRNCASECMP + * PUBLIC: int strncasecmp __P((const char *, const char *, size_t)); + * PUBLIC: #endif + */ +#ifndef HAVE_STRNCASECMP +int +strncasecmp(s1, s2, n) + const char *s1, *s2; + register size_t n; +{ + if (n != 0) { + register const unsigned char *cm = charmap, + *us1 = (const unsigned char *)s1, + *us2 = (const unsigned char *)s2; + + do { + if (cm[*us1] != cm[*us2++]) + return (cm[*us1] - cm[*--us2]); + if (*us1++ == '\0') + break; + } while (--n != 0); + } + return (0); +} +#endif diff --git a/src/clib/strdup.c b/src/clib/strdup.c new file mode 100644 index 0000000..ae00cfa --- /dev/null +++ b/src/clib/strdup.c @@ -0,0 +1,112 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + */ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: strdup.c 7 2007-02-03 13:34:17Z gburd $ + */ + +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +/* + * strdup -- + * + * PUBLIC: #ifndef HAVE_STRDUP + * PUBLIC: char *strdup __P((const char *)); + * PUBLIC: #endif + */ +#ifndef HAVE_STRDUP +char * +strdup(str) + const char *str; +{ + size_t len; + char *copy; + + len = strlen(str) + 1; + if (!(copy = malloc((u_int)len))) + return (NULL); + memcpy(copy, str, len); + return (copy); +} +#endif + +/* + * strndup -- + * + * PUBLIC: #ifndef HAVE_STRNDUP + * PUBLIC: char *strndup __P((const char *, size_t)); + * PUBLIC: #endif + */ +#ifndef HAVE_STRNDUP +char * +strndup(str, len) + const char *str; + size_t len; +{ + char *copy; + + if (len > strlen(str)) + len = strlen(str); + if (!(copy = malloc((u_int)len + 1))) + return (NULL); + memcpy(copy, str, len + 1); + return (copy); +} +#endif diff --git a/src/clib/xvprintf.c b/src/clib/xvprintf.c new file mode 100644 index 0000000..a88cfa7 --- /dev/null +++ b/src/clib/xvprintf.c @@ -0,0 +1,845 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: xvprintf.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * The following is an printf with some extra features (as well as some + * missing features). A few extensions to the formatting notation are + * supported: + * * The "=" flag (similar to "-") causes the output to be + * be centered in the appropriately sized field. + * + * * The %b field outputs an integer in binary notation. + * + * * The %c field now accepts a precision. The character output + * is repeated by the number of times the precision specifies. + * + * * The %' field works like %c, but takes as its character the + * next character of the format string, instead of the next + * argument. For example, printf("%.78'-") prints 78 minus + * signs, the same as printf("%.78c",'-'). + * + * When compiled using GCC on a SPARC, this version of printf is + * faster than the library printf for SUN OS 4.1. Also, all functions + * are fully reentrant. + * + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +/* + * Conversion types fall into various categories as defined by the + * following enumeration. + */ +#define etRADIX 1 /* Integer types. %d, %x, %o, and so forth */ +#define etFLOAT 2 /* Floating point. %f */ +#define etEXP 3 /* Exponentional notation. %e and %E */ +#define etGENERIC 4 /* Floating or exponential, depending on exponent. %g*/ +#define etSIZE 5 /* Return number of characters processed so far. %n */ +#define etSTRING 6 /* Strings. %s */ +#define etDYNSTRING 7 /* Dynamically allocated strings. %z */ +#define etPERCENT 8 /* Percent symbol. %% */ +#define etCHARX 9 /* Characters. %c */ +#define etERROR 10 /* Used to indicate no such conversion type */ +/* The rest are extensions, not normally found in printf() */ +#define etCHARLIT 11 /* Literal characters. %' */ +#define etSQLESCAPE 12 /* Strings with '\'' doubled. %q */ +#define etSQLESCAPE2 13 /* Strings with '\'' doubled and enclosed in '', + NULL pointers replaced by SQL NULL. %Q */ + +/* + * Each builtin conversion character (ex: the 'd' in "%d") is described + * by an instance of the following structure + */ +typedef struct et_info { + char fmttype; /* The format field code letter */ + u_int8_t base; /* The base for radix conversion */ + u_int8_t flags; /* One or more of FLAG_ constants below */ +#define FLAG_SIGNED 1 /* True if the value to convert is signed */ +#define FLAG_INTERN 2 /* True if for internal use only */ + u_int8_t type; /* Conversion paradigm */ + char *charset; /* The character set for conversion */ + char *prefix; /* Prefix on non-zero values in alt format */ +} et_info_t; + +/* + * The following table is searched linearly, so it is good to put the + * most frequently used conversion types first. + */ +static et_info_t fmtinfo[] = { + { 'd', 10, 1, etRADIX, "0123456789", 0 }, + { 's', 0, 0, etSTRING, 0, 0 }, + { 'z', 0, 2, etDYNSTRING, 0, 0 }, + { 'q', 0, 0, etSQLESCAPE, 0, 0 }, + { 'Q', 0, 0, etSQLESCAPE2, 0, 0 }, + { 'c', 0, 0, etCHARX, 0, 0 }, + { 'o', 8, 0, etRADIX, "01234567", "0" }, + { 'u', 10, 0, etRADIX, "0123456789", 0 }, + { 'x', 16, 0, etRADIX, "0123456789abcdef", "x0" }, + { 'X', 16, 0, etRADIX, "0123456789ABCDEF", "X0" }, + { 'f', 0, 1, etFLOAT, 0, 0 }, + { 'e', 0, 1, etEXP, "e", 0 }, + { 'E', 0, 1, etEXP, "E", 0 }, + { 'g', 0, 1, etGENERIC, "e", 0 }, + { 'G', 0, 1, etGENERIC, "E", 0 }, + { 'i', 10, 1, etRADIX, "0123456789", 0 }, + { 'n', 0, 0, etSIZE, 0, 0 }, + { '%', 0, 0, etPERCENT, 0, 0 }, + { 'p', 10, 0, etRADIX, "0123456789", 0 }, +}; +#define etNINFO (sizeof(fmtinfo) / sizeof(fmtinfo[0])) + +/* + * If NOFLOATINGPOINT is defined, then none of the floating point + * conversions will work. + */ +#ifndef etNOFLOATINGPOINT +/* + * et_get_digit -- + * "*val" is a double such that 0.1 <= *val < 10.0 + * Return the ascii code for the leading digit of *val, then + * multiply "*val" by 10.0 to renormalize. + * + * Example: + * input: *val = 3.14159 + * output: *val = 1.4159 function return = '3' + * + * The counter *cnt is incremented each time. After counter exceeds + * 16 (the number of significant digits in a 64-bit float) '0' is + * always returned. + */ +static int +et_getdigit(val, cnt) + long_double_t *val; + int *cnt; +{ + int digit; + long_double_t d; + if ((*cnt)++ >= 16 ) + return '0'; + digit = (int)*val; + d = digit; + digit += '0'; + *val = (*val - d) * 10.0; + return digit; +} +#endif + +#define etBUFSIZE 1024 /* Size of the output buffer */ + +/* + * __et_printf -- + * The root printf-like program used by all variations implemented herein. + * + * INPUTS: + * func This is a pointer to a function taking three arguments + * 1. A pointer to anything. Same as the "arg" parameter. + * 2. A pointer to the list of characters to be output + * (Note, this list is NOT null terminated.) + * 3. An integer number of characters to be output. + * (Note: This number might be zero.) + * + * arg This is the pointer to anything which will be passed as the + * first argument to "func". Use it for whatever you like. + * + * fmt This is the format string, as in the usual print. + * + * ap This is a pointer to a list of arguments. Same as in + * vfprint. + * + * OUTPUTS: + * The return value is the total number of characters sent to + * the function "func". Returns -1 on a error. + * + * NOTE: The order in which automatic variables are declared below + * seems to make a big difference in determining how fast this function + * runs. + */ +static int +__et_printf(dbp, func, arg, fmt, ap) + DBSQL *dbp; + void (*func)(void*,char*,int); + void *arg; + const char *fmt; + va_list ap; +{ + int c; /* Next character in the format string */ + char *bufpt; /* Pointer to the conversion buffer */ + int precision; /* Precision of the current field */ + int length; /* Length of the field */ + int idx; /* A general purpose loop counter */ + int count; /* Total number of characters output */ + int width; /* Width of the current field */ + u_int8_t flag_leftjustify; /* True if "-" flag is present */ + u_int8_t flag_plussign; /* True if "+" flag is present */ + u_int8_t flag_blanksign; /* True if " " flag is present */ + u_int8_t flag_alternateform; /* True if "#" flag is present */ + u_int8_t flag_zeropad; /* True if field width constant starts + with zero */ + u_int8_t flag_long; /* True if "l" flag is present */ + unsigned long longvalue; /* Value for integer types */ + long_double_t realvalue; /* Value for real types */ + et_info_t *infop; /* Pointer to the appropriate info + structure */ + char buf[etBUFSIZE]; /* Conversion buffer */ + char prefix; /* Prefix character. "+" or "-" or " " or + '\0'. */ + u_int8_t errorflag = 0; /* True if an error is encountered */ + u_int8_t xtype; /* Conversion paradigm */ + char *extra; /* Extra memory used for etTCLESCAPE + conversions */ + static char spaces[] = + " " + " "; +#define etSPACESIZE (sizeof(spaces)-1) +#ifndef etNOFLOATINGPOINT + int exp; /* exponent of real numbers */ + double rounder; /* Used for rounding floating point values*/ + u_int8_t flag_dp; /* True if decimal point should be shown */ + u_int8_t flag_rtz; /* True if trailing zeros should be + removed */ + u_int8_t flag_exp; /* True to force display of the exponent */ + int nsd; /* Number of significant digits returned */ +#endif + + count = length = 0; + bufpt = 0; + for(; (c = (*fmt)) != 0; ++fmt) { + if (c != '%') { + int amt; + bufpt = (char *)fmt; + amt = 1; + while((c = (*++fmt)) != '%' && c != 0) + amt++; + (*func)(arg, bufpt, amt); + count += amt; + if (c == 0) + break; + } + if ((c = (*++fmt)) == 0) { + errorflag = 1; + (*func)(arg, "%", 1); + count++; + break; + } + /* Find out what flags are present. */ + flag_leftjustify = flag_plussign = flag_blanksign = + flag_alternateform = flag_zeropad = 0; + do { + switch(c) { + case '-': flag_leftjustify = 1; c = 0; break; + case '+': flag_plussign = 1; c = 0; break; + case ' ': flag_blanksign = 1; c = 0; break; + case '#': flag_alternateform = 1; c = 0; break; + case '0': flag_zeropad = 1; c = 0; break; + default: break; + } + } while(c == 0 && (c = (*++fmt)) != 0); + /* Get the field width. */ + width = 0; + if (c == '*') { + width = va_arg(ap, int); + if (width < 0) { + flag_leftjustify = 1; + width = -width; + } + c = *++fmt; + } else { + while(c >= '0' && c <= '9') { + width = (width * 10) + c - '0'; + c = *++fmt; + } + } + if (width > etBUFSIZE - 10) { + width = etBUFSIZE - 10; + } + /* Get the precision. */ + if (c == '.') { + precision = 0; + c = *++fmt; + if (c == '*') { + precision = va_arg(ap,int); +#ifndef etCOMPATIBILITY + /* This is sensible, but SUN OS 4.1 doesn't + do it. */ + if (precision < 0) + precision = -precision; +#endif + c = *++fmt; + } else { + while(c >= '0' && c <= '9') { + precision = (precision * 10) + c - '0'; + c = *++fmt; + } + } + /* + * Limit the precision to prevent overflowing buf[] + * during conversion + */ + if (precision > etBUFSIZE - 40) + precision = etBUFSIZE - 40; + } else { + precision = -1; + } + /* Get the conversion type modifier. */ + if (c == 'l') { + flag_long = 1; + c = *++fmt; + } else { + flag_long = 0; + } + /* Fetch the info entry for the field. */ + infop = 0; + xtype = etERROR; + for(idx = 0; idx < etNINFO; idx++) { + if (c == fmtinfo[idx].fmttype) { + infop = &fmtinfo[idx]; + xtype = infop->type; + break; + } + } + extra = 0; + + /* + * At this point, variables are initialized as follows: + * + * flag_alternateform TRUE if a '#' is present. + * flag_plussign TRUE if a '+' is present. + * flag_leftjustify TRUE if a '-' is present or + * if the field width was + * negative. + * flag_zeropad TRUE if the width began + * with 0. + * flag_long TRUE if the letter 'l' (ell) + * prefixed the conversion + * character. + * flag_blanksign TRUE if a ' ' is present. + * width The specified field width. + * This is always non-negative. + * Zero is the default. + * precision The specified precision. The + * default is -1. + * xtype The class of the conversion. + * infop Pointer to the appropriate + * info struct. + */ + switch(xtype) { + case etRADIX: + if (flag_long) { + longvalue = va_arg(ap, long); + } else{ + longvalue = va_arg(ap, int); + } +#ifdef etCOMPATIBILITY + /* + * For the format %#x, the value zero is printed "0" + * not "0x0". I think this is stupid. + */ + if (longvalue == 0) + flag_alternateform = 0; +#else + /* + * More sensible: turn off the prefix for octal + * (to prevent "00"), but leave the prefix for hex. + */ + if (longvalue == 0 && infop->base == 8) + flag_alternateform = 0; +#endif + if (infop->flags & FLAG_SIGNED) { + if (*(long *)&longvalue < 0) { + longvalue = -*(long *)&longvalue; + prefix = '-'; + } else if (flag_plussign) { + prefix = '+'; + } else if (flag_blanksign) { + prefix = ' '; + } else { + prefix = 0; + } + } else { + prefix = 0; + } + if (flag_zeropad && precision < width - (prefix != 0)){ + precision = width - (prefix != 0); + } + bufpt = &buf[etBUFSIZE]; + { + register char *cset; + register int base; + cset = infop->charset; + base = infop->base; + do { /* Convert to ascii */ + *(--bufpt) = cset[longvalue % base]; + longvalue = longvalue / base; + } while(longvalue > 0); + } + length = &buf[etBUFSIZE] - bufpt; + for(idx = precision - length; idx > 0; idx--) { + *(--bufpt) = '0'; /* Zero pad */ + } + if (prefix) + *(--bufpt) = prefix; /* Add sign */ + if (flag_alternateform && infop->prefix) { + /* Add "0" or "0x" */ + char *pre, x; + pre = infop->prefix; + if (*bufpt != pre[0]) { + for(pre = infop->prefix; + (x = (*pre)) != 0; pre++) { + *(--bufpt) = x; + } + } + } + length = &buf[etBUFSIZE] - bufpt; + break; + case etFLOAT: + case etEXP: + case etGENERIC: + realvalue = va_arg(ap, double); +#ifndef etNOFLOATINGPOINT + if (precision < 0) + precision = 6; /* Set default precision */ + if (precision > etBUFSIZE - 10) + precision = etBUFSIZE - 10; + if (realvalue < 0.0) { + realvalue = -realvalue; + prefix = '-'; + } else { + if (flag_plussign) + prefix = '+'; + else if (flag_blanksign) + prefix = ' '; + else + prefix = 0; + } + if (infop->type == etGENERIC && precision > 0) + precision--; + rounder = 0.0; +#ifdef COMPATIBILITY + /* + * Rounding works like BSD when the constant 0.4999 is + * used. Wierd! + */ + for(idx = precision, rounder = 0.4999; idx > 0; + idx--, rounder *= 0.1); +#else + /* + * It makes more sense to use 0.5 + */ + for(idx = precision, rounder = 0.5; idx > 0; + idx--, rounder *= 0.1); +#endif + if (infop->type == etFLOAT) + realvalue += rounder; + /* + * Normalize realvalue to within + * 10.0 > realvalue >= 1.0 + */ + exp = 0; + if (realvalue > 0.0) { + int k = 0; + while(realvalue >= 1e8 && k++ < 100) { + realvalue *= 1e-8; + exp+=8; + } + while(realvalue >= 10.0 && k++ < 100) { + realvalue *= 0.1; + exp++; + } + while(realvalue < 1e-8 && k++ < 100) { + realvalue *= 1e8; + exp-=8; + } + while(realvalue < 1.0 && k++ < 100) { + realvalue *= 10.0; + exp--; + } + if (k >= 100) { + bufpt = "NaN"; + length = 3; + break; + } + } + bufpt = buf; + /* + * If the field type is etGENERIC, then convert to + * either etEXP or etFLOAT, as appropriate. + */ + flag_exp = (xtype == etEXP); + if (xtype != etFLOAT) { + realvalue += rounder; + if (realvalue >= 10.0) { + realvalue *= 0.1; + exp++; + } + } + if (xtype == etGENERIC) { + flag_rtz = !flag_alternateform; + if (exp<-4 || exp > precision) { + xtype = etEXP; + } else { + precision = precision - exp; + xtype = etFLOAT; + } + } else { + flag_rtz = 0; + } + /* + * The "exp+precision" test causes output to be of + * type etEXP if the precision is too large to fit + * in buf[]. + */ + nsd = 0; + if (xtype == etFLOAT && + exp + precision < etBUFSIZE - 30) { + flag_dp =(precision > 0 || flag_alternateform); + if (prefix) { + *(bufpt++) = prefix; /* Sign */ + } + if (exp < 0) { + *(bufpt++) = '0'; /* Digits before + "." */ + } else { + for(; exp >= 0; exp--) { + *(bufpt++) = + et_getdigit(&realvalue, + &nsd); + } + } + if (flag_dp) { + *(bufpt++) = '.';/* The decimal point*/ + } + for(exp++; exp < 0 && precision > 0; + precision--, exp++) { + *(bufpt++) = '0'; + } + while((precision--) > 0) { + *(bufpt++) = et_getdigit(&realvalue, + &nsd); + } + *(bufpt--) = 0; /* Null terminate */ + if (flag_rtz && flag_dp) { + /* Remove trailing zeros and "." */ + while( bufpt >= buf && *bufpt == '0') { + *(bufpt--) = 0; + } + if (bufpt >= buf && *bufpt == '.' ) { + *(bufpt--) = 0; + } + } + bufpt++; /* point to next free slot */ + } else { /* etEXP or etGENERIC */ + flag_dp = (precision>0 || flag_alternateform); + if (prefix) { + *(bufpt++) = prefix; /* Sign */ + } + /* First digit */ + *(bufpt++) = et_getdigit(&realvalue,&nsd); + if (flag_dp) { + *(bufpt++) = '.'; /* Decimal point */ + } + while((precision--) > 0) { + *(bufpt++) = et_getdigit(&realvalue, + &nsd); + } + bufpt--; /* point to last digit */ + if (flag_rtz && flag_dp) { + /* Remove tail zeros */ + while(bufpt >= buf && *bufpt == '0') { + *(bufpt--) = 0; + } + if (bufpt >= buf && *bufpt == '.' ) { + *(bufpt--) = 0; + } + } + bufpt++; /* point to next free slot */ + if (exp || flag_exp) { + *(bufpt++) = infop->charset[0]; + if (exp < 0) { /* sign of exp */ + *(bufpt++) = '-'; + exp = -exp; + } else { + *(bufpt++) = '+'; + } + if (exp >= 100) { + /* 100's digit */ + *(bufpt++) = (exp/100) + '0'; + exp %= 100; + } + /* 10's digit */ + *(bufpt++) = exp/10+'0'; + /* 1's digit */ + *(bufpt++) = exp%10+'0'; + } + } + /* + * The converted number is in buf[] and zero + * terminated. Output it. Note that the number is + * in the usual order, not reversed as with integer + * conversions. + */ + length = bufpt - buf; + bufpt = buf; + + /* + * Special Case: Add leading zeros if the + * flag_zeropad flag is set and we are not left + * justified. + */ + if (flag_zeropad && !flag_leftjustify && + length < width) { + int i; + int nPad = width - length; + for(i = width; i >= nPad; i--) { + bufpt[i] = bufpt[i - nPad]; + } + i = (prefix != 0); + while(nPad--) + bufpt[i++] = '0'; + length = width; + } +#endif + break; + case etSIZE: + *(va_arg(ap,int*)) = count; + length = width = 0; + break; + case etPERCENT: + buf[0] = '%'; + bufpt = buf; + length = 1; + break; + case etCHARLIT: /* FALLTHROUGH */ + case etCHARX: + c = buf[0] = (xtype == etCHARX ? + va_arg(ap, int) : *++fmt); + if (precision >= 0) { + for(idx = 1; idx < precision; idx++) { + buf[idx] = c; + } + length = precision; + } else { + length = 1; + } + bufpt = buf; + break; + case etSTRING: + case etDYNSTRING: + bufpt = va_arg(ap, char*); + if (bufpt == 0) { + bufpt = ""; + } else if (xtype == etDYNSTRING) { + extra = bufpt; + } + length = strlen(bufpt); + if (precision >= 0 && precision < length ) { + length = precision; + } + break; + case etSQLESCAPE: /* FALLTHROUGH */ + case etSQLESCAPE2: + { + int i, j, n, c, isnull; + char *arg = va_arg(ap,char*); + isnull = (arg == 0); + if( isnull ) arg = (xtype == etSQLESCAPE2 ? + "NULL" : "(NULL)"); + for(i = n = 0; (c = arg[i]) != 0; i++) { + if (c == '\'') + n++; + } + n += i + 1 + ((!isnull && xtype == etSQLESCAPE2) ? + 2 : 0); + if (n > etBUFSIZE) { + if (__dbsql_calloc(dbp, 1, n, extra) == ENOMEM) + return -1; + bufpt = extra; + } else { + bufpt = buf; + } + j = 0; + if (!isnull && xtype == etSQLESCAPE2) + bufpt[j++] = '\''; + for(i = 0; (c = arg[i]) != 0; i++) { + bufpt[j++] = c; + if (c == '\'') + bufpt[j++] = c; + } + if (!isnull && xtype == etSQLESCAPE2) + bufpt[j++] = '\''; + bufpt[j] = 0; + length = j; + if (precision >= 0 && precision < length) + length = precision; + } + break; + case etERROR: + buf[0] = '%'; + buf[1] = c; + errorflag = 0; + idx = 1 + (c != 0); + (*func)(arg, "%", idx); + count += idx; + if (c == 0) + fmt--; + break; + } /* End switch over the format type */ + /* + * The text of the conversion is pointed to by "bufpt" and is + * "length" characters long. The field width is "width". Do + * the output. + */ + if (!flag_leftjustify) { + register int nspace; + nspace = width - length; + if (nspace > 0) { + count += nspace; + while(nspace >= etSPACESIZE) { + (*func)(arg, spaces, etSPACESIZE); + nspace -= etSPACESIZE; + } + if (nspace > 0) + (*func)(arg, spaces, nspace); + } + } + if (length > 0) { + (*func)(arg, bufpt, length); + count += length; + } + if (flag_leftjustify) { + register int nspace; + nspace = width - length; + if (nspace > 0) { + count += nspace; + while(nspace >= etSPACESIZE) { + (*func)(arg, spaces, etSPACESIZE); + nspace -= etSPACESIZE; + } + if (nspace > 0) + (*func)(arg, spaces, nspace); + } + } + if (extra) { + if (xtype == etDYNSTRING) { + __dbsql_free(dbp, extra); /* TODO which free? */ + } else { + __dbsql_free(dbp, extra); + } + } + } /* End for loop over the format string */ + return errorflag ? -1 : count; +} + + +/* + * __mout -- + * This function implements the callback from vxprintf. + * This routine add nNewChar characters of text in zNewText to + * the sgMprintf structure pointed to by "arg". + * + * STATIC: static void mout __P((void *, char *, int)); + */ +static void +__mout(arg, zNewText, nNewChar) + void *arg; + char *zNewText; + int nNewChar; +{ + xvprintf_t *pM = (xvprintf_t*)arg; + if (pM->len + nNewChar + 1 > pM->amt) { + pM->amt = pM->len + (nNewChar * 2) + 1; + if (pM->text == pM->base) { + __dbsql_calloc(NULL, 1, pM->amt, &pM->text); + if (pM->text && pM->len) + memcpy(pM->text, pM->base, pM->len); + } else { + + if (__dbsql_realloc(NULL, pM->amt, &pM->text) == ENOMEM) { + __dbsql_free(NULL, pM->text); + pM->len = 0; + pM->amt = 0; + pM->text = 0; + } + } + } + if (pM->text) { + memcpy(&pM->text[pM->len], zNewText, nNewChar); + pM->len += nNewChar; + pM->text[pM->len] = 0; + } +} + +/* + * xvprintf -- + * + * PUBLIC: char *xvprintf __P((DBSQL *, const char *, va_list)); + */ +char * +xvprintf(dbp, fmt, ap) + DBSQL *dbp; + const char *fmt; + va_list ap; +{ + xvprintf_t s; + char *new; + char buf[200]; + + s.len = 0; + s.text = buf; + s.amt = sizeof(buf); + s.base = buf; + __et_printf(dbp, __mout, &s, fmt, ap); + s.text[s.len] = 0; + __dbsql_malloc(dbp, s.len + 1, &new); + if (new) + strcpy(new, s.text); + if (s.text != s.base) + __dbsql_free(dbp, s.text); + return new; +} + +#ifdef CONFIG_TEST +/* + * xprintf -- + * + * PUBLIC: char *xprintf __P((DBSQL *, const char *, ...)); + */ +char * +#ifdef STDC_HEADERS +xprintf(DBSQL *dbp, const char *fmt, ...) +#else +xprintf(dbp, fmt, va_alist) + DBSQL *dbp; + const char *fmt; + va_dcl +#endif +{ + char *result; + va_list ap; + va_start(ap, fmt); + result = xvprintf(dbp, fmt, ap); + va_end(ap); + return result; +} +#endif diff --git a/src/common/dbsql_alloc.c b/src/common/dbsql_alloc.c new file mode 100644 index 0000000..100709c --- /dev/null +++ b/src/common/dbsql_alloc.c @@ -0,0 +1,179 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: dbsql_alloc.c 7 2007-02-03 13:34:17Z gburd $ + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +/* + * __dbsql_umalloc -- + * A malloc(3) function that will use use the _os_umalloc call of DB + * to obtain memory. + * + * PUBLIC: int __dbsql_umalloc __P((DBSQL *, size_t, void *)); + */ +int +__dbsql_umalloc(dbp, size, storep) + DBSQL *dbp; + size_t size; + void *storep; +{ + return (__os_umalloc((dbp ? dbp->dbenv : NULL), size, storep)); +} + +/* + * __dbsql_urealloc -- + * realloc(3) counterpart to __dbsql_umalloc. + * + * PUBLIC: int __dbsql_urealloc __P((DBSQL *, size_t, void *)); + */ +int +__dbsql_urealloc(dbp, size, storep) + DBSQL *dbp; + size_t size; + void *storep; +{ + return (__os_urealloc((dbp ? dbp->dbenv : NULL), size, storep)); +} + +/* + * __dbsql_ufree -- + * free(3) counterpart to __dbsql_umalloc. + * + * PUBLIC: void __dbsql_ufree __P((DBSQL *, void *)); + */ +void +__dbsql_ufree(dbp, ptr) + DBSQL *dbp; + void *ptr; +{ + __os_ufree((dbp ? dbp->dbenv : NULL), ptr); +} + +/* + * __dbsql_strdup -- + * The __dbsql_strdup(3) function for DBSQL. + * + * PUBLIC: int __dbsql_strdup __P((DBSQL *, const char *, void *)); + */ +int +__dbsql_strdup(dbp, str, storep) + DBSQL *dbp; + const char *str; + void *storep; +{ + return (__os_strdup((dbp ? dbp->dbenv : NULL), str, storep)); +} + +/* + * __dbsql_strndup -- + * The __dbsql_strndup(3) function for DBSQL. + * + * PUBLIC: int __dbsql_strndup __P((DBSQL *, const char *, void *, size_t)); + */ +int +__dbsql_strndup(dbp, str, storep, len) + DBSQL *dbp; + const char *str; + void *storep; + size_t len; +{ + size_t size; + int ret; + void *p; + DB_ENV *dbenv = (dbp->dbenv ? NULL : dbp->dbenv); + + *(void **)storep = NULL; + + if (len > strlen(str)) + size = strlen(str); + else + size = len; + if ((ret = __os_calloc(dbenv, 1, size + 1, &p)) != 0) + return (ret); + + memcpy(p, str, size); + + *(void **)storep = p; + return (0); +} + +/* + * __dbsql_calloc -- + * The calloc(3) function for DBSQL. + * + * PUBLIC: int __dbsql_calloc __P((DBSQL *, size_t, size_t, void *)); + */ +int +__dbsql_calloc(dbp, num, size, storep) + DBSQL *dbp; + size_t num, size; + void *storep; +{ + return (__os_calloc((dbp ? dbp->dbenv : NULL), num, size, + storep)); +} + +/* + * __dbsql_malloc -- + * The malloc(3) function for DBSQL. + * + * PUBLIC: int __dbsql_malloc __P((DBSQL *, size_t, void *)); + */ +int +__dbsql_malloc(dbp, size, storep) + DBSQL *dbp; + size_t size; + void *storep; +{ + return (__os_malloc((dbp ? dbp->dbenv : NULL), size, storep)); +} + +/* + * __dbsql_realloc -- + * The realloc(3) function for DBSQL. + * + * PUBLIC: int __dbsql_realloc __P((DBSQL *, size_t, void *)); + */ +int +__dbsql_realloc(dbp, size, storep) + DBSQL *dbp; + size_t size; + void *storep; +{ + return (__os_realloc((dbp ? dbp->dbenv : NULL), size, storep)); +} + +/* + * __dbsql_free -- + * The free(3) function for DBSQL. + * + * PUBLIC: void __dbsql_free __P((DBSQL *, void *)); + */ +void +__dbsql_free(dbp, ptr) + DBSQL *dbp; + void *ptr; +{ + __os_free((dbp ? dbp->dbenv : NULL), ptr); +} diff --git a/src/common/dbsql_atof.c b/src/common/dbsql_atof.c new file mode 100644 index 0000000..6494872 --- /dev/null +++ b/src/common/dbsql_atof.c @@ -0,0 +1,107 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: dbsql_atof.c 7 2007-02-03 13:34:17Z gburd $ + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +/* + * __dbsql_atof -- + * The string z[] is an ascii representation of a real number. + * Convert this string to a double. + * + * This routine assumes that z[] really is a valid number. If it + * is not, the result is undefined. + * + * This routine is used instead of the library atof() function because + * the library atof() might want to use "," as the decimal point instead + * of "." depending on how locale is set. But that would cause problems + * for SQL. So this routine always uses "." regardless of locale. + * + * PUBLIC: double __dbsql_atof __P((const char *)); + */ +double +__dbsql_atof(z) + const char *z; +{ + int sign = 1; + long_double_t v1 = 0.0; + if (*z == '-') { + sign = -1; + z++; + } else if (*z == '+') { + z++; + } + while(isdigit(*z)) { + v1 = v1 * 10.0 + (*z - '0'); + z++; + } + if (*z == '.') { + long_double_t divisor = 1.0; + z++; + while(isdigit(*z)) { + v1 = v1 * 10.0 + (*z - '0'); + divisor *= 10.0; + z++; + } + v1 /= divisor; + } + if (*z == 'e' || *z == 'E') { + int esign = 1; + int eval = 0; + long_double_t scale = 1.0; + z++; + if (*z == '-') { + esign = -1; + z++; + } else if (*z == '+') { + z++; + } + while(isdigit(*z)) { + eval = eval * 10 + *z - '0'; + z++; + } + while(eval >= 64) { + scale *= 1.0e+64; + eval -= 64; + } + while(eval >= 16) { + scale *= 1.0e+16; + eval -= 16; + } + while(eval >= 4) { + scale *= 1.0e+4; + eval -= 4; + } + while(eval >= 1) { + scale *= 1.0e+1; + eval -= 1; + } + if (esign < 0) { + v1 /= scale; + } else { + v1 *= scale; + } + } + return sign < 0 ? -v1 : v1; +} diff --git a/src/common/dbsql_atoi.c b/src/common/dbsql_atoi.c new file mode 100644 index 0000000..cdc3cb5 --- /dev/null +++ b/src/common/dbsql_atoi.c @@ -0,0 +1,56 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: dbsql_atoi.c 7 2007-02-03 13:34:17Z gburd $ + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +/* + * __dbsql_atoi -- + * Return TRUE if 'str' is a 32-bit signed integer and write + * the value of the integer into '*num'. If 'str' is not an integer + * or is an integer that is too large to be expressed with just 32 + * bits, then return false. + * + * PUBLIC: int __dbsql_atoi __P((const char *, int *)); + */ +int +__dbsql_atoi(str, num) + const char *str; + int *num; +{ + int v = 0; + int neg; + int i, c; + if (*str == '-') { + neg = 1; + str++; + } else if (*str == '+') { + neg = 0; + str++; + } else { + neg = 0; + } + for (i = 0; (c = str[i]) >= '0' && c <= '9'; i++) { + v = (v * 10) + c - '0'; + } + *num = neg ? -v : v; + return (c == 0 && i > 0 && + (i < 10 || (i == 10 && memcmp(str,"2147483647", 10) <= 0))); +} diff --git a/src/common/dbsql_err.c b/src/common/dbsql_err.c new file mode 100644 index 0000000..8df791a --- /dev/null +++ b/src/common/dbsql_err.c @@ -0,0 +1,469 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: dbsql_err.c 7 2007-02-03 13:34:17Z gburd $ + */ + +#include "dbsql_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include /* Declare STDERR_FILENO. */ +#endif + +#include "dbsql_int.h" + +#ifdef DIAGNOSTIC +/* + * __dbsql_assert -- + * Error when an assertion fails. Only checked if #DIAGNOSTIC defined. + * + * PUBLIC: #ifdef DIAGNOSTIC + * PUBLIC: void __dbsql_assert __P((const char *, const char *, int)); + * PUBLIC: #endif + */ +void +__dbsql_assert(failedexpr, file, line) + const char *failedexpr, *file; + int line; +{ + (void)fprintf(stderr, + "__dbsql_assert: \"%s\" failed: file \"%s\", line %d\n", + failedexpr, file, line); + (void)fflush(stderr); + + /* We want a stack trace of how this could possibly happen. */ + abort(); + + /* NOTREACHED */ +} +#endif + +/* + * __dbsql_panic_msg -- + * Just report that someone else paniced. + * + * PUBLIC: int __dbsql_panic_msg __P((DBSQL *)); + */ +int +__dbsql_panic_msg(dbp) + DBSQL *dbp; +{ + __dbsql_err(dbp, "PANIC: fatal database error detected; run recovery"); + + if (dbp && dbp->dbsql_paniccall != NULL) + dbp->dbsql_paniccall(dbp, DB_RUNRECOVERY); + + return (DB_RUNRECOVERY); +} + +/* + * __dbsql_panic -- + * Lock out the database due to unrecoverable error. + * + * PUBLIC: int __dbsql_panic __P((DBSQL *, int)); + */ +int +__dbsql_panic(dbp, errval) + DBSQL *dbp; + int errval; +{ + if (dbp != NULL) { + PANIC_SET(dbp, 1); + + __dbsql_err(dbp, "PANIC: %s", dbsql_strerror(errval)); + + if (dbp->dbsql_paniccall != NULL) + dbp->dbsql_paniccall(dbp, errval); + } + +#if defined(DIAGNOSTIC) && !defined(CONFIG_TEST) + /* + * We want a stack trace of how this could possibly happen. + * + * Don't drop core if it's the test suite -- it's reasonable for the + * test suite to check to make sure that DBSQL_RUNRECOVERY is returned + * under certain conditions. + */ + abort(); +#endif + + /* + * Chaos reigns within. + * Reflect, repent, and reboot. + * Order shall return. + */ + return (DBSQL_RUNRECOVERY); +} + +/* + * dbsql_strerror -- + * ANSI C strerror(3) for DBSQL. + * + * EXTERN: char *dbsql_strerror __P((int)); + */ +char * +dbsql_strerror(error) + int error; +{ + char *p; + + if (error == 0) + return ("Successful return: 0"); + if (error > 0) { + if ((p = strerror(error)) != NULL) + return (p); + goto unknown_err; + } + if (error <= -30999 && error >= -30800) { + if ((p = db_strerror(error)) != NULL) + return (p); + goto unknown_err; + } + + /* + * !!! + * The Tcl API requires that some of these return strings be compared + * against strings stored in application scripts. So, any of these + * errors that do not invariably result in a Tcl exception may not be + * altered. + */ + switch (error) { + case DBSQL_ERROR: + return ("DBSQL_ERROR: SQL logic error or missing database"); + case DBSQL_INTERNAL: + return ("DBSQL_INTERNAL: Internal implementation flaw"); + case DBSQL_PERM: + return ("DBSQL_PERM: Access denied due to permissions."); + case DBSQL_ABORT: + return ("DBSQL_ABORT: Callback requested query abort"); + case DBSQL_BUSY: + return ("DBSQL_BUSY: Database is locked"); + case DBSQL_LOCKED: + return ("DBSQL_LOCKED: Database table is locked"); + case DBSQL_NOMEM: + return ("DBSQL_NOMEM: Unable to allocate additional memory."); + case DBSQL_READONLY: + return + ("DBSQL_READONLY: Attempt to write a readonly database"); + case DBSQL_INTERRUPTED: + return ("DBSQL_INTERRUPTED: Interrupted during processing"); + case DBSQL_IOERR: + return ("DBSQL_IOERROR: Disk I/O error"); + case DBSQL_NOTFOUND: + return ("DBSQL_NOTFOUND: Table or record not found"); + case DBSQL_FULL: + return ("DBSQL_FULL: Database is full"); + case DBSQL_CANTOPEN: + return ("DBSQL_CANTOPEN: Unable to open database file"); + case DBSQL_PROTOCOL: + return ("DBSQL_PROTOCOL: Database locking protocol failure"); + case DBSQL_EMPTY: + return ("DBSQL_EMPTY: Table contains no data"); + case DBSQL_SCHEMA: + return ("DBSQL_SCHEMA: Database schema has changed"); + case DBSQL_CONSTRAINT: + return ("DBSQL_CONSTRAINT: Constraint failed"); + case DBSQL_MISMATCH: + return ("DBSQL_MISMATCH: Datatype mismatch"); + case DBSQL_MISUSE: + return + ("DBSQL_MISUSE: Library routine called out of sequence"); + case DBSQL_AUTH: + return ("DBSQL_AUTH: Authorization denied"); + case DBSQL_FORMAT: + return ("DBSQL_FORMAT: Auxiliary database format error"); + case DBSQL_RANGE: + return ("DBSQL_RANGE: Bind index out of range"); + case DBSQL_CORRUPT: + return ("DBSQL_CORRUPT: Data record is malformed"); + case DBSQL_RUNRECOVERY: + return ( + "DBSQL_RUNRECOVERY: Shutdown and run recovery on the database environment."); + case DBSQL_INVALID_NAME: + return ( + "DBSQL_INVALID_NAME: Empty or invalid file name supplied"); + } + +unknown_err: { + /* + * !!! + * Room for a 64-bit number + slop. This buffer is only used + * if we're given an unknown error, which should never happen. + * Note, however, we're no longer thread-safe if it does. + */ + static char ebuf[40]; + + (void)snprintf(ebuf, sizeof(ebuf), "Unknown error: %d", error); + return (ebuf); + } +} + +/* + * __dbsql_err -- + * Standard DBSQL error routine. The same as errx, except we don't write + * to stderr if no output mechanism was specified. + * + * PUBLIC: void __dbsql_err __P((const DBSQL *, const char *, ...)) + * PUBLIC: __attribute__ ((__format__ (__printf__, 2, 3))); + */ +void +#ifdef STDC_HEADERS +__dbsql_err(const DBSQL *dbp, const char *fmt, ...) +#else +__dbsql_err(dbp, fmt, va_alist) + const DBSQL *dbp; + const char *fmt; + va_dcl +#endif +{ + DBSQL_REAL_ERR(dbp, 0, 0, 0, fmt); +} + +#ifndef HAVE_VSNPRINTF +#define OVERFLOW_ERROR "internal buffer overflow, process aborted\n" +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif +#endif + +/* + * __dbsql_errcall -- + * Do the error message work for callback functions. + * + * PUBLIC: void __dbsql_errcall __P((const DBSQL *, int, int, const char *, + * PUBLIC: va_list)); + */ +void +__dbsql_errcall(dbp, error, error_set, fmt, ap) + const DBSQL *dbp; + int error, error_set; + const char *fmt; + va_list ap; +{ + char *p; + char errbuf[2048]; /* !!!: END OF THE STACK DON'T TRUST SPRINTF. */ + + p = errbuf; + if (fmt != NULL) + p += vsnprintf(errbuf, sizeof(errbuf), fmt, ap); + if (error_set) + p += snprintf(p, + sizeof(errbuf) - (size_t)(p - errbuf), ": %s", + dbsql_strerror(error)); +#ifndef HAVE_VSNPRINTF + /* + * !!! + * We're potentially manipulating strings handed us by the application, + * and on systems without a real snprintf() the sprintf() calls could + * have overflowed the buffer. We can't do anything about it now, but + * we don't want to return control to the application, we might have + * overwritten the stack with a Trojan horse. We're not trying to do + * anything recoverable here because systems without snprintf support + * are pretty rare anymore. + */ + if ((size_t)(p - errbuf) > sizeof(errbuf)) { + write( + STDERR_FILENO, OVERFLOW_ERROR, sizeof(OVERFLOW_ERROR) - 1); + abort(); + /* NOTREACHED */ + } +#endif + dbp->dbsql_errcall(dbp->dbsql_errpfx, errbuf); +} + +/* + * __dbsql_errfile -- + * Do the error message work for FILE *s. + * + * PUBLIC: void __dbsql_errfile + * PUBLIC: __P((const DBSQL *, int, int, const char *, va_list)); + */ +void +__dbsql_errfile(dbp, error, error_set, fmt, ap) + const DBSQL *dbp; + int error, error_set; + const char *fmt; + va_list ap; +{ + FILE *fp; + + fp = dbp == NULL || + dbp->dbsql_errfile == NULL ? stderr : dbp->dbsql_errfile; + + if (dbp != NULL && dbp->dbsql_errpfx != NULL) + (void)fprintf(fp, "%s: ", dbp->dbsql_errpfx); + if (fmt != NULL) { + (void)vfprintf(fp, fmt, ap); + if (error_set) + (void)fprintf(fp, ": "); + } + if (error_set) + (void)fprintf(fp, "%s", dbsql_strerror(error)); + (void)fprintf(fp, "\n"); + (void)fflush(fp); +} + +/* + * __error_msg -- + * Add an error message to pParse->zErrMsg and increment pParse->nErr. + * The following formatting characters are allowed: + * + * %s Insert a string + * %z A string that should be freed after use + * %d Insert an integer + * %T Insert a token + * %S Insert the first element of a SrcList + * + * PUBLIC: void __error_msg __P((parser_t *, const char *, ...)); + */ +void +#ifdef STDC_HEADERS +__error_msg(parser_t *parser, const char *fmt, ...) +#else +__error_msg(parser, fmt, va_alist) + parser_t parser; + const char *fmt; + va_dcl +#endif +{ + va_list ap; + int len; + int i, j; + char *z; + static char null[] = "NULL"; + + parser->nErr++; + len = 1 + strlen(fmt); + va_start(ap, fmt); + for(i = 0; fmt[i]; i++) { + if (fmt[i] != '%' || fmt[i + 1] == 0) + continue; + i++; + switch(fmt[i]) { + case 'd': { + (void)va_arg(ap, int); + len += 20; + break; + } + case 'z': /* FALLTHROUGH */ + case 's': { + char *z2 = va_arg(ap, char*); + if (z2 == 0) + z2 = null; + len += strlen(z2); + break; + } + case 'T': { + token_t *p = va_arg(ap, token_t*); + len += p->n; + break; + } + case 'S': { + src_list_t *p = va_arg(ap, src_list_t*); + int k = va_arg(ap, int); + DBSQL_ASSERT(p->nSrc > k && k >= 0); + len += strlen(p->a[k].zName); + if (p->a[k].zDatabase && p->a[k].zDatabase[0]) { + len += strlen(p->a[k].zDatabase) + 1; + } + break; + } + default: + len++; + break; + } + } + va_end(ap); + __dbsql_calloc(parser->db, 1, len, &z); + if (z == 0) + return; + __dbsql_free(parser->db, parser->zErrMsg); + parser->zErrMsg = z; + va_start(ap, fmt); + for(i = j = 0; fmt[i]; i++) { + if (fmt[i] != '%' || fmt[i + 1] == 0) + continue; + if (i > j) { + memcpy(z, &fmt[j], i - j); + z += i - j; + } + j = i + 2; + i++; + switch(fmt[i]) { + case 'd': { + int x = va_arg(ap, int); + sprintf(z, "%d", x); + z += strlen(z); + break; + } + case 'z': /* FALLTHROUGH */ + case 's': { + int len; + char *z2 = va_arg(ap, char*); + if (z2 == 0) + z2 = null; + len = strlen(z2); + memcpy(z, z2, len); + z += len; + if (fmt[i] == 'z' && z2 != null) { + __dbsql_free(NULL, z2); + } + break; + } + case 'T': { + token_t *p = va_arg(ap, token_t*); + memcpy(z, p->z, p->n); + z += p->n; + break; + } + case 'S': { + int len; + src_list_t *p = va_arg(ap, src_list_t*); + int k = va_arg(ap, int); + assert(p->nSrc > k && k >= 0); + if (p->a[k].zDatabase && p->a[k].zDatabase[0]) { + len = strlen(p->a[k].zDatabase); + memcpy(z, p->a[k].zDatabase, len); + z += len; + *(z++) = '.'; + } + len = strlen(p->a[k].zName); + memcpy(z, p->a[k].zName, len); + z += len; + break; + } + default: + *(z++) = fmt[i]; + break; + } + } + va_end(ap); + if (i > j) { + memcpy(z, &fmt[j], i - j); + z += i - j; + } + DBSQL_ASSERT((z - parser->zErrMsg) < len); + *z = 0; +} diff --git a/src/common/hash.c b/src/common/hash.c new file mode 100644 index 0000000..e0bf87d --- /dev/null +++ b/src/common/hash.c @@ -0,0 +1,592 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: hash.c 7 2007-02-03 13:34:17Z gburd $ + */ +/* + * Copyright (c) 1990-2004 + * Sleepycat Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Redistributions in any form must be accompanied by information on + * how to obtain complete source code for the DB software and any + * accompanying software that uses the DB software. The source code + * must either be included in the distribution or be available for no + * more than the cost of distribution plus a nominal fee, and must be + * freely redistributable under reasonable conditions. For an + * executable file, complete source code means the source code for all + * modules it contains. It does not include source code for modules or + * files that typically accompany the major components of the operating + * system on which the executable file runs. + * + * THIS SOFTWARE IS PROVIDED BY ORACLE CORPORATION ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + * NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL ORACLE CORPORATION + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * Copyright (c) 1990, 1993, 1994, 1995 + *The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * Copyright (c) 1995, 1996 + *The President and Fellows of Harvard University. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions + */ + +/* + * Basic hash-tables. + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +/* + * __hash_init -- + * Turn bulk memory into a hash table object by initializing the + * fields of the hash_t structure. + * + * 'this' is a pointer to the hash table that is to be initialized. + * 'class' is one of the constants DBSQL_HASH_INT, DBSQL_HASH_POINTER, + * DBSQL_HASH_BINARY, or DBSQL_HASH_STRING. The value of 'class' + * determines what kind of key the hash table will use. 'copy_key_p' is + * true if the hash table should make its own private copy of keys and + * false if it should just use the supplied pointer. 'copy_key_p' only + * makes sense for DBSQL_HASH_STRING and DBSQL_HASH_BINARY and is ignored + * for other key classes. + * + * PUBLIC: void __hash_init __P((hash_t *, int, int)); + */ +void +__hash_init(this, class, copy_key_p) + hash_t *this; + int class; + int copy_key_p; +{ + DBSQL_ASSERT(this != 0); + DBSQL_ASSERT(class >= DBSQL_HASH_INT && class <= DBSQL_HASH_BINARY); + this->keyClass = class; + this->copyKey = copy_key_p && + (class==DBSQL_HASH_STRING || class==DBSQL_HASH_BINARY); + this->first = 0; + this->count = 0; + this->htsize = 0; + this->ht = 0; +} + +/* + * __hash_clear -- + * Remove all entries from a hash table. Reclaim all memory. + * Call this routine to delete a hash table or to reset a hash table + * to the empty state. + * + * PUBLIC: void __hash_clear __P((hash_t *)); + */ +void +__hash_clear(this) + hash_t *this; +{ + hash_ele_t *elem; + DBSQL_ASSERT(this != 0); + elem = this->first; + this->first = 0; + if( this->ht ) + __dbsql_free(NULL, this->ht); + this->ht = 0; + this->htsize = 0; + while(elem) { + hash_ele_t *next_elem = elem->next; + if( this->copyKey && elem->pKey ){ + __dbsql_free(NULL, elem->pKey); + } + __dbsql_free(NULL, elem); + elem = next_elem; + } + this->count = 0; +} + +/* + * __int_hash -- + * Hash and comparison functions when the mode is DBSQL_HASH_INT + * + * STATIC: static int __int_hash __P((const void *, int)); + */ +static int +__int_hash(key, len) + const void *key; + int len; +{ + return len ^ (len << 8) ^ (len >> 8); +} + +/* + * __int_cmp -- + * + * STATIC: static int __h_int_cmp __P((const void *, int, const void *, int)); + */ +static int +__h_int_cmp(k1, n1, k2, n2) + const void *k1; + int n1; + const void *k2; + int n2; +{ + return n2 - n1; +} + +/* + * __str_hash -- + * Hash and comparison functions when the mode is DBSQL_HASH_STRING + * + * STATIC: static int __str_hash + */ +static int +__str_hash(key, len) + const void *key; + int len; +{ + return __hash_ignore_case((const char*)key, len); +} + +/* + * __str_cmp -- + * + * STATIC: static int __h_str_cmp __P((const void *, int, const void *, int)); + */ +static int +__h_str_cmp(k1, n1, k2, n2) + const void *k1; + int n1; + const void *k2; + int n2; +{ + if (n1 != n2) + return (n2 - n1); + return strncasecmp((const char*)k1, (const char*)k2, n1); +} + +/* + * __bin_hash -- + * Hash and comparison functions when the mode is DBSQL_HASH_BINARY + * + * STATIC: static int __bin_hash __((const void *, int)); + */ +static int +__bin_hash(key, len) + const void *key; + int len; +{ + int h = 0; + const char *z = (const char *)key; + while(len-- > 0) { + h = (h << 3) ^ h ^ * (z++); + } + return h & 0x7fffffff; +} + +/* + * __bin_cmp -- + * + * STATIC: static int __h_bin_cmp __P((const void *, int, const void *, int)); + */ +static int +__h_bin_cmp(k1, n1, k2, n2) + const void *k1; + int n1; + const void *k2; + int n2; +{ + if (n1 != n2) + return (n2 - n1); + return memcmp(k1, k2, n1); +} + +/* + * __hash_fn -- + * Return a pointer to the appropriate hash function given the key class. + * + * The C syntax in this function definition may be unfamilar to some + * programmers, so we provide the following additional explanation: + * + * The name of the function is '__hash_fn'. The function takes a + * single parameter 'class'. The return value of __hash_fn() + * is a pointer to another function. Specifically, the return value + * of __hash_fn() is a pointer to a function that takes two parameters + * with types "const void*" and "int" and returns an "int". + */ +static int +(*__hash_fn(int class))(const void*, int) +{ + switch(class) { + case DBSQL_HASH_INT: + return &__int_hash; + case DBSQL_HASH_STRING: + return &__str_hash; + case DBSQL_HASH_BINARY: + return &__bin_hash;; + default: + break; + } + return 0; +} + +/* + * __cmp_fn -- + * Return a pointer to the appropriate hash function given the key class. + * + * For help in interpreted the obscure C code in the function definition, + * see the header comment on the previous function. + */ +static int +(*__cmp_fn(int class))(const void*, int, const void*, int) +{ + switch(class) { + case DBSQL_HASH_INT: + return &__h_int_cmp; + case DBSQL_HASH_STRING: + return &__h_str_cmp; + case DBSQL_HASH_BINARY: + return &__h_bin_cmp; + default: + break; + } + return 0; +} + + +/* + * __rehash -- + * Resize the hash table so that it cantains 'new_size' buckets. + * 'new_size' must be a power of 2. The hash table might fail + * to resize if __dbsql_calloc() fails. + * + * STATIC: static void __rehash __P((hash_t *, int)); + */ +static void +__rehash(this, new_size) + hash_t *this; + int new_size; +{ + struct _ht *new_ht; /* The new hash table */ + hash_ele_t *elem, *next_elem; /* For looping over existing elements */ + hash_ele_t *x; /* Element being copied to new hash + table */ + int (*hash)(const void*,int); /* The hash function */ + + DBSQL_ASSERT((new_size & (new_size - 1)) == 0); + if (__dbsql_calloc(NULL, new_size, sizeof(struct _ht), &new_ht) == ENOMEM) + return; + if (this->ht) + __dbsql_free(NULL, this->ht); + this->ht = new_ht; + this->htsize = new_size; + hash = __hash_fn(this->keyClass); + for (elem = this->first, this->first = 0; elem; elem = next_elem) { + int h = (*hash)(elem->pKey, elem->nKey) & (new_size - 1); + next_elem = elem->next; + x = new_ht[h].chain; + if (x) { + elem->next = x; + elem->prev = x->prev; + if (x->prev) + x->prev->next = elem; + else + this->first = elem; + x->prev = elem; + } else { + elem->next = this->first; + if (this->first) + this->first->prev = elem; + elem->prev = 0; + this->first = elem; + } + new_ht[h].chain = elem; + new_ht[h].count++; + } +} + +/* + * __hash_search -- + * This function locates an element in an hash table that matches + * the given key. The hash for this key has already been computed + * and is passed as the 4th parameter. + * + * STATIC: static hash_ele_t * __hash_search __P((const hast_t *, const void *, + * STATIC: int, int)); + * + * this The hash_t to be searched + * key The the object of our search + * len The size of the key + * h The hash value for this key + */ +static hash_ele_t *__hash_search(this, key, len, h) + const hash_t *this; + const void *key; + int len; + int h; +{ + hash_ele_t *elem; + int count; + int (*cmp)(const void*, int, const void*, int); + + if (this->ht) { + elem = this->ht[h].chain; + count = this->ht[h].count; + cmp = __cmp_fn(this->keyClass); + while (count-- && elem) { + if ((*cmp)(elem->pKey, elem->nKey, key, len) == 0) { + return elem; + } + elem = elem->next; + } + } + return 0; +} + +/* + * __hash_remove -- + * Remove a single entry from the hash table given a pointer to that + * element and a hash on the element's key. + * + * STATIC: static void __hash_remove __P((hash_t *, hash_ele_t *, int)); + * + * this The hash_t to be searched + * elem The element to be removed + * h The hash value for this key + */ +static void __hash_remove(this, elem, h) + hash_t *this; + hash_ele_t* elem; + int h; +{ + if (elem->prev) { + elem->prev->next = elem->next; + } else { + this->first = elem->next; + } + if (elem->next) { + elem->next->prev = elem->prev; + } + if (this->ht[h].chain == elem) { + this->ht[h].chain = elem->next; + } + this->ht[h].count--; + if (this->ht[h].count <= 0) { + this->ht[h].chain = 0; + } + if (this->copyKey && elem->pKey) { + __dbsql_free(NULL, elem->pKey); + } + __dbsql_free(NULL, elem); + this->count--; +} + +/* + * __hash_find -- + * Attempt to locate an element of the hash table this with a key + * that matches 'key', 'len'. Return the data for this element if it is + * found, or NULL if there is no match. + * + * PUBLIC: void *__hash_find __P((const hash_t *, const void *, int)); + */ +void *__hash_find(this, key, len) + const hash_t *this; + const void *key; + int len; +{ + int h; + hash_ele_t *elem; + int (*hash)(const void*, int); + + if (this == 0 || this->ht == 0) + return 0; + hash = __hash_fn(this->keyClass); + DBSQL_ASSERT(hash != 0); + h = (*hash)(key, len); + DBSQL_ASSERT((this->htsize & (this->htsize - 1)) == 0); + elem = __hash_search(this, key, len, h & (this->htsize - 1)); + return (elem ? elem->data : 0); +} + +/* + * __hash_insert -- + * Insert an element into the hash table this. The key is 'key', 'len' + * and the data is 'data'. + * + * If no element exists with a matching key, then a new + * element is created. A copy of the key is made if the copy_key_p + * flag is set. NULL is returned. + * + * If another element already exists with the same key, then the + * new data replaces the old data and the old data is returned. + * The key is not copied in this instance. If a __dbsql_malloc fails, + * then the new data is returned and the hash table is unchanged. + * + * If the 'data' parameter to this function is NULL, then the + * element corresponding to 'key' is removed from the hash table. + * + * PUBLIC: void *__hash_insert __P((hash_t *, const void *, int, void *)); + */ +void * +__hash_insert(this, key, len, data) + hash_t *this; + const void *key; + int len; + void *data; +{ + int hraw; /* Raw hash value of the key */ + int h; /* the hash of the key modulo hash table size */ + hash_ele_t *elem; /* Used to loop thru the element list */ + hash_ele_t *new_elem; /* New element added to the pH */ + int (*hash)(const void*,int); /* The hash function */ + + DBSQL_ASSERT(this != 0); + hash = __hash_fn(this->keyClass); + DBSQL_ASSERT(hash != 0); + hraw = (*hash)(key, len); + DBSQL_ASSERT((this->htsize & (this->htsize - 1)) == 0); + h = hraw & (this->htsize - 1); + elem = __hash_search(this, key, len, h); + if (elem) { + void *old_data = elem->data; + if (data == 0) { + __hash_remove(this, elem, h); + } else { + elem->data = data; + } + return old_data; + } + if (data == 0) + return 0; + if (__dbsql_calloc(NULL, 1, sizeof(hash_ele_t), &new_elem) == ENOMEM) + return data; + if (this->copyKey && key != 0) { + if (__dbsql_calloc(NULL, 1, len, &new_elem->pKey) == ENOMEM) { + __dbsql_free(NULL, new_elem); + return data; + } + memcpy((void*)new_elem->pKey, key, len); + } else { + new_elem->pKey = (void*)key; + } + new_elem->nKey = len; + this->count++; + if (this->htsize == 0) + __rehash(this, 8); + if (this->htsize == 0) { + this->count = 0; + __dbsql_free(NULL, new_elem); + return data; + } + if (this->count > this->htsize) { + __rehash(this, this->htsize * 2); + } + DBSQL_ASSERT((this->htsize & (this->htsize - 1)) == 0); + h = hraw & (this->htsize - 1); + elem = this->ht[h].chain; + if (elem) { + new_elem->next = elem; + new_elem->prev = elem->prev; + if (elem->prev) { + elem->prev->next = new_elem; + } else { + this->first = new_elem; + } + elem->prev = new_elem; + } else { + new_elem->next = this->first; + new_elem->prev = 0; + if (this->first) { + this->first->prev = new_elem; + } + this->first = new_elem; + } + this->ht[h].count++; + this->ht[h].chain = new_elem; + new_elem->data = data; + return 0; +} + +/* + * __hash_ignore_case -- + * This function computes a hash on the name of a keyword. + * Case is not significant. + * + * PUBLIC: int __hash_ignore_case __P((const char *, int)); + */ +int +__hash_ignore_case(z, n) + const char *z; + int n; +{ + int h = 0; + if (n <= 0) + n = strlen(z); + while(n > 0) { + h = (h<<3) ^ h ^ __str_upper_to_lower[(unsigned char) * z++]; + n--; + } + return h & 0x7fffffff; +} diff --git a/src/common/str.c b/src/common/str.c new file mode 100644 index 0000000..98a2fb0 --- /dev/null +++ b/src/common/str.c @@ -0,0 +1,892 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: str.c 7 2007-02-03 13:34:17Z gburd $ + */ +/* + * Copyright (c) 1990-2004 + * Sleepycat Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Redistributions in any form must be accompanied by information on + * how to obtain complete source code for the DB software and any + * accompanying software that uses the DB software. The source code + * must either be included in the distribution or be available for no + * more than the cost of distribution plus a nominal fee, and must be + * freely redistributable under reasonable conditions. For an + * executable file, complete source code means the source code for all + * modules it contains. It does not include source code for modules or + * files that typically accompany the major components of the operating + * system on which the executable file runs. + * + * THIS SOFTWARE IS PROVIDED BY ORACLE CORPORATION ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + * NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL ORACLE CORPORATION + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * Copyright (c) 1990, 1993, 1994, 1995 + *The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * Copyright (c) 1995, 1996 + *The President and Fellows of Harvard University. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions + */ + +#include "dbsql_config.h" +#include "dbsql_int.h" + +unsigned char __str_upper_to_lower[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 97, 98, 99,100,101,102,103, + 104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121, + 122, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107, + 108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125, + 126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161, + 162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179, + 180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197, + 198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215, + 216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233, + 234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251, + 252,253,254,255 +}; + +/* + * __str_append -- + * Create a string from the 2nd and subsequent arguments (up + * to the first NULL argument), store the string in memory + * obtained from __dbsql_calloc() and make the pointer indicated + * by the 1st argument point to that string. The 1st argument + * must either be NULL or point to memory obtained from + * __dbsql_calloc(). + * + * PUBLIC: void __str_append __P((char **, const char *, ...)); + */ +void +#ifdef STDC_HEADERS +__str_append(char **result, const char *fmt, ...) +#else +__str_append(result, fmt, va_alist) + char **result; + const char *fmt; + va_dcl +#endif +{ + va_list ap; + size_t len; + const char *tmp; + char *r; + + if (result == 0) + return; + len = strlen(fmt) + 1; + va_start(ap, fmt); + while((tmp = va_arg(ap, const char*)) != NULL) { + len += strlen(tmp); + } + va_end(ap); + __dbsql_free(NULL, *result); + if (__dbsql_calloc(NULL, 1, len, &r) == ENOMEM) + return; + *result = r; + strcpy(r, fmt); + r += strlen(r); + va_start(ap, fmt); + while((tmp = va_arg(ap, const char*)) != NULL) { + strcpy(r, tmp); + r += strlen(r); + } + va_end(ap); +} + +/* + * __str_nappend -- + * Works like __str_append, but each string is now followed by + * a length integer which specifies how much of the source string + * to copy (in bytes). -1 means use the whole string. The 1st + * argument must either be NULL or point to memory obtained from + * __dbsql_calloc(). + * + * PUBLIC: void __str_nappend __P((char **, ...)); + */ +void +#ifdef STDC_HEADERS +__str_nappend(char **result, ...) +#else +__str_nappend(result, va_alist) + char **result; + va_dcl +#endif +{ + va_list ap; + size_t len; + const char *tmp; + char *r; + int n; + + if (result == 0) + return; + len = 0; + va_start(ap, result); + while((tmp = va_arg(ap, const char*)) != NULL) { + n = va_arg(ap, int); + if (n <= 0) + n = strlen(tmp); + len += (size_t)n; + } + va_end(ap); + __dbsql_free(NULL, *result); + if (__dbsql_calloc(NULL, 1, len + 1, &r) == ENOMEM) + return; + *result = r; + va_start(ap, result); + while((tmp = va_arg(ap, const char*)) != NULL) { + n = va_arg(ap, int); + if (n <= 0) + n = strlen(tmp); + strncpy(r, tmp, n); + r += n; + } + *r = 0; + va_end(ap); +} + +/* + * __str_unquote -- + * Convert an SQL-style quoted string into a normal string by removing + * the quote characters. The conversion is done in-place. If the + * input does not begin with a quote character, then this routine + * is a no-op. Quotes can be of the form "'a-b-c'" or the MS-Access style + * brackets around identifers such as: "[a-b-c]". In both cases the + * result is "a-b-c". + * + * PUBLIC: void __str_unquote __P((char *)); + */ +void +__str_unquote(z) + char *z; +{ + int quote; + int i, j; + + if (z == NULL) + return; + quote = z[0]; + switch(quote) { + case '\'': break; + case '"': break; + case '[': quote = ']'; break; + default: return; + } + for(i = 1, j = 0; z[i]; i++) { + if (z[i] == quote) { + if (z[i + 1] == quote) { + z[j++] = quote; + i++; + } else { + z[j++] = 0; + break; + } + } else { + z[j++] = z[i]; + } + } +} + +/* + * __str_urealloc -- + * Make a duplicate of a string into memory obtained from + * __dbsql_umalloc() Free the original string using __dbsql_free(). + * This routine is called on all strings that are passed outside of + * the library. That way clients can free the string using + * __dbsql_ufree() rather than having to call __dbsql_free(). + * + * PUBLIC: int __str_urealloc __P((char **)); + */ +int +__str_urealloc(pz) + char **pz; +{ + int rc = DBSQL_SUCCESS; + char *new; + + if (pz == 0 || *pz == NULL) + return; + + if (__dbsql_umalloc(NULL, strlen(*pz) + 1, &new) == ENOMEM) { + rc = ENOMEM; + __dbsql_free(NULL, *pz); + *pz = 0; + } + strcpy(new, *pz); + __dbsql_free(NULL, *pz); + *pz = new; + return rc; +} + +/* + * __str_is_numeric -- + * Return TRUE if z is a pure numeric string. Return FALSE if the + * string contains any character which is not part of a number. + * An empty string is considered non-numeric. + * + * PUBLIC: int __str_is_numeric __P((const char *)); + */ +int +__str_is_numeric(z) + const char *z; +{ + if (*z == '-' || *z == '+') + z++; + if (!isdigit(*z)) { + return 0; + } + z++; + while(isdigit(*z)) { + z++; + } + if (*z == '.') { + z++; + if (!isdigit(*z)) + return 0; + while(isdigit(*z)) { + z++; + } + } + if (*z == 'e' || *z == 'E') { + z++; + if (*z == '+' || *z == '-') + z++; + if (!isdigit(*z)) + return 0; + while(isdigit(*z)) { + z++; + } + } + return (*z == '\0'); +} + +#ifdef DBSQL_UTF8_ENCODING + +/* + * Convert the UTF-8 character to which z points into a 31-bit + * UCS character. This only works right if z points to a well-formed + * UTF-8 string. + */ +static int __utf8_to_int(const unsigned char *z) { + int c; + static const int init_val[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, +105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, +120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, +135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, +150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, +165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, +180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 0, 1, 2, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 0, 1, 254, +255, +}; + c = init_val[*(z++)]; + while((0xc0 & *z) == 0x80) { + c = (c<<6) | (0x3f & *(z++)); + } + return c; +} + +/* + * X is a pointer to the first byte of a UTF-8 character. Increment + * X so that it points to the next character. This only works right + * if X points to a well-formed UTF-8 string. + */ +#define __next_char(X) while((0xc0 & *++(X)) == 0x80) {} +#define __char_val(X) __utf8_to_int(X) + +#else /* !defined(DBSQL_UTF8_ENCODING) */ +/* + * For iso8859 encoding, the next character is just the next byte. + */ +#define __next_char(X) (++(X)); +#define __char_val(X) ((int)*(X)) + +#endif /* defined(DBSQL_UTF8_ENCODING) */ + +/* + * __str_glob_cmp -- + * Compare two UTF-8 strings for equality where the first string can + * potentially be a "glob" expression. Return true (1) if they + * are the same and false (0) if they are different. + * + * Globbing rules: + * + * '*' Matches any sequence of zero or more characters. + * + * '?' Matches exactly one character. + * + * [...] Matches one character from the enclosed list of + * characters. + * + * [^...] Matches one character not in the enclosed list. + * + * With the [...] and [^...] matching, a ']' character can be included + * in the list by making it the first character after '[' or '^'. A + * range of characters can be specified using '-'. Example: + * "[a-z]" matches any single lower-case letter. To match a '-', make + * it the last character in the list. + * + * This routine is usually quick, but can be N**2 in the worst case. + * + * Hints: to match '*' or '?', put them in "[]". Like this: + * + * abc[*]xyz Matches "abc*xyz" only + * + * PUBLIC: int __str_glob_cmp __P((const unsigned char *, + * PUBLIC: const unsigned char *)); + */ +int +__str_glob_cmp(pattern, string) + const unsigned char *pattern; + const unsigned char *string; +{ + char c; + int invert; + int seen; + char c2; + + while((c = *pattern) != 0) { + switch(c) { + case '*': + while((c = pattern[1]) == '*' || c == '?') { + if (c == '?') { + if (*string == 0) + return 0; + __next_char(string); + } + pattern++; + } + if (c == 0) + return 1; + if (c == '[') { + while(*string && + __str_glob_cmp(&pattern[1], + string) == 0) { + __next_char(string); + } + return (*string != 0); + } else { + while((c2 = *string) != 0) { + while(c2 != 0 && c2 != c) { + c2 = *++string; + } + if (c2 == 0) + return 0; + if (__str_glob_cmp(&pattern[1], + string)) + return 1; + __next_char(string); + } + return 0; + } + case '?': { + if (*string == 0) + return 0; + __next_char(string); + pattern++; + break; + } + case '[': { + int prior_c = 0; + seen = 0; + invert = 0; + c = __char_val(string); + if (c == 0) + return 0; + c2 = *++pattern; + if (c2 == '^') { + invert = 1; + c2 = *++pattern; + } + if (c2 == ']') { + if (c == ']') + seen = 1; + c2 = *++pattern; + } + while((c2 = __char_val(pattern)) != 0 && c2 != ']') { + if (c2 == '-' && pattern[1] != ']' && + pattern[1] != 0 && prior_c > 0) { + pattern++; + c2 = __char_val(pattern); + if (c >= prior_c && c <= c2) + seen = 1; + prior_c = 0; + } else if (c == c2) { + seen = 1; + prior_c = c2; + } else { + prior_c = c2; + } + __next_char(pattern); + } + if (c2 == 0 || (seen ^ invert) == 0) + return 0; + __next_char(string); + pattern++; + break; + } + default: { + if (c != *string ) + return 0; + pattern++; + string++; + break; + } + } + } + return (*string == 0); +} + +/* + * __str_like_cmp -- + * Compare two UTF-8 strings for equality using the "LIKE" operator of + * SQL. The '%' character matches any sequence of 0 or more + * characters and '_' matches any single character. Case is + * not significant. This routine is just an adaptation of the + * __str_glob_cmp() routine above. + * + * PUBLIC: int __str_like_cmp __P((const unsigned char *, + * PUBLIC: const unsigned char *)); + */ +int +__str_like_cmp(pattern, string) + const unsigned char *pattern; + const unsigned char *string; +{ + register int c; + int c2; + + while((c = __str_upper_to_lower[*pattern]) != 0) { + switch(c) { + case '%': { + while((c = pattern[1]) == '%' || c == '_') { + if (c == '_') { + if (*string == 0) + return 0; + __next_char(string); + } + pattern++; + } + if (c == 0) + return 1; + c = __str_upper_to_lower[c]; + while((c2 = __str_upper_to_lower[*string]) != 0) { + while(c2 != 0 && c2 != c) { + c2 = __str_upper_to_lower[*++string]; + } + if (c2 == 0) + return 0; + if (__str_like_cmp(&pattern[1], string)) + return 1; + __next_char(string); + } + return 0; + } + case '_': { + if (*string == 0) + return 0; + __next_char(string); + pattern++; + break; + } + default: { + if (c != __str_upper_to_lower[*string]) + return 0; + pattern++; + string++; + break; + } + } + } + return (*string == 0); +} + +/* + * __str_numeric_cmp -- + * This comparison routine is what we use for comparison operations + * between numeric values in an SQL expression. "Numeric" is a little + * bit misleading here. What we mean is that the strings have a + * type of "numeric" from the point of view of SQL. The strings + * do not necessarily contain numbers. They could contain text. + * + * If the input strings both look like actual numbers then they + * compare in numerical order. Numerical strings are always less + * than non-numeric strings so if one input string looks like a + * number and the other does not, then the one that looks like + * a number is the smaller. Non-numeric strings compare in + * lexigraphical order (the same order as strcmp()). + * + * PUBLIC: int __str_numeric_cmp __P((const char *, const char *)); + */ +int +__str_numeric_cmp(left, right) + const char *left; + const char *right; +{ + int result; + int left_is_num, right_is_num; + + if (left == 0) { + return -1; + } else if (right == 0) { + return 1; + } + left_is_num = __str_is_numeric(left); + right_is_num = __str_is_numeric(right); + if (left_is_num) { + if (!right_is_num) { + result = -1; + } else { + double rl, rr; + rl = __dbsql_atof(left); + rr = __dbsql_atof(right); + if (rl < rr){ + result = -1; + } else if (rl > rr) { + result = +1; + } else { + result = 0; + } + } + } else if (right_is_num) { + result = +1; + } else { + result = strcmp(left, right); + } + return result; +} + +/* + * __str_int_in32b -- + * The string 'num' represents an integer. There might be some other + * information following the integer too, but that part is ignored. + * If the integer that the prefix of 'num' represents will fit in a + * 32-bit signed integer, return TRUE. Otherwise return FALSE. + * + * This routine returns FALSE for the string -2147483648 even though that + * that number will, in theory fit in a 32-bit integer. But positive + * 2147483648 will not fit in 32 bits. So it seems safer to return + * false. + * + * PUBLIC: int __str_int_in32b __P((const char *)); + */ +int +__str_int_in32b(num) + const char *num; +{ + int c, i = 0; + if (*num == '-' || *num == '+') + num++; + while ((c = num[i]) >= '0' && c <= '9') { + i++; + } + return (i < 10 || (i == 10 && memcmp(num, "2147483647", 10) <= 0)); +} + +/* + * Some powers of 64. These constants are needed in the + * __str_real_as_sortable() routine below. + */ +#define _64e3 (64.0 * 64.0 * 64.0) +#define _64e4 (64.0 * 64.0 * 64.0 * 64.0) +#define _64e15 (_64e3 * _64e4 * _64e4 * _64e4) +#define _64e16 (_64e4 * _64e4 * _64e4 * _64e4) +#define _64e63 (_64e15 * _64e16 * _64e16 * _64e16) +#define _64e64 (_64e16 * _64e16 * _64e16 * _64e16) + +/* + * __str_real_as_sortable -- + * The following procedure converts a double-precision floating point + * number into a string. The resulting string has the property that + * two such strings comparied using strcmp() or memcmp() will give the + * same results as a numeric comparison of the original floating point + * numbers. + * + * This routine is used to generate database keys from floating point + * numbers such that the keys sort in the same order as the original + * floating point numbers even though the keys are compared using + * memcmp(). + * + * The calling function should have allocated at least 14 characters + * of space for the buffer z[]. + * + * PUBLIC: void __str_real_as_sortable __P((double, char *)); + */ +void +__str_real_as_sortable(r, z) + double r; + char *z; +{ + int neg; + int exp; + int cnt = 0; + + /* + * This array maps integers between 0 and 63 into base-64 digits. + * The digits must be chosen such at their ASCII codes are increasing. + * This means we can not use the traditional base-64 digit set. + */ + static const char digit[] = + "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "|~"; + if (r < 0.0) { + neg = 1; + r = -r; + *z++ = '-'; + } else { + neg = 0; + *z++ = '0'; + } + exp = 0; + + if (r == 0.0) { + exp = -1024; + } else if (r < (0.5 / 64.0)) { + while(r < 0.5 / _64e64 && exp > -961) { + r *= _64e64; + exp -= 64; + } + while(r < 0.5 / _64e16 && exp > -1009) { + r *= _64e16; + exp -= 16; + } + while(r < 0.5 / _64e4 && exp > -1021) { + r *= _64e4; + exp -= 4; + } + while(r < 0.5 / 64.0 && exp > -1024) { + r *= 64.0; + exp -= 1; + } + } else if (r >= 0.5) { + while(r >= 0.5 * _64e63 && exp < 960) { + r *= 1.0 / _64e64; + exp += 64; + } + while(r >= 0.5 * _64e15 && exp < 1008) { + r *= 1.0 / _64e16; + exp += 16; + } + while(r >= 0.5 * _64e3 && exp < 1020) { + r *= 1.0 / _64e4; + exp += 4; + } + while(r >= 0.5 && exp < 1023) { + r *= 1.0/64.0; + exp += 1; + } + } + if (neg) { + exp = -exp; + r = -r; + } + exp += 1024; + r += 0.5; + if (exp < 0) + return; + if (exp >= 2048 || r >= 1.0) { + strcpy(z, "~~~~~~~~~~~~"); + return; + } + *z++ = digit[(exp >> 6) & 0x3f]; + *z++ = digit[exp & 0x3f]; + while(r > 0.0 && cnt < 10) { + int d; + r *= 64.0; + d = (int)r; + DBSQL_ASSERT(d >= 0 && d < 64); + *z++ = digit[d & 0x3f]; + r -= d; + cnt++; + } + *z = 0; +} + +/* + * __str_cmp -- + * This routine is used for sorting. Each key is a list of one or more + * null-terminated elements. The list is terminated by two nulls in + * a row. For example, the following text is a key with three elements + * + * Aone\000Dtwo\000Athree\000\000 + * + * All elements begin with one of the characters "+-AD" and end with + * "\000" with zero or more text elements in between. Except, NULL + * elements consist of the special two-character sequence "N\000". + * + * Both arguments will have the same number of elements. This routine + * returns negative, zero, or positive if the first argument is less + * than, equal to, or greater than the first. (Result is a-b). + * + * Each element begins with one of the characters "+", "-", "A", "D". + * This character determines the sort order and collating sequence: + * + * + Sort numerically in ascending order + * - Sort numerically in descending order + * A Sort as strings in ascending order + * D Sort as strings in descending order. + * + * For the "+" and "-" sorting, pure numeric strings (strings for which + * the __str_is_numeric() function above returns TRUE) always compare + * less than strings that are not pure numerics. Non-numeric strings + * compare in memcmp() order. This is the same sort order as the + * __str_numeric_cmp() function above generates. + * + * Elements that begin with 'A' or 'D' compare in memcmp() order + * regardless of whether or not they look like a number. + * + * Note that the sort order imposed by the rules above is the same + * from the ordering defined by the "<", "<=", ">", and ">=" operators + * of expressions and for indices. + * + * PUBLIC: int __str_cmp __P((const char *, const char *)); + */ +int +__str_cmp(a, b) + const char *a; + const char *b; +{ + int res = 0; + int a_numeric_p, b_numeric_p; + int dir = 0; + + while(res == 0 && *a && *b) { + if (a[0] == 'N' || b[0] == 'N') { + if (a[0] == b[0]) { + a += 2; + b += 2; + continue; + } + if (a[0] == 'N') { + dir = b[0]; + res = -1; + } else { + dir = a[0]; + res = +1; + } + break; + } + DBSQL_ASSERT(a[0] == b[0]); + if ((dir = a[0]) == 'A' || a[0] == 'D') { + res = strcmp(&a[1], &b[1]); + if (res) + break; + } else { + a_numeric_p = __str_is_numeric(&a[1]); + b_numeric_p = __str_is_numeric(&b[1]); + if (a_numeric_p) { + double rA, rB; + if (!b_numeric_p) { + res = -1; + break; + } + rA = __dbsql_atof(&a[1]); + rB = __dbsql_atof(&b[1]); + if (rA < rB) { + res = -1; + break; + } + if (rA > rB) { + res = +1; + break; + } + } else if (b_numeric_p) { + res = +1; + break; + } else { + res = strcmp(&a[1], &b[1]); + if (res) + break; + } + } + a += strlen(&a[1]) + 2; + b += strlen(&b[1]) + 2; + } + if (dir == '-' || dir == 'D') + res = -res; + return res; +} diff --git a/src/dbsql.in b/src/dbsql.in new file mode 100644 index 0000000..7ea9f5e --- /dev/null +++ b/src/dbsql.in @@ -0,0 +1,434 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: dbsql.in 7 2007-02-03 13:34:17Z gburd $ + */ + +#ifndef _DBSQL_H_ +#define _DBSQL_H_ + +#ifndef __NO_SYSTEM_INCLUDES +#include +#include /* Needed for drand48 */ +#include /* Needed for the definition of va_list */ + +@inttypes_decl@ +#include +#endif + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +@DB_CONST@ +@DB_PROTO1@ +@DB_PROTO2@ + +/* + * DBSQL version information. + */ +#define DBSQL_VERSION_MAJOR @DBSQL_VERSION_MAJOR@ +#define DBSQL_VERSION_MINOR @DBSQL_VERSION_MINOR@ +#define DBSQL_VERSION_PATCH @DBSQL_VERSION_PATCH@ +#define DBSQL_VERSION_STRING @DBSQL_VERSION_STRING@ + +/* + * !!! + * DBSQL uses specifically sized types. If they're not provided by + * the system, typedef them here. + * + * We protect them against multiple inclusion using __BIT_TYPES_DEFINED__, + * as does BIND and Kerberos, since we don't know for sure what #include + * files the user is using. + * + * !!! + * We also provide the standard u_int, u_long etc., if they're not provided + * by the system. + */ +#ifndef __BIT_TYPES_DEFINED__ +#define __BIT_TYPES_DEFINED__ +@u_int8_decl@ +@int16_decl@ +@u_int16_decl@ +@int32_decl@ +@u_int32_decl@ +#endif + +@u_char_decl@ +@u_short_decl@ +@u_int_decl@ +@u_long_decl@ +@ssize_t_decl@ +@long_double_decl@ + +/* + * Forward structure declarations, so we can declare pointers and + * applications can get type checking. + */ +struct __dbsql; typedef struct __dbsql DBSQL; +struct __dbsql_func; typedef struct __dbsql_func dbsql_func_t; +struct __dbsql_stmt; typedef struct __dbsql_vm dbsql_stmt_t; +struct __dbsql_db; typedef struct __dbsql_db dbsql_db_t; +struct __dbsql_value; typedef struct __dbsql_value dbsql_value_t; +typedef int (*dbsql_callback)(void *, int, char **, char **); + +/* + * Name of the master database table. The master database table + * is a special table that holds the names and attributes of all + * user tables and indices. + */ +#define MASTER_NAME "master" +#define TEMP_MASTER_NAME "temp_master" + +/* + * If the following macro is set to 1, then NULL values are considered + * distinct for the SELECT DISTINCT statement and for UNION or EXCEPT + * compound queries. No other SQL database engine (among those tested) + * works this way except for OCELOT. But the SQL92 spec implies that + * this is how things should work. + * + * If the following macro is set to 0, then NULLs are indistinct for + * SELECT DISTINCT and for UNION. + */ +#define NULL_ALWAYS_DISTINCT 0 + +/* + * If the following macro is set to 1, then NULL values are considered + * distinct when determining whether or not two entries are the same + * in a UNIQUE index. This is the way PostgreSQL, Oracle, DB2, MySQL, + * OCELOT, and Firebird all work. The SQL92 spec explicitly says this + * is the way things are suppose to work. + * + * If the following macro is set to 0, the NULLs are indistinct for + * a UNIQUE index. In this mode, you can only have a single NULL entry + * for a column declared UNIQUE. This is the way Informix and SQL Server + * work. + */ +#define NULL_DISTINCT_FOR_UNIQUE 1 + +/* + * The name of the schema tables. + */ +#define SCHEMA_TABLE(x) (x?TEMP_MASTER_NAME:MASTER_NAME) + +/* + * Character Encoding: + * DBSQL supports the major character encodings. + * - ASCII (American Standard Code for Information Interchange) + * - UTF-8 (8-bit UCS/Unicode Transformation Format) + * - UTF-16 (16-bit UCS/Unicode Transformation Format) + * - ISO-8859-1 (The IANA registered the character map ISO_8859-1:1987) + * + * The following constant holds one of two strings, "UTF-8" or "iso8859", + * depending on which character encoding the library expects to see. + * The character encoding makes a difference for the LIKE and GLOB + * operators and for the LENGTH() and SUBSTR() functions. + */ +extern const char dbsql_encoding[]; + +#define DBSQL_ASCII_ENCODED 1 +#define DBSQL_UTF8_ENCODED 2 +#define DBSQL_UTF16_ENCODED 3 +#define DBSQL_ISO8859_ENCODED 4 + +/* + * The DBSQL_UTF8_ENCODING macro is defined if the library expects to see + * UTF-8 encoded data. The DBSQL_ISO8859_ENCODING macro is defined if the + * iso8859 encoding should be used. + */ +#define DBSQL_@ENCODING@_ENCODING 1 + + +/* DBSQL (user visible) successful return code. */ +#define DBSQL_SUCCESS 0 + +/* + * DBSQL (user visible) error return codes. + * + * !!! + * We don't want our error returns to conflict with other packages where + * possible, so pick a base error value that's hopefully not common. We + * document that we own the error name space from -50,800 to -50,999. + */ +/* DBSQL (public) error return codes. */ +#define DBSQL_ERROR (-50999)/* SQL error or missing database */ +#define DBSQL_INTERNAL (-50998)/* An internal logic error */ +#define DBSQL_PERM (-50997)/* Access permission denied */ +#define DBSQL_ABORT (-50996)/* Callback routine requested an abort */ +#define DBSQL_BUSY (-50995)/* The database file is locked */ +#define DBSQL_LOCKED (-50994)/* A table in the database is locked */ +#define DBSQL_NOMEM (-50993)/* A call to allocate memory failed */ +#define DBSQL_READONLY (-50992)/* Attempt to write a readonly database */ +#define DBSQL_INTERRUPTED (-50991)/* Operation terminated by interrupt() */ +#define DBSQL_IOERR (-50990)/* Some kind of disk I/O error occurred */ +#define DBSQL_FULL (-50989)/* Failed because database is full */ +#define DBSQL_CANTOPEN (-50988)/* Unable to open the database file */ +#define DBSQL_PROTOCOL (-50987)/* Database lock protocol error */ +#define DBSQL_SCHEMA (-50986)/* The database schema changed */ +#define DBSQL_CONSTRAINT (-50985)/* Abort due to contraint violation */ +#define DBSQL_MISMATCH (-50984)/* Data type mismatch */ +#define DBSQL_MISUSE (-50983)/* Library used incorrectly */ +#define DBSQL_AUTH (-50982)/* Authorization denied */ +#define DBSQL_FORMAT (-50981)/* Auxiliary database format error */ +#define DBSQL_RANGE (-50980)/* 2nd parameter to bind() out of range */ +#define DBSQL_ROW (-50979)/* step() has another row ready */ +#define DBSQL_DONE (-50978)/* step() has finished executing */ +#define DBSQL_CORRUPT (-50977)/* The data record is malformed */ +#define DBSQL_RUNRECOVERY (-50976)/* Database environment requires recovery */ +#define DBSQL_INVALID_NAME (-50975)/* Empty or invalid file name supplied */ + +/* DBSQL (private) error return codes. */ +#define DBSQL_NOTFOUND (-50801)/* Table or record not found */ +#define DBSQL_EMPTY (-50800)/* Database table is empty */ + +/* + * SQL Database Environment handle. + */ +struct __dbsql { + void *app_private; /* For use by the application. */ + + /* Basic API functions. */ + const char *(*encoding)(void); + int (*open) __P((DBSQL *, const char *, int, char **)); + int (*close) __P((DBSQL *)); + int (*rowid) __P((DBSQL *)); + int (*last_change_count) __P((DBSQL *)); + int (*total_change_count) __P((DBSQL *)); + void (*interrupt) __P((DBSQL *)); + void (*set_errcall) __P((DBSQL *, void (*)(const char *, char *))); + void (*set_errfile) __P((DBSQL *, FILE *)); + void (*get_errfile) __P((DBSQL *, FILE **)); + void (*set_errpfx) __P((DBSQL *, const char *)); + void (*get_errpfx) __P((DBSQL *, const char **)); + DB_ENV *(*get_dbenv) __P((DBSQL *)); + + /* Callback access functions. */ + void *(*set_tracecall) __P((DBSQL *, void(*)(void *, const char *),\ + void *)); +#ifndef DBSQL_NO_PROGRESS + void (*set_progresscall) __P((DBSQL *, int, int(*)(void*), void*)); +#endif + void *(*set_commitcall) __P((DBSQL *, int(*)(void*), void*)); + void (*set_busycall) __P((DBSQL *, int(*)(int, const char *, int),\ + void *)); + void (*set_timeout) __P((DBSQL *, int ms)); + + int (*get_table) __P((DBSQL *, const char *, char ***, int *,\ + int *, char **)); + void (*free_table) __P((char **)); + int (*exec_printf) __P((DBSQL *, const char *, dbsql_callback,\ + void *, char **, ...)); + int (*exec_vprintf) __P((DBSQL *, const char *, dbsql_callback,\ + void *, char **, va_list ap)); + int (*exec_table_printf) __P((DBSQL *, const char *, char ***,\ + int *, int *, char **, ...)); + int (*exec_table_vprintf) __P((DBSQL *, const char *, char ***,\ + int *, int *, char **, va_list)); + int (*exec) __P((DBSQL *, const char *, dbsql_callback, void *,\ + char **)); + + int (*step) __P((dbsql_stmt_t *, int *, const char ***,\ + const char ***)); + + int (*create_function) __P((DBSQL *, const char *, int, int, void *,\ + void (*)(dbsql_func_t *, int, const char**),\ + void (*)(dbsql_func_t *, int, const char**),\ + void (*)(dbsql_func_t *))); + int (*func_return_type) __P((DBSQL *, const char *, int)); +#define DBSQL_NUMERIC (-1) +#define DBSQL_TEXT (-2) +#define DBSQL_ARGS (-3) + + int (*set_authorizer) __P((DBSQL *, int (*)(void *, int, const char *,\ + const char *, const char *,\ + const char *), void *)); + +/* + * The return value of the authorization function should be one of the + * following constants: + * + define DBSQL_SUCCESS 0 Allow access (This is actually defined above) */ +#define DBSQL_DENY 1 /* Abort the SQL statement with an error */ +#define DBSQL_IGNORE 2 /* Don't allow access, but don't generate an error */ + +/* + * The second parameter to the access authorization function above will + * be one of the values below. These values signify what kind of operation + * is to be authorized. The 3rd and 4th parameters to the authorization + * function will be parameters or NULL depending on which of the following + * codes is used as the second parameter. The 5th parameter is the name + * of the database ("main", "temp", etc.) if applicable. The 6th parameter + * is the name of the inner-most trigger or view that is responsible for + * the access attempt or NULL if this access attempt is directly from + * input SQL code. + * Arg-3 Arg-4 + */ +#define DBSQL_COPY 0 /* Table Name File Name */ +#define DBSQL_CREATE_INDEX 1 /* Index Name Table Name */ +#define DBSQL_CREATE_TABLE 2 /* Table Name NULL */ +#define DBSQL_CREATE_TEMP_INDEX 3 /* Index Name Table Name */ +#define DBSQL_CREATE_TEMP_TABLE 4 /* Table Name NULL */ +#define DBSQL_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */ +#define DBSQL_CREATE_TEMP_VIEW 6 /* View Name NULL */ +#define DBSQL_CREATE_TRIGGER 7 /* Trigger Name Table Name */ +#define DBSQL_CREATE_VIEW 8 /* View Name NULL */ +#define DBSQL_DELETE 9 /* Table Name NULL */ +#define DBSQL_DROP_INDEX 10 /* Index Name Table Name */ +#define DBSQL_DROP_TABLE 11 /* Table Name NULL */ +#define DBSQL_DROP_TEMP_INDEX 12 /* Index Name Table Name */ +#define DBSQL_DROP_TEMP_TABLE 13 /* Table Name NULL */ +#define DBSQL_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */ +#define DBSQL_DROP_TEMP_VIEW 15 /* View Name NULL */ +#define DBSQL_DROP_TRIGGER 16 /* Trigger Name Table Name */ +#define DBSQL_DROP_VIEW 17 /* View Name NULL */ +#define DBSQL_INSERT 18 /* Table Name NULL */ +#define DBSQL_PRAGMA 19 /* Pragma Name 1st arg or NULL */ +#define DBSQL_READ 20 /* Table Name Column Name */ +#define DBSQL_SELECT 21 /* NULL NULL */ +#define DBSQL_TRANSACTION 22 /* NULL NULL */ +#define DBSQL_UPDATE 23 /* Table Name Column Name */ +#define DBSQL_ATTACH 24 /* Filename NULL */ +#define DBSQL_DETACH 25 /* Database Name NULL */ + + /* Non-callback access functions. */ + int (*prepare) __P((DBSQL *, const char *, const char **, dbsql_stmt_t **,\ + char **)); + int (*finalize) __P((dbsql_stmt_t *, char **)); + int (*reset) __P((dbsql_stmt_t *, char **)); + int (*bind) __P((dbsql_stmt_t *, int, const char *, int, int)); + + /* + * From here on out, fields are internal and subject to change. + */ + DB_ENV *dbenv; /* The Berkeley DB Environment */ + int txn_flags; + void (*dbsql_errcall)(const char *, char *); /* Error callback */ + FILE *dbsql_errfile; /* The error file */ + char *dbsql_errpfx; /* The error prefix string */ + void (*dbsql_paniccall)(DBSQL *, int); /* The panic callback */ + struct drand48_data rand; /* Random generator state */ + int panic; /* If non-zero, shut down the application */ + dbsql_db_t *aDb; /* One for each open SQL database + 2 */ + int nDb; /* Number of open dbsql_db_t's open */ + int flags; /* Flags, see below */ +#define DBSQL_VdbeTrace 0x00000001 /* True to trace VDBE execution */ +#define DBSQL_Initialized 0x00000002 /* True after initialization */ +#define DBSQL_Interrupt 0x00000004 /* Cancel current operation */ +#define DBSQL_InTrans 0x00000008 /* True if in a transaction */ +#define DBSQL_InternChanges 0x00000010 /* Uncommitted Hash table changes */ +#define DBSQL_FullColNames 0x00000020 /* Show full column names on SELECT */ +#define DBSQL_CountRows 0x00000040 /* Count rows changed by INSERT, + DELETE, or UPDATE and return + the count using a callback. */ +#define DBSQL_NullCallback 0x00000080 /* Invoke the callback once if the + result set is empty */ +#define DBSQL_ReportTypes 0x00000200 /* Include information on datatypes + in 4th argument of callback */ +#define DBSQL_DurableTemp 0x00000400 /* Back temp databases on disk. */ +#define DBSQL_Threaded 0x00000800 /* Set when we're expected to be + thread safe. */ + u_int8_t want_to_close; /* Close after all VDBEs are deallocated */ + int next_sig; /* Next value of aDb[0].schema_sig */ + int nTable; /* Number of tables in the database */ + void *pBusyArg; /* 1st Argument to the busy callback */ + int (*xBusyCallback)(DBSQL *, void *, const char*, int); + void *pCommitArg; /* Argument to xCommitCallback() */ + int (*xCommitCallback)(void*);/* Invoked at every commit. */ + void *aFunc; /* All functions that can be in SQL exprs */ + int lastRowid; /* ROWID of most recent insert */ + int priorNewRowid; /* Last generated ROWID */ + int onError; /* Default conflict algorithm */ + int magic; /* Magic number to detect library misuse */ +#define DBSQL_STATUS_OPEN 0xa029a697 /* Database is open */ +#define DBSQL_STATUS_CLOSED 0x9f3c2d33 /* Database is closed */ +#define DBSQL_STATUS_BUSY 0xf03b7906 /* Database currently in use */ +#define DBSQL_STATUS_ERROR 0xb5357930 /* An DBSQL_MISUSE error occurred */ + u_int32_t _num_last_changes; /* Number of rows changed */ + u_int32_t _num_total_changes; /* Total number of rows changed */ + struct vdbe *pVdbe; /* List of active virtual machines */ + void (*xTrace)(void*,const char*); /* Trace function */ + void *pTraceArg; /* Argument to the trace function */ +#ifndef DBSQL_NO_AUTH /* Access authorization functions */ + int (*auth)(void*,int,const char*,const char*,const char*,const char*); + void *pAuthArg; /* 1st argument to the access auth function */ +#endif +#ifndef DBSQL_NO_PROGRESS + int (*xProgress)(void *);/* The progress callback */ + void *pProgressArg; /* Argument to the progress callback */ + int nProgressOps; /* Number of opcodes for progress callback */ +#endif + u_int32_t format_version;/* The version of the representation */ +}; + +#define DBSQL_THREAD 0x00001 /* When set the library is thread + safe. */ +#define DBSQL_DURABLE_TEMP 0x00002 /* Store temp data on disk rather + than in memory */ + +int dbsql_create_env __P((DBSQL **, const char *, const char *, int, u_int32_t)); +int dbsql_create __P((DBSQL **, DB_ENV *, u_int32_t)); +int dbsql_complete_stmt __P((const char *)); +char *dbsql_strerror __P((int)); +const char * dbsql_version __P((int *, int *, int *)); + +void dbsql_set_result_null __P((dbsql_func_t *)); +char *dbsql_set_result_string __P((dbsql_func_t *, const char *, int)); +void dbsql_set_result_int __P((dbsql_func_t *, int)); +void dbsql_set_result_int64 __P((dbsql_func_t *, int64_t)); +void dbsql_set_result_blob __P((dbsql_func_t *, const void *, size_t,\ + void(*)(void*))); +void dbsql_set_result_varchar __P((dbsql_func_t *, const char *, size_t,\ + void(*)(void*))); +void dbsql_set_result_double __P((dbsql_func_t *, double)); +void dbsql_set_result_error __P((dbsql_func_t *, const char *, int)); +void *dbsql_user_data __P((dbsql_func_t *)); +void *dbsql_aggregate_context __P((dbsql_func_t *, int)); +int dbsql_aggregate_count __P((dbsql_func_t *)); + +/* + * The fifth parameter to dbsql_set_result_blob(), and + * dbsql_set_result_varchar() is a destructor used to dispose of the BLOB + * or text after DBSQL has finished with it. If the fifth argument is the + * special value DBSQL_STATIC, then the library assumes that the information + * is in static, unmanaged space and does not need to be freed. If the fifth + * argument has the value DBSQL_TRANSIENT, then DBSQL makes its own private + * copy of the data. + */ +#define DBSQL_STATIC ((void(*)(void *))0) +#define DBSQL_TRANSIENT ((void(*)(void *))-1) + +/* + * Values are stored in the database in one of the following fundamental + * types. TODO + */ +#define DBSQL_INTEGER 1 +#define DBSQL_FLOAT 2 +#define DBSQL_VARCHAR 3 +#define DBSQL_BLOB 4 +#define DBSQL_NULL 5 + +#ifdef __cplusplus +} +#endif + +#endif /* !_DBSQL_H_ */ diff --git a/src/dbsql/dbsql.c b/src/dbsql/dbsql.c new file mode 100644 index 0000000..c532196 --- /dev/null +++ b/src/dbsql/dbsql.c @@ -0,0 +1,1517 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: dbsql.c 7 2007-02-03 13:34:17Z gburd $ + */ + + +/* + * This file contains code to implement the command line + * utility for accessing databases. + */ + +#include +#include +#include +#include + +#include "dbsql_config.h" +#include "dbsql.h" + +#if !defined(_WIN32) && !defined(WIN32) +#include +#include +#include +#include +#endif + +#if defined(HAVE_READLINE) && HAVE_READLINE==1 +#include +#include +#else +#define readline(p) local_getline(p,stdin) +#define add_history(X) +#define read_history(X) +#define write_history(X) +#define stifle_history(X) +#endif + +struct globals { + /* The Berkeley DBSQL database manager. */ + DBSQL *dbp; + + /* The Berkeley DB database environment. */ + DB_ENV *dbenv; + + /* Non-zero if an interrupt (Control-C) has been received. */ + int interrupted_p; + + /* + * This is the name of our program. It is set in main(), used + * in a number of other places, mostly for error messages. + */ + char *progname; + + /* An output stream for error messages, normally stdout. */ + FILE *errfp; + + /* + * Prompt strings. Initialized in main. Settable using the + * '.prompt [main] [continuation]' command. + */ + char prompt[20]; /* First line prompt. default: "SQL> "*/ + char prompt2[20]; /* Continuation prompt. default: "...> " */ +}; + +static struct globals g; + +extern int __str_is_numeric(const char*); +extern int isatty(); + +/* + * This routine reads a line of text from standard input, stores + * the text in memory obtained from malloc() and returns a pointer + * to the text. NULL is returned at end of file, or if malloc() + * fails. + * The interface is like "readline" but no command-line editing + * is done. + */ +static char * +local_getline(prompt, in) + char *prompt; + FILE *in; +{ + char *line; + int len; + int n; + int eol; + + if (prompt && *prompt) { + printf("%s", prompt); + fflush(stdout); + } + len = 100; + line = malloc(len); + if (line == 0) + return 0; + n = 0; + eol = 0; + while(!eol) { + if (n + 100 > len) { + len = (len * 2) + 100; + line = realloc(line, len); + if (line == 0) + return 0; + } + if (fgets(&line[n], len - n, in) == 0) { + if (n == 0) { + free(line); + return 0; + } + line[n] = 0; + eol = 1; + break; + } + while(line[n]) { + n++; + } + if (n > 0 && line[n - 1] == '\n') { + n--; + line[n] = 0; + eol = 1; + } + } + line = realloc(line, n + 1); + return line; +} + +/* + * Retrieve a single line of input text. "isatty" is true if text + * is coming from a terminal. In that case, we issue a prompt and + * attempt to use "readline" for command-line editing. If "isatty" + * is false, use "local_getline" instead of "readline" and issue no prompt. + * + * zPrior is a string of prior text retrieved. If not the empty + * string, then issue a continuation prompt. + */ +static char * +one_input_line(prior, in) + const char *prior; + FILE *in; +{ + char *prompt; + char *result; + if (in != 0) { + return local_getline(0, in); + } + if (prior && prior[0]) { + prompt = g.prompt2; + } else { + prompt = g.prompt; + } + result = readline(prompt); + if (result) + add_history(result); + return result; +} + +struct previous_mode_data { + int valid; /* Is there legit data in here? */ + int mode; + int show_header; + int col_width[100]; +}; + +/* + * An pointer to an instance of this structure is passed from + * the main program to the callback. This is used to communicate + * state and mode information. + */ +struct callback_data { + DBSQL *db; /* The database */ + int echoOn; /* True to echo input commands */ + int cnt; /* Number of records displayed so far */ + FILE *out; /* Write results here */ + int mode; /* An output mode setting */ + int show_header; /* True to show column names in List or + Column mode */ + char *dest_table; /* Name of destination table when MODE_Insert */ + char separator[20]; /* Separator character for MODE_List */ + int col_width[100]; /* Requested width of each column when in column mode*/ + int actual_width[100]; /* Actual width of each column */ + char nullvalue[20]; /* The text to print when a NULL comes back from + * the database */ + struct previous_mode_data explainPrev; /* Holds the mode information + * just before .explain ON */ + char outfile[FILENAME_MAX]; /* Filename for *out */ + const char *db_filename; /* Name of the database file */ + char *crypt_key; /* Encryption key */ +}; + +/* + * These are the allowed modes. + */ +#define MODE_Line 0 /* One column per line. Blank line between records */ +#define MODE_Column 1 /* One record per line in neat columns */ +#define MODE_List 2 /* One record per line with a separator */ +#define MODE_Semi 3 /* Same as MODE_List but append ";" to each line */ +#define MODE_Html 4 /* Generate an XHTML table */ +#define MODE_Insert 5 /* Generate SQL "insert" statements */ +#define MODE_NUM_OF 6 /* The number of modes (not a mode itself) */ + +char *modeDescr[MODE_NUM_OF] = { + "line", + "column", + "list", + "semi", + "html", + "insert" +}; + +/* + * Number of elements in an array + */ +#define ARRAY_SIZE(X) (sizeof(X)/sizeof(X[0])) + +/* + * Output the given string as a quoted string using SQL quoting conventions. + */ +static void +output_quoted_string(out, z) + FILE *out; + const char *z; +{ + int i; + int single = 0; + for(i = 0; z[i]; i++) { + if (z[i] == '\'') + single++; + } + if (single == 0) { + fprintf(out, "'%s'",z); + } else { + fprintf(out, "'"); + while(*z) { + for(i = 0; z[i] && z[i] != '\''; i++) {} + if (i == 0) { + fprintf(out, "''"); + z++; + } else if (z[i] == '\'') { + fprintf(out, "%.*s''", i, z); + z += i + 1; + } else { + fprintf(out, "%s", z); + break; + } + } + fprintf(out, "'"); + } +} + +/* + * Output the given string with characters that are special to + * HTML escaped. + */ +static void +output_html_string(out, z) + FILE *out; + const char *z; +{ + int i; + while(*z) { + for(i = 0; z[i] && z[i] != '<' && z[i] != '&'; i++) {} + if (i > 0) { + fprintf(out, "%.*s", i, z); + } + if (z[i] == '<') { + fprintf(out, "<"); + } else if (z[i] == '&') { + fprintf(out, "&"); + } else { + break; + } + z += i + 1; + } +} + +/* +** This routine runs when the user presses Ctrl-C +*/ +static void +interrupt_handler(NOT_USED) + int NOT_USED; +{ + g.interrupted_p = 1; + if (g.dbp) + g.dbp->interrupt(g.dbp); +} + +/* + * This is the callback routine that is invoked + * for each row of a query result. + */ +static int +callback(arg, num_args, args, cols) + void *arg; + int num_args; + char **args; + char **cols; +{ + int i; + struct callback_data *p = (struct callback_data*)arg; + switch(p->mode) { + case MODE_Line: { + int w = 5; + if (args == 0) + break; + for(i = 0; i < num_args; i++) { + int len = strlen(cols[i]); + if (len > w) + w = len; + } + if (p->cnt++ > 0) + fprintf(p->out, "\n"); + for (i = 0; i < num_args; i++) { + fprintf(p->out, "%*s = %s\n", w, cols[i], + (args[i] ? args[i] : p->nullvalue)); + } + break; + } + case MODE_Column: { + if (p->cnt++ == 0) { + for(i = 0; i < num_args; i++) { + int w, n; + if (i < ARRAY_SIZE(p->col_width)) { + w = p->col_width[i]; + } else { + w = 0; + } + if (w <= 0) { + w = strlen(cols[i] ? cols[i] : ""); + if (w < 10) + w = 10; + n = strlen(args && args[i] ? + args[i] : + p->nullvalue); + if (w < n) + w = n; + } + if (i < ARRAY_SIZE(p->actual_width)) { + p->actual_width[i] = w; + } + if (p->show_header) { + fprintf(p->out, "%-*.*s%s", w, w, + cols[i], (i == num_args - 1 ? + "\n": " ")); + } + } + if (p->show_header) { + for(i = 0; i < num_args; i++) { + int w; + if (i < ARRAY_SIZE(p->actual_width)) { + w = p->actual_width[i]; + } else { + w = 10; + } + fprintf(p->out, "%-*.*s%s", w, w, + "----------------------------------------------------------" + "-----------------------------------", + (i == num_args - 1) ? + "\n" : " "); + } + } + } + if (args == 0) + break; + for(i = 0; i < num_args; i++) { + int w; + if (i < ARRAY_SIZE(p->actual_width)) { + w = p->actual_width[i]; + } else { + w = 10; + } + fprintf(p->out, "%-*.*s%s", w, w, + args[i] ? args[i] : p->nullvalue, + i == num_args - 1 ? "\n" : " "); + } + break; + } + case MODE_Semi: /* FALLTHROUGH */ + case MODE_List: { + if (p->cnt++ == 0 && p->show_header) { + for(i = 0; i < num_args; i++) { + fprintf(p->out, "%s%s", cols[i], + i == num_args - 1 ? + "\n" : p->separator); + } + } + if (args == 0) + break; + for(i = 0; i < num_args; i++) { + char *z = args[i]; + if (z == 0) + z = p->nullvalue; + fprintf(p->out, "%s", z); + if (i < num_args - 1) { + fprintf(p->out, "%s", p->separator); + } else if (p->mode == MODE_Semi) { + fprintf(p->out, ";\n"); + } else { + fprintf(p->out, "\n"); + } + } + break; + } + case MODE_Html: { + if (p->cnt++ == 0 && p->show_header) { + fprintf(p->out, ""); + for(i = 0; i < num_args; i++) { + fprintf(p->out, "", cols[i]); + } + fprintf(p->out, "\n"); + } + if (args == 0) + break; + fprintf(p->out, ""); + for(i = 0; i < num_args; i++) { + fprintf(p->out, "\n"); + } + fprintf(p->out, "\n"); + break; + } + case MODE_Insert: { + if (args == 0) + break; + fprintf(p->out, "INSERT INTO %s VALUES(", p->dest_table); + for(i = 0; i < num_args; i++) { + char *zSep = i>0 ? ",": ""; + if (args[i] == 0) { + fprintf(p->out, "%sNULL", zSep); + } else if (__str_is_numeric(args[i])) { + fprintf(p->out, "%s%s", zSep, args[i]); + } else { + if (zSep[0]) + fprintf(p->out, "%s", zSep); + output_quoted_string(p->out, args[i]); + } + } + fprintf(p->out, ");\n"); + break; + } + } + return 0; +} + +/* + * Set the destination table field of the callback_data structure to + * the name of the table given. Escape any quote characters in the + * table name. + */ +static void +set_table_name(p, name) + struct callback_data *p; + const char *name; +{ + int i, n; + int needQuote; + char *z; + + if (p->dest_table) { + free(p->dest_table); + p->dest_table = 0; + } + if (name == 0) + return; + needQuote = !isalpha(*name) && *name!='_'; + for(i = n = 0; name[i]; i++, n++) { + if (!isalnum(name[i]) && name[i] != '_' ) { + needQuote = 1; + if( name[i] == '\'' ) + n++; + } + } + if (needQuote) + n += 2; + z = p->dest_table = malloc(n + 1); + if (z == 0) { + fprintf(stderr,"Out of memory!\n"); + exit(1); + } + n = 0; + if (needQuote) + z[n++] = '\''; + for(i = 0; name[i]; i++) { + z[n++] = name[i]; + if (name[i] == '\'') + z[n++] = '\''; + } + if (needQuote) + z[n++] = '\''; + z[n] = 0; +} + +/* + * This is a different callback routine used for dumping the database. + * Each row received by this callback consists of a table name, + * the table type ("index" or "table") and SQL to create the table. + * This routine should print text sufficient to recreate the table. + */ +static int +dump_callback(arg, num_args, args, cols) + void *arg; + int num_args; + char **args; + char **cols; +{ + struct callback_data *p = (struct callback_data *)arg; + if (num_args != 3) + return 1; + fprintf(p->out, "%s;\n", args[2]); + if (strcmp(args[1], "table") == 0) { + struct callback_data d2; + d2 = *p; + d2.mode = MODE_Insert; + d2.dest_table = 0; + set_table_name(&d2, args[0]); + p->db->exec_printf(p->db, "SELECT * FROM '%q'", + callback, &d2, 0, args[0]); + set_table_name(&d2, 0); + } + return 0; +} + +/* + * Text of a help message + */ +static char help_message[] = + ".databases List names and files of attached databases\n" + ".dump ?TABLE? ... Dump the database in a text format\n" + ".echo ON|OFF Turn command echo on or off\n" + ".exit Exit this program\n" + ".explain ON|OFF Turn output mode suitable for EXPLAIN on or off.\n" + ".header(s) ON|OFF Turn display of headers on or off\n" + ".help Show this message\n" + ".indices TABLE Show names of all indices on TABLE\n" + ".mode MODE Set mode to one of \"line(s)\", \"column(s)\", \n" + " \"insert\", \"list\", or \"html\"\n" + ".mode insert TABLE Generate SQL insert statements for TABLE\n" + ".nullvalue STRING Print STRING instead of nothing for NULL data\n" + ".output FILENAME Send output to FILENAME\n" + ".output stdout Send output to the screen\n" + ".prompt MAIN CONTINUE Replace the standard prompts\n" + ".quit Exit this program\n" + ".read FILENAME Execute SQL in FILENAME\n" + ".schema ?TABLE? Show the CREATE statements\n" + ".separator STRING Change separator string for \"list\" mode\n" + ".show Show the current values for various settings\n" + ".tables ?PATTERN? List names of tables matching a pattern\n" + ".timeout MS Try opening locked tables for MS milliseconds\n" + ".width NUM NUM ... Set column widths for \"column\" mode\n" +; + +static void process_input(struct callback_data *p, FILE *in); + +/* + * Make sure the database is open. If it is not, then open it. If + * the database fails to open, print an error message and exit. + */ +static void +open_db(p) + struct callback_data *p; +{ + int rc; + char *err_msgs = 0; + const char *filename; + int flags = DBSQL_THREAD; /* TODO | DBSQL_TEMP_INMEM; */ + + if (p->db == 0) { + filename = p->db_filename; + if (!strcmp(p->db_filename, ":memory:")) + filename = 0; + rc = dbsql_create_env(&p->db, filename, p->crypt_key,0,flags); + switch (rc) { + case DB_RUNRECOVERY: + fprintf(g.errfp, "Database requires recovery.\n"); + break; + case 0: + break; + default: + fprintf(g.errfp, dbsql_strerror(rc)); + exit(1); + } + g.dbenv = p->db->get_dbenv(p->db); + p->db->set_errfile(p->db, g.errfp); + p->db->set_errpfx(p->db, g.progname); + if ((rc = p->db->open(p->db, p->db_filename, 0664, + &err_msgs)) != 0) { + if (err_msgs) { + fprintf(stderr, + "Unable to open database \"%s\": %s\n", + p->db_filename, err_msgs); + free(err_msgs); + } else { + fprintf(stderr, + "Unable to open database \"%s\"\n", + p->db_filename); + } + exit(1); + } + } +} + +/* + * If an input line begins with "." then invoke this routine to + * process that line. + * + * Return 1 to exit and 0 to continue. + */ +static int +do_meta_command(line, p) + char *line; + struct callback_data *p; +{ + int i = 1; + int num_args = 0; + int n, c; + int rc = 0; + char *args[50]; + + /* + * Parse the input line into tokens. + */ + while(line[i] && num_args < ARRAY_SIZE(args)) { + while(isspace(line[i])) { + i++; + } + if (line[i] == '\'' || line[i] == '"') { + int delim = line[i++]; + args[num_args++] = &line[i]; + while(line[i] && line[i] != delim) { + i++; + } + if (line[i] == delim) { + line[i++] = 0; + } + } else { + args[num_args++] = &line[i]; + while(line[i] && !isspace(line[i])) { + i++; + } + if (line[i]) + line[i++] = 0; + } + } + + /* + * Process the input line. + */ + if (num_args == 0) + return rc; + n = strlen(args[0]); + c = args[0][0]; + if (c == 'd' && n > 1 && strncmp(args[0], "databases", n) == 0) { + struct callback_data data; + char *err_msgs = 0; + open_db(p); + memcpy(&data, p, sizeof(data)); + data.show_header = 0; + data.mode = MODE_Column; + p->db->exec(p->db, "PRAGMA database_list; ", callback, + &data, &err_msgs); + if (err_msgs) { + fprintf(stderr, "Error: %s\n", err_msgs); + free(err_msgs); + } + } else if(c == 'd' && strncmp(args[0], "dump", n) == 0) { + char *err_msgs = 0; + open_db(p); + fprintf(p->out, "BEGIN TRANSACTION;\n"); + if (num_args == 1) { + p->db->exec(p->db, + "SELECT name, type, sql FROM " MASTER_NAME " " + "WHERE type!='meta' AND sql NOT NULL " + "ORDER BY substr(type, 2, 1), name", + dump_callback, p, &err_msgs); + } else { + int i; + for(i = 1; i < num_args && err_msgs == 0; i++){ + p->db->exec_printf(p->db, + "SELECT name, type, sql FROM " MASTER_NAME " " + "WHERE tbl_name LIKE '%q' AND type!='meta' AND sql NOT NULL " + "ORDER BY substr(type,2,1), name", + dump_callback, p, + &err_msgs, args[i]); + } + } + if (err_msgs) { + fprintf(stderr, "Error: %s\n", err_msgs); + free(err_msgs); + } else { + fprintf(p->out, "COMMIT;\n"); + } + } else if (c=='e' && strncmp(args[0], "echo", n) == 0 && num_args > 1){ + int j; + char *z = args[1]; + int val = atoi(args[1]); + for(j = 0; z[j]; j++) { + if (isupper(z[j])) + z[j] = tolower(z[j]); + } + if (strcmp(z, "on") == 0) { + val = 1; + } else if (strcmp(z, "yes") == 0) { + val = 1; + } + p->echoOn = val; + } else if (c == 'e' && strncmp(args[0], "exit", n) == 0) { + rc = 1; + } else if (c=='e' && strncmp(args[0], "explain", n) == 0) { + int j; + char *z = num_args >= 2 ? args[1] : "1"; + int val = atoi(z); + for(j = 0; z[j]; j++) { + if (isupper(z[j])) + z[j] = tolower(z[j]); + } + if (strcmp(z, "on") == 0) { + val = 1; + } else if (strcmp(z, "yes") == 0) { + val = 1; + } + if (val == 1) { + if (!p->explainPrev.valid) { + p->explainPrev.valid = 1; + p->explainPrev.mode = p->mode; + p->explainPrev.show_header = p->show_header; + memcpy(p->explainPrev.col_width, + p->col_width,sizeof(p->col_width)); + } + /* + * We could put this code under the !p->explainValid + * condition so that it does not execute if we are + * already in explain mode. However, always executing + * it allows us an easy was to reset to explain mode + * in case the user previously did an .explain followed + * by a .width, .mode or .header command. + */ + p->mode = MODE_Column; + p->show_header = 1; + memset(p->col_width, 0, ARRAY_SIZE(p->col_width)); + p->col_width[0] = 4; + p->col_width[1] = 12; + p->col_width[2] = 10; + p->col_width[3] = 10; + p->col_width[4] = 35; + } else if (p->explainPrev.valid) { + p->explainPrev.valid = 0; + p->mode = p->explainPrev.mode; + p->show_header = p->explainPrev.show_header; + memcpy(p->col_width, p->explainPrev.col_width, + sizeof(p->col_width)); + } + } else if (c == 'h' && (strncmp(args[0], "header", n) == 0 || + strncmp(args[0], "headers", n) == 0) && + num_args > 1) { + int j; + char *z = args[1]; + int val = atoi(args[1]); + for(j = 0; z[j]; j++) { + if (isupper(z[j])) + z[j] = tolower(z[j]); + } + if (strcmp(z, "on") == 0) { + val = 1; + } else if (strcmp(z, "yes") == 0) { + val = 1; + } + p->show_header = val; + } else if (c == 'h' && strncmp(args[0], "help", n) == 0) { + fprintf(stderr, help_message); + } else if(c == 'i' && strncmp(args[0], "indices", n) == 0 && + num_args > 1) { + struct callback_data data; + char *err_msgs = 0; + open_db(p); + memcpy(&data, p, sizeof(data)); + data.show_header = 0; + data.mode = MODE_List; + p->db->exec_printf(p->db, + "SELECT name FROM " MASTER_NAME " " + "WHERE type='index' AND tbl_name LIKE '%q' " + "UNION ALL " + "SELECT name FROM " TEMP_MASTER_NAME " " + "WHERE type='index' AND tbl_name LIKE '%q' " + "ORDER BY 1", + callback, &data, &err_msgs, args[1],args[1]); + if (err_msgs) { + fprintf(stderr, "Error: %s\n", err_msgs); + free(err_msgs); + } + } else if (c == 'm' && strncmp(args[0], "mode", n) == 0 && + num_args >= 2) { + int n2 = strlen(args[1]); + if (strncmp(args[1], "line", n2) == 0 || + strncmp(args[1], "lines", n2) == 0) { + p->mode = MODE_Line; + } else if (strncmp(args[1], "column", n2) == 0 || + strncmp(args[1], "columns", n2) == 0) { + p->mode = MODE_Column; + } else if (strncmp(args[1], "list", n2) == 0) { + p->mode = MODE_List; + } else if (strncmp(args[1], "html", n2) == 0) { + p->mode = MODE_Html; + } else if (strncmp(args[1], "insert", n2) == 0) { + p->mode = MODE_Insert; + if (num_args >= 3) { + set_table_name(p, args[2]); + } else { + set_table_name(p, "table"); + } + } else { + fprintf(stderr, "mode should be on of: column " + "html insert line list\n"); + } + } else if(c == 'n' && strncmp(args[0], "nullvalue", n) == 0 && + num_args == 2) { + sprintf(p->nullvalue, "%.*s", (int)ARRAY_SIZE(p->nullvalue)-1, + args[1]); + } else if (c == 'o' && strncmp(args[0], "output", n) == 0 && + num_args == 2) { + if (p->out != stdout) { + fclose(p->out); + } + if (strcmp(args[1], "stdout") == 0) { + p->out = stdout; + strcpy(p->outfile, "stdout"); + } else { + p->out = fopen(args[1], "w"); + if (p->out == 0) { + fprintf(stderr, "can't write to \"%s\"\n", + args[1]); + p->out = stdout; + } else { + strcpy(p->outfile,args[1]); + } + } + } else if (c == 'p' && strncmp(args[0], "prompt", n) == 0 && + (num_args == 2 || num_args == 3)) { + if (num_args >= 2) { + strncpy(g.prompt, args[1], + (int)ARRAY_SIZE(g.prompt) - 1); + } + if (num_args >= 3) { + strncpy(g.prompt2, args[2], + (int)ARRAY_SIZE(g.prompt2) - 1); + } + } else if (c == 'q' && strncmp(args[0], "quit", n) == 0) { + if (p->db) { + p->db->close(p->db); + } + g.dbenv->close(g.dbenv, 0); + exit(0); + } else if (c == 'r' && strncmp(args[0], "read", n) == 0 && + num_args == 2) { + FILE *alt = fopen(args[1], "r"); + if (alt == 0) { + fprintf(stderr, "can't open \"%s\"\n", args[1]); + } else { + process_input(p, alt); + fclose(alt); + } + } else + if (c == 's' && strncmp(args[0], "schema", n) == 0) { + struct callback_data data; + char *err_msgs = 0; + open_db(p); + memcpy(&data, p, sizeof(data)); + data.show_header = 0; + data.mode = MODE_Semi; + if (num_args > 1) { + extern int strcasecmp(const char*, + const char*); + if (strcasecmp(args[1], MASTER_NAME) == 0) { + char *new_argv[2], *new_colv[2]; + new_argv[0] = "CREATE TABLE " MASTER_NAME " (\n" + " type text,\n" + " name text,\n" + " tbl_name text,\n" + " rootpage integer,\n" + " sql text\n" + ")"; + new_argv[1] = 0; + new_colv[0] = "sql"; + new_colv[1] = 0; + callback(&data, 1, new_argv, new_colv); + } else if (strcasecmp(args[1], + TEMP_MASTER_NAME) == 0) { + char *new_argv[2], *new_colv[2]; + new_argv[0] = "CREATE TEMP TABLE " + TEMP_MASTER_NAME " (\n" + " type text,\n" + " name text,\n" + " tbl_name text,\n" + " rootpage integer,\n" + " sql text\n" + ")"; + new_argv[1] = 0; + new_colv[0] = "sql"; + new_colv[1] = 0; + callback(&data, 1, new_argv, new_colv); + } else { + p->db->exec_printf(p->db, + "SELECT sql FROM " + " (SELECT * FROM " MASTER_NAME " UNION ALL" + " SELECT * FROM " TEMP_MASTER_NAME ") " + "WHERE tbl_name LIKE '%q' AND type!='meta' AND sql NOTNULL " + "ORDER BY substr(type,2,1), name", + callback, &data, &err_msgs, + args[1]); + } + } else { + p->db->exec(p->db, + "SELECT sql FROM " + " (SELECT * FROM " MASTER_NAME " UNION ALL" + " SELECT * FROM " TEMP_MASTER_NAME ") " + "WHERE type!='meta' AND sql NOTNULL " + "ORDER BY substr(type,2,1), name", + callback, &data, &err_msgs); + } + if (err_msgs) { + fprintf(stderr, "Error: %s\n", err_msgs); + free(err_msgs); + } + } else if (c == 's' && strncmp(args[0], "separator", n) == 0 && + num_args == 2) { + sprintf(p->separator, "%.*s", (int)ARRAY_SIZE(p->separator)-1, + args[1]); + } else if (c == 's' && strncmp(args[0], "show", n) == 0) { + int i; + fprintf(p->out,"%9.9s: %s\n","echo", + p->echoOn ? "on" : "off"); + fprintf(p->out,"%9.9s: %s\n","explain", + p->explainPrev.valid ? "on" :"off"); + fprintf(p->out,"%9.9s: %s\n","headers", + p->show_header ? "on" : "off"); + fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]); + fprintf(p->out,"%9.9s: %s\n","nullvalue", p->nullvalue); + fprintf(p->out,"%9.9s: %s\n","output", + strlen(p->outfile) ? p->outfile : "stdout"); + fprintf(p->out,"%9.9s: %s\n","separator", p->separator); + fprintf(p->out,"%9.9s: ","width"); + for (i = 0; i < (int)ARRAY_SIZE(p->col_width) && + p->col_width[i] != 0; i++) { + fprintf(p->out, "%d ", p->col_width[i]); + } + fprintf(p->out, "\n\n"); + } else if (c == 't' && n > 1 && strncmp(args[0], "tables", n) == 0) { + char **results; + int nRow, rc; + char *err_msgs; + open_db(p); + if (num_args == 1) { + rc = p->db->get_table(p->db, + "SELECT name FROM " MASTER_NAME " " + "WHERE type IN ('table','view') " + "UNION ALL " + "SELECT name FROM " TEMP_MASTER_NAME " " + "WHERE type IN ('table','view') " + "ORDER BY 1", + &results, &nRow, 0, &err_msgs); + } else { + rc = p->db->exec_table_printf(p->db, + "SELECT name FROM " MASTER_NAME " " + "WHERE type IN ('table','view') AND name LIKE '%%%q%%' " + "UNION ALL " + "SELECT name FROM " TEMP_MASTER_NAME " " + "WHERE type IN ('table','view') AND name LIKE '%%%q%%' " + "ORDER BY 1", + &results, &nRow, 0, + &err_msgs, args[1], + args[1]); + } + if( err_msgs ) { + fprintf(stderr,"Error: %s\n", err_msgs); + free(err_msgs); + } + if (rc == DBSQL_SUCCESS) { + int len, maxlen = 0; + int i, j; + int num_print_col, num_print_row; + for(i = 1; i <= nRow; i++) { + if (results[i] == 0) + continue; + len = strlen(results[i]); + if (len > maxlen) + maxlen = len; + } + num_print_col = 80 / (maxlen + 2); + if (num_print_col < 1) + num_print_col = 1; + num_print_row = (nRow + num_print_col - 1) / + num_print_col; + for(i = 0; i < num_print_row; i++) { + for(j = i + 1; j <= nRow; j += num_print_row) { + char *sp = (j <= num_print_row ? "" : " "); + printf("%s%-*s", sp, maxlen, + results[j] ? results[j] : ""); + } + printf("\n"); + } + } + p->db->free_table(results); + } else if (c == 't' && n>1 && strncmp(args[0], "timeout", n) == 0 && + num_args >= 2) { + open_db(p); + p->db->set_timeout(p->db, atoi(args[1])); + } else if (c == 'w' && strncmp(args[0], "width", n) == 0) { + int j; + for(j = 1; j < num_args && j < ARRAY_SIZE(p->col_width); j++) { + p->col_width[j - 1] = atoi(args[j]); + } + } else { + fprintf(stderr, "unknown command or invalid arguments: " + " \"%s\". Enter \".help\" for help\n", args[0]); + } + return rc; +} + +/* + * Return TRUE if the last non-whitespace character in z[] is a semicolon. + * z[] is N characters long. + */ +static int +_ends_with_semicolon(z, n) + const char *z; + int n; +{ + while(n > 0 && isspace(z[n - 1])) { + n--; + } + return n > 0 && z[n - 1] == ';'; +} + +/* + * Test to see if a line consists entirely of whitespace. + */ +static int +_all_whitespace(z) + const char *z; +{ + for(; *z; z++) { + if (isspace(*z)) + continue; + if (*z == '/' && z[1] == '*') { + z += 2; + while(*z && (*z != '*' || z[1] != '/')) { + z++; + } + if (*z == 0) + return 0; + z++; + continue; + } + if (*z == '-' && z[1] == '-') { + z += 2; + while(*z && *z != '\n') { + z++; + } + if (*z == 0) + return 1; + continue; + } + return 0; + } + return 1; +} + +/* + * Return TRUE if the line typed in is an SQL command terminator other + * than a semi-colon. The SQL Server style "go" command is understood + * as is the Oracle "/". + */ +static int +_is_command_terminator(line) + const char *line; +{ + extern int strncasecmp(const char*,const char*,size_t); + while(isspace(*line)) { + line++; + }; + if (line[0] == '/' && _all_whitespace(&line[1])) + return 1; /* Oracle */ + if (strncasecmp(line, "go", 2) ==0 && + _all_whitespace(&line[2])) { + return 1; /* SQL Server */ + } + return 0; +} + +/* + * Read input from *in and process it. If *in==0 then input + * is interactive - the user is typing it it. Otherwise, input + * is coming from a file or device. A prompt is issued and history + * is saved only if input is interactive. An interrupt signal will + * cause this routine to exit immediately, unless input is interactive. + */ +static void +process_input(p, in) + struct callback_data *p; + FILE *in; +{ + char *line; + char *sql = 0; + int line_len = 0; + char *err_msgs; + int rc; + while(fflush(p->out), (line = one_input_line(sql, in)) != 0) { + if (g.interrupted_p) { + if (in != 0) + break; + g.interrupted_p = 0; + } + if (p->echoOn) + printf("%s\n", line); + if ((sql == 0 || sql[0] == 0) && + _all_whitespace(line)) + continue; + if (line && line[0] == '.' && line_len == 0) { + int rc = do_meta_command(line, p); + free(line); + if (rc) + break; + continue; + } + if (_is_command_terminator(line)) { + strcpy(line,";"); + } + if (sql == 0) { + int i; + for(i = 0; line[i] && isspace(line[i]); i++) {} + if (line[i] != 0) { + line_len = strlen(line); + sql = malloc(line_len + 1); + strcpy(sql, line); + } + } else { + int len = strlen(line); + sql = realloc(sql, line_len + len + 2 ); + if (sql == 0) { + fprintf(stderr,"%s: out of memory!\n", + g.progname); + exit(1); + } + strcpy(&sql[line_len++], "\n"); + strcpy(&sql[line_len], line); + line_len += len; + } + free(line); + if (sql && _ends_with_semicolon(sql, line_len) && + dbsql_complete_stmt(sql)) { + p->cnt = 0; + open_db(p); + rc = p->db->exec(p->db, sql, callback, p, &err_msgs); + if (rc || err_msgs) { + if (in != 0 && !p->echoOn) + printf("%s\n",sql); + if (err_msgs != 0) { + printf("SQL error: %s\n", err_msgs); + free(err_msgs); + err_msgs = 0; + } else { + printf("SQL error: %s\n", + dbsql_strerror(rc)); + } + } + free(sql); + sql = 0; + line_len = 0; + } + } + if (sql) { + if (!_all_whitespace(sql)) + printf("Incomplete SQL: %s\n", sql); + free(sql); + } +} + +/* + * Return a pathname which is the user's home directory. A + * 0 return indicates an error of some kind. Space to hold the + * resulting string is obtained from malloc(). The calling + * function should free the result. + */ +static char * +find_home_dir(void) +{ + char *home_dir = NULL; + +#if !defined(_WIN32) && !defined(WIN32) + struct passwd *pwent; + uid_t uid = getuid(); + if ((pwent = getpwuid(uid)) != NULL) { + home_dir = pwent->pw_dir; + } +#endif + + if (!home_dir) { + home_dir = getenv("HOME"); + if (!home_dir) { + home_dir = getenv("HOMEPATH"); /* Windows? */ + } + } + +#if defined(_WIN32) || defined(WIN32) + if (!home_dir) { + home_dir = "c:"; + } +#endif + + if (home_dir) { + char *z = malloc(strlen(home_dir) + 1); + if (z) + strcpy(z, home_dir); + home_dir = z; + } + return home_dir; +} + +/* + * Read input from the file given by rc_override. Or if that + * parameter is NULL, take input from ~/.dbsqlrc + */ +static void +process_rc(p, rc_override) + struct callback_data *p; /* Configuration data */ + const char *rc_override; /* Name of config file. NULL to use + default */ +{ + char *home_dir = NULL; + const char *rc = rc_override; + char *buf; + FILE *in = NULL; + + if (rc == NULL) { + home_dir = find_home_dir(); + if (home_dir == 0) { + fprintf(stderr,"%s: unable to locate home directory\n", + g.progname); + return; + } + buf = malloc(strlen(home_dir) + 15); + if (buf == 0) { + fprintf(stderr,"%s: out of memory\n", g.progname); + exit(1); + } + sprintf(buf,"%s/.dbsqlrc", home_dir); + free(home_dir); + rc = (const char*)buf; + } + in = fopen(rc, "r"); + if (in) { + if (isatty(fileno(stdout))) { + printf("Loading resources from %s\n", rc); + } + process_input(p, in); + fclose(in); + } + return; +} + +/* +** Show available command line options +*/ +static const char options[] = + "\t--init filename read/process named file\n" + "\t--echo print commands before execution\n" + "\t--[no]header turn headers on or off\n" + "\t--column set output mode to 'column'\n" + "\t--html set output mode to HTML\n" + "\t--line set output mode to 'line'\n" + "\t--list set output mode to 'list'\n" + "\t--separator 'x' set output field separator (|)\n" + "\t--nullvalue 'text' set text string for NULL values\n" + "\t--version show DBSQL version\n" + "\t--help show this text\n" +; + +/* + * + */ +static void +usage(show_detail) + int show_detail; +{ + fprintf(stderr, "Usage: db_isql [OPTIONS] FILENAME [SQL]\n"); + if (show_detail) { + fprintf(stderr, "%s", options); + } else { + fprintf(stderr, "Use the --help option for additional " + "information\n"); + } + exit(1); +} + +/* + * Initialize the state information in data. + */ +void +main_init(data) + struct callback_data *data; +{ + memset(data, 0, sizeof(*data)); + data->mode = MODE_List; + strcpy(data->separator,"|"); + data->show_header = 0; + strcpy(g.prompt,"SQL> "); + strcpy(g.prompt2,"...>"); +} + +int +main(argc, argv) + int argc; + char **argv; +{ + char *err_msgs = 0; + struct callback_data data; + const char *init_file = 0; + char *first_cmd = 0; + int i; + + memset(&g, 0, sizeof(struct globals)); + g.progname = argv[0]; + g.errfp = stderr; + main_init(&data); + + /* + * Make sure we have a valid signal handler early, before anything + * else is done. + */ +#ifdef SIGINT + signal(SIGINT, interrupt_handler); +#endif + + /* + * Do an initial pass through the command-line argument to locate + * the name of the database file, the name of the initialization file, + * and the first command to execute. + */ + for(i = 1; i <= argc - 1; i++) { + if (argv[i][0] != '-') + break; + if (strcmp(argv[i], "--separator") == 0 || + strcmp(argv[i], "--nullvalue") == 0) { + i++; + } else if (strcmp(argv[i], "--init") == 0) { + i++; + init_file = argv[i]; + } else if (strcmp(argv[i], "--key") ==0 ){ + char new[1024]; + i++; + snprintf(new, sizeof(new), "%s", argv[i]); + __dbsql_strdup(NULL, data.crypt_key, new); + } else if (strcmp(argv[i], "--help") == 0) { + usage(1); + } + } + if (i < argc) { + data.db_filename = argv[i++]; + } else { + data.db_filename = ":memory:"; + } + if(i < argc) { + first_cmd = argv[i++]; + } + data.out = stdout; + + open_db(&data); + + /* + * Process the initialization file if there is one. If no -init option + * is given on the command line, look for a file named ~/.dbsqlrc and + * try to process it. + */ + process_rc(&data, init_file); + + /* + * Make a second pass through the command-line argument and set + * options. This second pass is delayed until after the initialization + * file is processed so that the command-line arguments will override + * settings in the initialization file. + */ + for(i = 1; i < argc && argv[i][0] == '-'; i++) { + char *z = argv[i]; + if (strcmp(z, "--init") == 0 || strcmp(z, "--key") == 0) { + i++; + } else if (strcmp(z, "--html") == 0) { + data.mode = MODE_Html; + } else if (strcmp(z, "--list") == 0) { + data.mode = MODE_List; + } else if (strcmp(z, "--line") == 0) { + data.mode = MODE_Line; + } else if (strcmp(z, "--column") == 0) { + data.mode = MODE_Column; + } else if (strcmp(z, "--separator") == 0) { + i++; + sprintf(data.separator, "%.*s", + (int)sizeof(data.separator) - 1, argv[i]); + } else if (strcmp(z, "--nullvalue") == 0) { + i++; + sprintf(data.nullvalue, "%.*s", + (int)sizeof(data.nullvalue) - 1, argv[i]); + } else if (strcmp(z, "--header") == 0) { + data.show_header = 1; + } else if (strcmp(z, "--noheader") == 0) { + data.show_header = 0; + } else if (strcmp(z, "--echo") == 0) { + data.echoOn = 1; + } else if (strcmp(z, "--version") == 0) { + int major, minor, patch; + printf("%s\n", dbsql_version(&major, &minor, &patch)); + return 1; + } else { + fprintf(stderr,"%s: unknown option: %s\n", + g.progname, z); + fprintf(stderr,"Use --help for a list of options.\n"); + return 1; + } + } + + if (first_cmd) { + /* + * Run just the command that follows the database name. + */ + if (first_cmd[0] == '.') { + do_meta_command(first_cmd, &data); + exit(0); + } else { + int rc; + open_db(&data); + rc = g.dbp->exec(g.dbp, first_cmd, callback, + &data, &err_msgs); + if (rc != 0 && err_msgs != 0) { + fprintf(stderr,"SQL error: %s\n", err_msgs); + exit(1); + } + } + } else { + /* + * Run commands received from standard input. + */ + if (isatty(fileno(stdout)) && isatty(fileno(stdin))) { + int major, minor, patch; + char *home; + char *history = 0; + printf("%s\nEnter \".help\" for instructions\n", + dbsql_version(&major, &minor, &patch)); + home = find_home_dir(); + if (home && + (history = malloc(strlen(home) + 20)) != 0) { + sprintf(history, "%s/.dbsql_history", home); + } + if (history) + read_history(history); + process_input(&data, 0); + if (history) { + stifle_history(100); + write_history(history); + } + } else { + process_input(&data, stdin); + } + } + set_table_name(&data, 0); + if (g.dbp) { + g.dbenv->close(g.dbenv, 0); + g.dbp->close(g.dbp); + } + return 0; +} + + +int +version_check() +{ + int v_major, v_minor, v_patch; + + /* Make sure we're loaded with the right version of the DB library. */ + (void)dbsql_version(&v_major, &v_minor, &v_patch); + if (v_major != DBSQL_VERSION_MAJOR || v_minor != DBSQL_VERSION_MINOR) { + fprintf(stderr, + "%s: version %d.%d doesn't match library version %d.%d\n", + g.progname, DBSQL_VERSION_MAJOR, DBSQL_VERSION_MINOR, + v_major, v_minor); + return (EXIT_FAILURE); + } + + /* Make sure we're loaded with the right version of the DB library. */ + (void)db_version(&v_major, &v_minor, &v_patch); + if (v_major != DB_VERSION_MAJOR || v_minor != DB_VERSION_MINOR) { + fprintf(stderr, + "%s: version %d.%d doesn't match library version %d.%d\n", + g.progname, DB_VERSION_MAJOR, DB_VERSION_MINOR, + v_major, v_minor); + return (EXIT_FAILURE); + } + return (0); +} diff --git a/src/dbsql_tclsh.c b/src/dbsql_tclsh.c new file mode 100644 index 0000000..e4e9f95 --- /dev/null +++ b/src/dbsql_tclsh.c @@ -0,0 +1,106 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * There are special exceptions to the terms and conditions of the GPL as it + * is applied to this software. View the full text of the exception in file + * LICENSE_EXCEPTIONS in the directory of this software distribution. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: dbsql_tclsh.c 7 2007-02-03 13:34:17Z gburd $ + */ + +/* + * A TCL Shell for testing DBSQL. + */ + +#include "dbsql_config.h" + +#include "dbsql_int.h" +#include "tcl.h" + +#include +#include + +static char main_loop[] = + "set line {}\n" + "while {![eof stdin]} {\n" + "if {$line!=\"\"} {\n" + "puts -nonewline \"> \"\n" + "} else {\n" + "puts -nonewline \"% \"\n" + "}\n" + "flush stdout\n" + "append line [gets stdin]\n" + "if {[info complete $line]} {\n" + "if {[catch {uplevel #0 $line} result]} {\n" + "puts stderr \"Error: $result\"\n" + "} elseif {$result!=\"\"} {\n" + "puts $result\n" + "}\n" + "set line {}\n" + "} else {\n" + "append line \\n\n" + "}\n" + "}\n" +; + +/* + * main -- + */ +int +main(argc, argv) + int argc; + char **argv; +{ + int i; + const char *info; + Tcl_Interp *interp; + Tcl_FindExecutable(argv[0]); + interp = Tcl_CreateInterp(); + dbsql_init_tcl_interface(interp); +#ifdef CONFIG_TEST + extern int Sqlitetest1_Init(Tcl_Interp*); + extern int Sqlitetest2_Init(Tcl_Interp*); + extern int Sqlitetest3_Init(Tcl_Interp*); + extern int Sqlitetest4_Init(Tcl_Interp*); + extern int Md5_Init(Tcl_Interp*); + Sqlitetest1_Init(interp); + Sqlitetest2_Init(interp); + Sqlitetest3_Init(interp); + Sqlitetest4_Init(interp); + Md5_Init(interp); +#endif + if (argc >= 2) { + Tcl_SetVar(interp, "argv0", argv[1], TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "argv", "", TCL_GLOBAL_ONLY); + for (i = 2; i < argc; i++) { + Tcl_SetVar(interp, "argv", argv[i], + TCL_GLOBAL_ONLY | TCL_LIST_ELEMENT | + TCL_APPEND_VALUE); + } + if (Tcl_EvalFile(interp, argv[1]) != TCL_OK) { + info = Tcl_GetVar(interp, "errorInfo", + TCL_GLOBAL_ONLY); + if (info == 0) + info = interp->result; + fprintf(stderr, "%s: %s\n", *argv, info); + return 1; + } + } else { + Tcl_GlobalEval(interp, main_loop); + } + return 0; +} diff --git a/src/inc/clib_ext.h b/src/inc/clib_ext.h new file mode 100644 index 0000000..af96916 --- /dev/null +++ b/src/inc/clib_ext.h @@ -0,0 +1,41 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _clib_ext_h_ +#define _clib_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +#ifndef HAVE_GETOPT +int getopt __P((int, char * const *, const char *)); +#endif +#ifndef HAVE_MEMCMP +int memcmp __P((const void *, const void *, size_t)); +#endif +#ifndef HAVE_SRAND48_R +int srand48_r __P((struct drand48_data *)); +#endif +int rand8_r __P((struct drand48_data *, u_int8_t *)); +int rand32_r __P((struct drand48_data *, u_int32_t *)); +#ifndef HAVE_SNPRINTF +int snprintf __P((char *, size_t, const char *, ...)); +#endif +#ifndef HAVE_STRCASECMP +int strcasecmp __P((const char *, const char *)); +#endif +#ifndef HAVE_STRNCASECMP +int strncasecmp __P((const char *, const char *, size_t)); +#endif +#ifndef HAVE_STRDUP +char *strdup __P((const char *)); +#endif +#ifndef HAVE_STRNDUP +char *strndup __P((const char *, size_t)); +#endif +char *xvprintf __P((DBSQL *, const char *, va_list)); +char *xprintf __P((DBSQL *, const char *, ...)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_clib_ext_h_ */ diff --git a/src/inc/common_ext.h b/src/inc/common_ext.h new file mode 100644 index 0000000..4e4795e --- /dev/null +++ b/src/inc/common_ext.h @@ -0,0 +1,49 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _common_ext_h_ +#define _common_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __dbsql_umalloc __P((DBSQL *, size_t, void *)); +int __dbsql_urealloc __P((DBSQL *, size_t, void *)); +void __dbsql_ufree __P((DBSQL *, void *)); +int __dbsql_strdup __P((DBSQL *, const char *, void *)); +int __dbsql_strndup __P((DBSQL *, const char *, void *, size_t)); +int __dbsql_calloc __P((DBSQL *, size_t, size_t, void *)); +int __dbsql_malloc __P((DBSQL *, size_t, void *)); +int __dbsql_realloc __P((DBSQL *, size_t, void *)); +void __dbsql_free __P((DBSQL *, void *)); +double __dbsql_atof __P((const char *)); +int __dbsql_atoi __P((const char *, int *)); +#ifdef DIAGNOSTIC +void __dbsql_assert __P((const char *, const char *, int)); +#endif +int __dbsql_panic_msg __P((DBSQL *)); +int __dbsql_panic __P((DBSQL *, int)); +void __dbsql_err __P((const DBSQL *, const char *, ...)) __attribute__ ((__format__ (__printf__, 2, 3))); +void __dbsql_errcall __P((const DBSQL *, int, int, const char *, va_list)); +void __dbsql_errfile __P((const DBSQL *, int, int, const char *, va_list)); +void __error_msg __P((parser_t *, const char *, ...)); +void __hash_init __P((hash_t *, int, int)); +void __hash_clear __P((hash_t *)); +void *__hash_find __P((const hash_t *, const void *, int)); +void *__hash_insert __P((hash_t *, const void *, int, void *)); +int __hash_ignore_case __P((const char *, int)); +void __str_append __P((char **, const char *, ...)); +void __str_nappend __P((char **, ...)); +void __str_unquote __P((char *)); +int __str_urealloc __P((char **)); +int __str_is_numeric __P((const char *)); +int __str_glob_cmp __P((const unsigned char *, const unsigned char *)); +int __str_like_cmp __P((const unsigned char *, const unsigned char *)); +int __str_numeric_cmp __P((const char *, const char *)); +int __str_int_in32b __P((const char *)); +void __str_real_as_sortable __P((double, char *)); +int __str_cmp __P((const char *, const char *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_common_ext_h_ */ diff --git a/src/inc/db_int.h b/src/inc/db_int.h new file mode 100644 index 0000000..45af6f4 --- /dev/null +++ b/src/inc/db_int.h @@ -0,0 +1,53 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: db_int.h 7 2007-02-03 13:34:17Z gburd $ + */ + +#ifndef _DB_INT_H_ +#define _DB_INT_H_ + +/* + * These are function prototypes to non-public API parts of DB we use + * in DBSQL. DB may have been compiled with --uniquename, so we have + * to manage that here. We also have to smooth out differences from + * version to version here as internal API is bound to change. + */ + +#if defined(__cplusplus) +extern "C" { +#endif + +extern void *__ua_memcpy__DB_UNIQUE_NAME__ __P((void *, const void *, size_t)); +extern int __os_get_errno__DB_UNIQUE_NAME__ __P((void)); +extern void __os_set_errno__DB_UNIQUE_NAME__ __P((int)); +extern void __os_sleep__DB_UNIQUE_NAME__ __P((DB_ENV *, u_long, u_long)); +extern void __os_free__DB_UNIQUE_NAME__ __P((DB_ENV *, void *)); +extern int __os_realloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, void *)); +extern int __os_malloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, void *)); +extern int __os_calloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, size_t, void *)); +extern int __os_strdup__DB_UNIQUE_NAME__ __P((DB_ENV *, const char *, void *)); +extern void __os_ufree__DB_UNIQUE_NAME__ __P((DB_ENV *, void *)); +extern int __os_urealloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, void *)); +extern int __os_umalloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, void *)); +extern int __os_exists__DB_UNIQUE_NAME__ __P((const char *, int *)); +extern int __db_omode__DB_UNIQUE_NAME__ __P((const char *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_DB_INT_H_ */ diff --git a/src/inc/dbsql_ext.h b/src/inc/dbsql_ext.h new file mode 100644 index 0000000..0dc2f7b --- /dev/null +++ b/src/inc/dbsql_ext.h @@ -0,0 +1,198 @@ +/* DO NOT EDIT: automatically built by dist/s_include. */ +#ifndef _dbsql_ext_h_ +#define _dbsql_ext_h_ + +#if defined(__cplusplus) +extern "C" { +#endif + +int __init_databases __P((DBSQL *, char**)); +int __sqldb_init __P((dbsql_db_t *, DBSQL *, const char *, int, int, int)); +void __api_interrupt __P((DBSQL *)); +int __api_get_table __P((DBSQL *, const char *, char ***, int *, int *, char **)); +void __api_free_table __P((char **)); +void __attach __P((parser_t *, token_t *, token_t *)); +void __detach __P((parser_t *, token_t *)); +int __ref_normalizer_ctx_init __P((ref_normalizer_ctx_t *, parser_t *, int, const char *, const token_t *)); +int __ref_normalize_src_list __P((ref_normalizer_ctx_t *, src_list_t *)); +int __ref_normalize_select __P((ref_normalizer_ctx_t *, select_t *)); +int __ref_normalize_expr __P((ref_normalizer_ctx_t *, expr_t *)); +int __ref_normalize_expr_list __P((ref_normalizer_ctx_t *, expr_list_t *)); +int __ref_normalize_trigger_step __P((ref_normalizer_ctx_t *, trigger_step_t *)); +int __api_set_authorizer __P((DBSQL *, int (*auth)(void*,int,const char*, const char*,const char*, const char*), void *)); +void __auth_read __P((parser_t *, expr_t *, src_list_t *)); +int __auth_check __P((parser_t *, int, const char *, const char *, const char *)); +void __auth_context_push __P((parser_t *, auth_context_t *, const char *)); +void __auth_context_pop __P((auth_context_t *)); +void __parse_begin __P((parser_t *, int)); +void __parse_exec __P((parser_t *)); +table_t *__find_table __P((DBSQL *, const char *, const char *)); +table_t *__locate_table __P((parser_t *, const char *, const char *)); +index_t *__find_index __P((DBSQL *, const char *, const char *)); +void __unlink_and_delete_index __P((DBSQL *, index_t *)); +void __reset_internal_schema __P((DBSQL *, int)); +void __rollback_internal_changes __P((DBSQL *)); +void __commit_internal_changes __P((DBSQL *)); +void __vdbe_delete_table __P((DBSQL *, table_t *)); +char *__table_name_from_token __P((token_t *)); +void __open_master_table __P((vdbe_t *, int)); +void __start_table __P((parser_t *, token_t *, token_t *, int, int)); +void __add_column __P((parser_t *, token_t *)); +void __add_not_null __P((parser_t *, int)); +void __add_column_type __P((parser_t *, token_t *, token_t *)); +void __add_default_value __P((parser_t *, token_t *, int)); +void __add_primary_key __P((parser_t *, id_list_t *, int)); +int __collate_type __P((const char *, int)); +void __add_collate_type __P((parser_t *, int)); +void __change_schema_signature __P((DBSQL *, vdbe_t *)); +void __ending_create_table_paren __P((parser_t *, token_t *, select_t *)); +void __create_view __P((parser_t *, token_t *, token_t *, select_t *, int)); +int __view_get_column_names __P((parser_t *, table_t *)); +table_t *__table_from_token __P((parser_t *, token_t *)); +void __drop_table __P((parser_t *, token_t *name, int)); +void __add_idx_key_type __P((vdbe_t *, index_t *)); +void __create_foreign_key __P((parser_t *, id_list_t *, token_t *, id_list_t *, int)); +void __defer_foreign_key __P((parser_t *, int)); +void __create_index __P((parser_t *, token_t *, src_list_t *, id_list_t *, int, token_t *, token_t *)); +id_list_t *__id_list_append __P((id_list_t *, token_t *)); +src_list_t *__src_list_append __P((src_list_t *, token_t *, token_t *)); +void __src_list_add_alias __P((src_list_t *, token_t *)); +void __id_list_delete __P((id_list_t *)); +int __id_list_index __P((id_list_t *, const char *)); +void __src_list_delete __P((src_list_t *)); +void __dbsql_txn_begin __P((parser_t *, int)); +void __dbsql_txn_commit __P((parser_t *)); +void __dbsql_txn_abort __P((parser_t *)); +void __code_verify_schema __P((parser_t *, int)); +void __vdbe_prepare_write __P((parser_t*, int, int)); +void __vdbe_conclude_write __P((parser_t *)); +void __copy __P((parser_t *, src_list_t *, token_t *, token_t *, int)); +void __register_datetime_funcs __P((DBSQL *)); +table_t *__src_list_lookup __P((parser_t *, src_list_t *)); +int __is_table_read_only __P((parser_t *, table_t *, int)); +void __delete_from __P((parser_t *, src_list_t *, expr_t *)); +void __generate_row_delete __P((DBSQL *, vdbe_t *, table_t *, int, int)); +void __generate_row_index_delete __P((DBSQL *, vdbe_t *, table_t *, int, char *)); +expr_t *__expr __P((int, expr_t *, expr_t *, token_t *)); +void __expr_span __P((expr_t *, token_t *, token_t *)); +expr_t *__expr_function __P((expr_list_t *, token_t *)); +void __expr_delete __P((expr_t *)); +expr_t *__expr_dup __P((expr_t *)); +void __token_copy __P((token_t *, token_t *)); +expr_list_t *__expr_list_dup __P((expr_list_t *)); +src_list_t *__src_list_dup __P((src_list_t *)); +id_list_t *__id_list_dup __P((id_list_t *)); +select_t *__select_dup __P((select_t *)); +expr_list_t *__expr_list_append __P((expr_list_t *, expr_t *, token_t *)); +void __expr_list_delete __P((expr_list_t *)); +int __expr_is_constant __P((expr_t *)); +int __expr_is_integer __P((expr_t *, int *)); +int __is_row_id __P((const char *)); +int __expr_resolve_ids __P((parser_t *, src_list_t *, expr_list_t *, expr_t *)); +int __expr_check __P((parser_t *, expr_t *, int, int *)); +int __expr_type __P((expr_t *)); +void __expr_code __P((parser_t *, expr_t *)); +void __expr_if_false __P((parser_t *, expr_t *, int, int)); +int __expr_compare __P((expr_t *, expr_t *)); +int __expr_analyze_aggregates __P((parser_t *, expr_t *)); +func_def_t *__find_function __P((DBSQL *, const char *, int, int, int)); +void __insert __P((parser_t *, src_list_t *, expr_list_t *, select_t *, id_list_t *, int)); +void __generate_constraint_checks __P((parser_t *, table_t *, int, char *, int, int, int, int)); +void __complete_insertion __P((parser_t *, table_t *, int, char *, int, int, int)); +void __pragma __P((parser_t *, token_t *, token_t *, int)); +select_t *__select_new __P((expr_list_t *, src_list_t *, expr_t *, expr_list_t *, expr_t *, expr_list_t *, int, int, int)); +int __join_type __P((parser_t *, token_t *, token_t *, token_t *)); +void __select_delete __P((select_t *)); +void __add_key_type __P((vdbe_t *, expr_list_t *)); +void __select_unbind __P((select_t *)); +vdbe_t *__parser_get_vdbe __P((parser_t *)); +int __select __P((parser_t *, select_t *, int, int, select_t *, int, int *)); +table_t *__select_result_set __P((parser_t *, char *, select_t *)); +void __vdbe_delete_trigger_step __P((trigger_step_t *)); +void __begin_trigger __P((parser_t *, token_t *, int, int, id_list_t *, src_list_t *, int, expr_t *, int)); +void __finish_trigger __P((parser_t *, trigger_step_t *, token_t *)); +trigger_step_t * __trigger_select_step __P((select_t *)); +trigger_step_t *__trigger_insert_step __P((token_t *, id_list_t *, expr_list_t *, select_t *, int)); +trigger_step_t *__trigger_update_step __P((token_t *, expr_list_t *, expr_t *, int)); +trigger_step_t *__trigger_delete_step __P((token_t *, expr_t *)); +void __vdbe_delete_trigger __P((trigger_t *)); +void __drop_trigger __P((parser_t *, src_list_t *)); +void __drop_trigger_ptr __P((parser_t *, trigger_t *, int)); +int __triggers_exist __P((parser_t *, trigger_t *, int, int, int, expr_list_t *)); +void __update __P((parser_t *, src_list_t *, expr_list_t *, expr_t *, int)); +void __vacuum __P((parser_t *, token_t *)); +int __execute_vacuum __P((char **, DBSQL *)); +int __execute_vacuum __P((char **, DBSQL *)); +where_info_t *__where_begin __P((parser_t *, src_list_t *, expr_t *, int, expr_list_t **)); +void __where_end __P((where_info_t *)); +int __safety_on __P((DBSQL *)); +int __safety_off __P((DBSQL *)); +int __safety_check __P((DBSQL *)); +int __sm_bt_compare __P((DB *, const DBT *, const DBT *)); +int __sm_create __P((DBSQL *, const char *, int, int, sm_t **)); +int __sm_close_db __P((sm_t *)); +int __sm_checkpoint __P((sm_t *)); +char *__sm_get_database_name __P((sm_t *)); +int __sm_begin_txn __P((sm_t *)); +int __sm_commit_txn __P((sm_t *)); +int __sm_abort_txn __P((sm_t *)); +int __sm_cursor __P((sm_t *, int, int, sm_cursor_t **)); +int __sm_close_cursor __P((sm_cursor_t *)); +int __sm_moveto __P((sm_cursor_t *, const void *, int, int *)); +int __sm_next __P((sm_cursor_t *, int *)); +int __sm_prev __P((sm_cursor_t *, int *)); +int __sm_key_size __P((sm_cursor_t *, int *)); +int __sm_data_size __P((sm_cursor_t *, int *)); +int __sm_key_compare __P((sm_cursor_t *, const void *, int, int, int *)); +size_t __sm_key __P((sm_cursor_t *, size_t, size_t, const void *)); +size_t __sm_data __P((sm_cursor_t *, size_t, size_t, char *)); +int __sm_first __P((sm_cursor_t *, int *)); +int __sm_last __P((sm_cursor_t *, int *)); +int __sm_insert __P((sm_cursor_t *, const void *, int, const void *, int)); +int __sm_delete __P((sm_cursor_t *)); +int __sm_drop_table __P((sm_t *, int)); +int __sm_clear_table __P((sm_t *, int)); +int __sm_open_table __P((sm_t *, int *)); +int __sm_create_table __P((sm_t *, int *)); +int __sm_create_index __P((sm_t *, int *)); +int __sm_set_format_version __P((sm_t *, int, u_int32_t)); +int __sm_get_format_version __P((sm_t *, u_int32_t *)); +int __sm_set_schema_sig __P((sm_t *, u_int32_t)); +int __sm_get_schema_sig __P((sm_t *, u_int32_t *)); +void __register_builtin_funcs __P((DBSQL *)); +int get_keyword_code __P((const char *, int)); +int __run_sql_parser __P((parser_t *, const char *, char **)); +int __api_step __P((dbsql_stmt_t *, int *, const char ***, const char ***)); +int __vdbe_exec __P((vdbe_t *)); +vdbe_t *__vdbe_create __P((DBSQL *)); +void __vdbe_trace __P((vdbe_t *, FILE *)); +int __vdbe_add_op __P((vdbe_t *, int, int, int)); +int __vdbe_make_label __P((vdbe_t *)); +void __vdbe_resolve_label __P((vdbe_t *, int)); +int __vdbe_current_addr __P((vdbe_t *)); +int __vdbe_add_op_list __P((vdbe_t *, int, const vdbe_op_t *)); +void __vdbe_change_p1 __P((vdbe_t *, int, int)); +void __vdbe_change_p2 __P((vdbe_t *, int, int)); +void __vdbe_change_p3 __P((vdbe_t *, int, const char *, int)); +void __vdbe_dequote_p3 __P((vdbe_t *, int)); +void __vdbe_compress_space __P((vdbe_t *, int)); +int __vdbe_find_op __P((vdbe_t *, int, int)); +vdbe_op_t *__vdbe_get_op __P((vdbe_t *, int)); +void __vdbe_print_op __P((FILE *, int, vdbe_op_t *)); +int __vdbe_list __P((vdbe_t *)); +void __vdbe_make_ready __P((vdbe_t *, int, dbsql_callback, void *, int)); +void __vdbe_sorter_reset __P((vdbe_t *)); +void __vdbe_agg_reset __P((agg_t *)); +void __vdbe_keylist_free __P((keylist_t *)); +void __vdbe_cleanup_cursor __P((cursor_t *)); +int __vdbe_reset __P((vdbe_t *, char **)); +int __vdbe_finalize __P((vdbe_t *, char **)); +int __api_bind __P((dbsql_stmt_t *, int, const char *, int, int)); +void __vdbe_delete __P((vdbe_t *)); +int __vdbe_byte_swap __P((int)); +int __vdbe_cursor_moveto __P((cursor_t *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_dbsql_ext_h_ */ diff --git a/src/inc/dbsql_int.in b/src/inc/dbsql_int.in new file mode 100644 index 0000000..8e82866 --- /dev/null +++ b/src/inc/dbsql_int.in @@ -0,0 +1,1019 @@ +/*- + * DBSQL - A SQL database engine. + * + * Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * http://creativecommons.org/licenses/GPL/2.0/ + * + * $Id: dbsql_int.in 7 2007-02-03 13:34:17Z gburd $ + */ + +#ifndef _DBSQL_INT_H_ +#define _DBSQL_INT_H_ + +/* + * Included by all implementation files this header contains all the + * basic information required. + */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#include +#include +#include +#include +#endif + +#include + +#include "dbsql.h" +#include "sql_parser.h" + +#include "inc/queue.h" +#include "inc/hash.h" +#include "inc/str.h" +#include "inc/vdbe.h" +#include "inc/debug.h" +#include "inc/xvprintf.h" +#include "inc/globals.h" + +/* + * Forward references to structures. + */ +struct column; typedef struct column column_t; +struct table; typedef struct table table_t; +struct index; typedef struct index index_t; +struct expr; typedef struct expr expr_t; +struct expr_list; typedef struct expr_list expr_list_t; +struct parser; typedef struct parser parser_t; +struct token; typedef struct token token_t; +struct id_list; typedef struct id_list id_list_t; +struct src_list; typedef struct src_list src_list_t; +struct where_info; typedef struct where_info where_info_t; +struct where_level; typedef struct where_level where_level_t; +struct select; typedef struct select select_t; +struct agg; typedef struct agg agg_t; +struct agg_expr; typedef struct agg_expr agg_expr_t; +struct agg_elem; typedef struct agg_elem agg_elem_t; +struct keylist; typedef struct keylist keylist_t; +struct cursor; typedef struct cursor cursor_t; +struct func_def; typedef struct func_def func_def_t; +struct trigger; typedef struct trigger trigger_t; +struct trigger_step; typedef struct trigger_step trigger_step_t; +struct trigger_stack; typedef struct trigger_stack trigger_stack_t; +struct foreign_key; typedef struct foreign_key foreign_key_t; +struct auth_context; typedef struct auth_context auth_context_t; + +/* + * A "format version" is used to know how data was written into the keys + * and values of and across the various DBs. As that changes, increment + * this number and write code to automatically upgrade from the older + * version. + */ +#define DBSQL_FORMAT_VERSION 1 + +/* + * The maximum number of attached databases. This must be at least 2 + * in order to support the main database (0) and the temp tables (1). + * And it must be less than 256 because an unsigned character is used + * to stored the database index. + */ +#define MAX_ATTACHED 255 + +/* + * General purpose constants and macros. + */ +#ifndef UINT16_MAX +#define UINT16_MAX 65535 /* Maximum 16-bit unsigned. */ +#endif +#ifndef UINT32_MAX +#define UINT32_MAX 4294967295U /* Maximum 32-bit unsigned. */ +#endif + +#if defined(HAVE_LONG_LONG) && defined(HAVE_UNSIGNED_LONG_LONG) +#ifdef DB_WIN32 +#define INT64_MAX _I64_MAX +#define INT64_MIN _I64_MIN +#define UINT64_MAX _UI64_MAX + +#define INT64_FMT "%l64d" +#define UINT64_FMT "%l64u" +#else +#ifndef INT64_MAX +#define INT64_MAX 9223372036854775807LL +#endif +#ifndef INT64_MIN +#define INT64_MIN (-INT64_MAX-1) +#endif +#ifndef UINT64_MAX +#define UINT64_MAX 18446744073709551615ULL +#endif +#define INT64_FMT "%lld" +#define UINT64_FMT "%llu" +#endif /* DB_WIN32 */ +#endif /* HAVE_LONG_LONG && HAVE_UNSIGNED_LONG_LONG */ + +#define MEGABYTE 1048576 +#define GIGABYTE 1073741824 + +#define MS_PER_SEC 1000 /* Milliseconds in a second. */ +#define USEC_PER_MS 1000 /* Microseconds in a millisecond. */ + +/* Test for a power-of-two (tests true for zero, which doesn't matter here). */ +#define POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0) + +/* + * API return values + * + * Return values that are OK for each different call. Most calls have a + * standard 'return of 0 is only OK value', but some can return one or more + * non-zero values that are really status information and not an error + * condition. + */ +#define DBSQL_RETOK_STD(ret) ((ret) == 0) + +/* + * Each attached SQL database is represented by a set of Berkeley DB + * DB_BTREE databases, a stack of DB_TXNs and a set of open and active + * DBCs. + */ +typedef struct sm { + char *name; /* A copy of our database name */ + DB *primary; /* Meta and n live within this. */ + DB *meta; /* The metadata database */ + DB_SEQUENCE *n; /* The sequence within _main */ + DB_TXN *txn; /* The current transaction */ + DBSQL *dbp; /* A handle to the database manager */ + hash_t dbs; /* Set of open DBs, key: dbi value: DB * */ + int flags; /* Flags for this sm */ +#define SM_INMEM_DB 0x0001 /* If set, DBs should exist in memory */ +#define SM_TEMP_DB 0x0002 /* If set, DB is temporary */ +#define SM_HAS_INIT 0x0004 /* If set, this sm has been initialized */ +} sm_t; + +typedef struct sm_cursor { + sm_t *sm; /* A reference to the storage manager */ + DB *db; /* A reference to the database */ + DBC *dbc; /* The real cursor */ + DB_TXN *txn; /* For use when read only */ + int id; /* The index of the database we traverse */ + int flags; +#define SMC_RO_CURSOR 0x0001 +#define SMC_RW_CURSOR 0x0002 +} sm_cursor_t; + +/* + * Each database managed by the system is an instance of the following + * structure. There are normally two of these structures in the + * DBSQL.aDb[] array. aDb[0] is simply the 1st user database file attached + * as a result of calling DBSQL->open() with a filename. aDb[1] is used to + * hold temporary tables. Additional user databases may be attached by using + * the ATTACH statement during the session. + */ +struct __dbsql_db { + char *zName; /* Name of this database */ + sm_t *pBt; /* The storage manager for this database */ + int schema_sig; /* Database schema version number for this file */ + hash_t tblHash; /* All tables indexed by name */ + hash_t idxHash; /* All (named) indices indexed by name */ + hash_t trigHash; /* All triggers indexed by name */ + hash_t aFKey; /* Foreign keys indexed by to-table */ + u_int8_t inTrans; /* 0: not writable. 1: Transaction. 2: Checkpoint */ + DBSQL *dbp; /* A reference to our managing DBSQL */ + u_int16_t flags; /* Flags associated with this database */ +/* + * The DBSQL_SCHEMA_LOCKED flag is set when the first OP_Transaction or + * OP_Checkpoint opcode is emitted for a database. This prevents multiple + * occurances of those opcodes for the same database in the same program. + * TODO: do we need this? + * + * Similarly, the DBSQL_COOKIE flag is set when the OP_VerifyCookie opcode + * is emitted, and prevents duplicate OP_VerifyCookies from taking up space + * and slowing down execution. TODO: do we need this? + * + * The DBSQL_SCHEMA_LOADED flag is set after the database schema has been + * read into internal hash tables. + * + * DBSQL_UNRESET_VIEWS means that one or more views have column names that + * have been filled out. If the schema changes, these column names might + * changes and so the view will need to be reset. + */ +#define DBSQL_SCHEMA_LOCKED 0x0001 /* OP_Transaction opcode has been emitted */ +#define DBSQL_COOKIE 0x0002 /* OP_VerifyCookie opcode has been emiited*/ +#define DBSQL_SCHEMA_LOADED 0x0004 /* The schema has been loaded */ +#define DBSQL_UNRESET_VIEWS 0x0008 /* Some views have defined column names */ +}; + +#define DB_PROPERTY_HAS_VALUE(D,I,P) (((D)->aDb[I].flags&(P))==(P)) +#define DB_PROPERTY_IS_SET(D,I,P) (((D)->aDb[I].flags&(P))!=0) +#define DB_PROPERTY_SET(D,I,P) ((D)->aDb[I].flags|=(P)) +#define DB_PROPERTY_CLEAR(D,I,P) ((D)->aDb[I].flags&=~(P)) + +/* + * Determine the number of elements in an array. + */ +#define ARRAY_SIZE(X) (sizeof((X))/sizeof((X)[0])) + +/* Set, clear and test flags. */ +#define FLD_CLR(fld, f) (fld) &= ~(f) +#define FLD_ISSET(fld, f) ((fld) & (f)) +#define FLD_SET(fld, f) (fld) |= (f) +#define F_CLR(p, f) (p)->flags &= ~(f) +#define F_ISSET(p, f) ((p)->flags & (f)) +#define F_SET(p, f) (p)->flags |= (f) +#define LF_CLR(f) ((flags) &= ~(f)) +#define LF_ISSET(f) ((flags) & (f)) +#define LF_SET(f) ((flags) |= (f)) + +/* + * Panic the system. + */ +#define PANIC_SET(dbp, val) ((dbp)->panic = (val)) +#define CHECK_FOR_PANIC(dbp) if ((dbp)->panic != 0) \ + { return DBSQL_RUNRECOVERY; } + +/* + * Aligning items to particular sizes or in pages or memory. + * + * db_align_t -- + * Largest integral type, used to align structures in memory. We don't store + * floating point types in structures, so integral types should be sufficient + * (and we don't have to worry about systems that store floats in other than + * power-of-2 numbers of bytes). Additionally this fixes compiler that rewrite + * structure assignments and ANSI C memcpy calls to be in-line instructions + * that happen to require alignment. Note: this alignment isn't sufficient for + * mutexes, which depend on things like cache line alignment. Mutex alignment + * is handled separately, in mutex.h. + * + * db_alignp_t -- + * Integral type that's the same size as a pointer. There are places where + * DB modifies pointers by discarding the bottom bits to guarantee alignment. + * We can't use db_align_t, it may be larger than the pointer, and compilers + * get upset about that. So far we haven't run on any machine where there + * isn't an integral type the same size as a pointer -- here's hoping. + */ +@db_align_t_decl@ +@db_alignp_t_decl@ + +/* + * Convert a pointer to a small integral value. + * + * The (u_int16_t)(db_alignp_t) cast avoids warnings: the (db_alignp_t) cast + * converts the value to an integral type, and the (u_int16_t) cast converts + * it to a small integral type so we don't get complaints when we assign the + * final result to an integral type smaller than db_alignp_t. + */ +#define P_TO_UINT32(p) ((u_int32_t)(db_alignp_t)(p)) + +#define PATH_SEPARATOR "@PATH_SEPARATOR@" + +/* + * Each SQL function is defined by an instance of the following + * structure. A pointer to this structure is stored in the dbsql.aFunc + * hash table. When multiple functions have the same name, the hash table + * points to a linked list of these structures. + */ +struct func_def { + void (*xFunc)(dbsql_func_t*,int,const char**); /* Regular fn */ + void (*xStep)(dbsql_func_t*,int,const char**); /* Aggregate fn step */ + void (*xFinalize)(dbsql_func_t*); /* Aggregate fn finializer */ + int nArg; /* Number of arguments */ + int dataType; /* Datatype of the result */ + void *pUserData; /* User data parameter */ + func_def_t *pNext; /* Next function with same name. */ +}; + +/* + * Information about each column of an SQL table is held in an instance + * of this structure. + */ +struct column { + char *zName; /* Name of this column */ + char *zDflt; /* Default value of this column */ + char *zType; /* Data type for this column */ + u_int8_t notNull; /* True if there is a NOT NULL constraint */ + u_int8_t isPrimKey; /* True if part of the PRIMARY KEY */ + u_int8_t sortOrder; /* Some combination of DBSQL_SO_... values */ +/* + * The allowed sort orders. The TEXT and NUM values use bits that do not + * overlap with DESC and ASC. That way the two can be combined into a + * single number. + */ +#define DBSQL_SO_UNK 0 /* Use the default collating type. (SCT_NUM) */ +#define DBSQL_SO_TEXT 2 /* Sort using memcmp() */ +#define DBSQL_SO_NUM 4 /* Sort using __str_numeric_cmp() */ +#define DBSQL_SO_TYPEMASK 6 /* Mask to extract the collating sequence */ +#define DBSQL_SO_ASC 0 /* Sort in ascending order */ +#define DBSQL_SO_DESC 1 /* Sort in descending order */ +#define DBSQL_SO_DIRMASK 1 /* Mask to extract the sort direction */ +}; + + +/* + * Each SQL table is represented in memory by an instance of the + * following structure. + * + * table_t.zName is the name of the table. The case of the original + * CREATE TABLE statement is stored, but case is not significant for + * comparisons. + * + * table_t.nCol is the number of columns in this table. table_t.aCol is a + * pointer to an array of column_t structures, one for each column. + * + * If the table has an INTEGER PRIMARY KEY, then table_t.iPKey is the index of + * the column that is that key. Otherwise table_t.iPKey is negative. Note + * that the datatype of the PRIMARY KEY must be INTEGER for this field to + * be set. An INTEGER PRIMARY KEY is used as the rowid for each row of + * the table. If a table has no INTEGER PRIMARY KEY, then a random rowid + * is generated for each row of the table. table_t.hasPrimKey is true if + * the table has any PRIMARY KEY, INTEGER or otherwise. + * + * TODO table_t.tnum is the page number for the root BTree page of the + * table in the database file. + * TODO In this case table_t.tnum refers VDBE cursor number that holds the + * table open, not to the root page number. + * If table_t.iDb is the index of the database table backend in DBSQL.aDb[]. + * 0 is for the main database and 1 is for the file that holds temporary + * tables and indices. If table_t.isTransient is true, then the table is + * stored in a file that is automatically deleted when the VDBE cursor to the + * table is closed. + * Transient tables are used to hold the results of a sub-query that appears + * instead of a real table name in the FROM clause of a SELECT statement. +*/ +struct table { + char *zName; /* Name of the table */ + int nCol; /* Number of columns in this table */ + column_t *aCol; /* Information about each column */ + int iPKey; /* If !< 0, use aCol[iPKey] as the primary + key */ + index_t *pIndex; /* List of SQL indexes on this table. */ + int tnum; /* TODO Root BTree node for this table */ + select_t *pSelect; /* NULL for tables. Points to definition if + a view.*/ + u_int8_t readOnly; /* True if this table should not be written + to by the user */ + u_int8_t iDb; /* Index into DBSQL.aDb[] for this table */ + u_int8_t isTransient; /* True if automatically deleted when VDBE + finishes */ + u_int8_t hasPrimKey; /* True if there exists a primary key */ + u_int8_t keyConf; /* What to do in case of uniqueness conflict + on iPKey */ + trigger_t *pTrigger; /* List of SQL triggers on this table */ + foreign_key_t *pFKey; /* Linked list of all foreign keys in this + table */ +}; + +/* + * Each foreign key constraint is an instance of the following structure. + * + * A foreign key is associated with two tables. The "from" table is + * the table that contains the REFERENCES clause that creates the foreign + * key. The "to" table is the table that is named in the REFERENCES clause. + * Consider this example: + * + * CREATE TABLE ex1( + * a INTEGER PRIMARY KEY, + * b INTEGER CONSTRAINT fk1 REFERENCES ex2(x) + * ); + * + * For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2". + * + * Each REFERENCES clause generates an instance of the following structure + * which is attached to the from-table. The to-table need not exist when + * the from-table is created. The existance of the to-table is not checked + * until an attempt is made to insert data into the from-table. + * + * The DBSQL.aFKey hash table stores pointers to this structure + * given the name of a to-table. For each to-table, all foreign keys + * associated with that table are on a linked list using the + * foreign_key_t.pNextTo field. + */ +struct foreign_key { + table_t *pFrom; /* The table that constains the REFERENCES + clause */ + foreign_key_t *pNextFrom;/* Next foreign key in pFrom */ + char *zTo; /* Name of table that the key points to */ + foreign_key_t *pNextTo; /* Next foreign key that points to zTo */ + int nCol; /* Number of columns in this key */ + struct col_map { /* Mapping of columns in pFrom to columns + in zTo */ + int iFrom; /* Index of column in pFrom */ + char *zCol; /* Name of column in zTo. If 0 use + PRIMARY KEY */ + } *aCol; /* One entry for each of nCol column s */ + u_int8_t isDeferred; /* True if constraint checking is deferred + till COMMIT */ + u_int8_t updateConf; /* How to resolve conflicts that occur on + UPDATE */ + u_int8_t deleteConf; /* How to resolve conflicts that occur on + DELETE */ + u_int8_t insertConf; /* How to resolve conflicts that occur on + INSERT */ +}; + +/* + * There are many ways to to resolve a constraint error. ROLLBACK + * processing means that a constraint violation causes the operation + * in process to fail and for the current transaction to be rolled back. + * ABORT processing means the operation in process fails and any prior + * changes from that one operation are backed out, but the transaction + * is not rolled back. FAIL processing means that the operation in progress + * stops and returns an error code. But prior changes due to the same + * operation are not backed out and no rollback occurs. IGNORE means + * that the particular row that caused the constraint error is not + * inserted or updated. Processing continues and no error is returned. + * REPLACE means that preexisting database rows that caused a UNIQUE + * constraint violation are removed so that the new insert or + * update can proceed. Processing continues and no error is reported. + * + * RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys. + * RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the + * same as ROLLBACK for DEFERRED keys. SETNULL means that the foreign + * key is set to NULL. CASCADE means that a DELETE or UPDATE of the + * referenced table row is propagated into the row that holds the + * foreign key. + * + * The following symbolic values are used to record which type + * of action to take. + */ +#define OE_None 0 /* There is no constraint to check */ +#define OE_Rollback 1 /* Fail the operation and rollback the transaction */ +#define OE_Abort 2 /* Back out changes but do no rollback transaction */ +#define OE_Fail 3 /* Stop the operation but leave all prior changes */ +#define OE_Ignore 4 /* Ignore the error. Do not do the INSERT or UPDATE */ +#define OE_Replace 5 /* Delete existing record, then do INSERT or UPDATE */ + +#define OE_Restrict 6 /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */ +#define OE_SetNull 7 /* Set the foreign key value to NULL */ +#define OE_SetDflt 8 /* Set the foreign key value to its default */ +#define OE_Cascade 9 /* Cascade the changes */ + +#define OE_Default 99 /* Do whatever the default action is */ + +/* + * Each SQL index is represented in memory by an + * instance of the following structure. + * + * The columns of the table that are to be indexed are described + * by the aiColumn[] field of this structure. For example, suppose + * we have the following table and index: + * + * CREATE TABLE Ex1(c1 int, c2 int, c3 text); + * CREATE INDEX Ex2 ON Ex1(c3,c1); + * + * In the table_t structure describing Ex1, nCol==3 because there are + * three columns in the table. In the index_t structure describing + * Ex2, nColumn==2 since 2 of the 3 columns of Ex1 are indexed. + * The value of aiColumn is {2, 0}. aiColumn[0]==2 because the + * first column to be indexed (c3) has an index of 2 in Ex1.aCol[]. + * The second column to be indexed (c1) has an index of 0 in + * Ex1.aCol[], hence Ex2.aiColumn[1]==0. + * + * The index_t.onError field determines whether or not the indexed columns + * must be unique and what to do if they are not. When + * index_t.onError=OE_None, it means this is not a unique index. Otherwise + * it is a unique index and the value of index_t.onError indicate the which + * conflict resolution algorithm to employ whenever an attempt is made to + * insert a non-unique element. + */ +struct index { + char *zName; /* Name of this index */ + int nColumn; /* Number of columns in the table used by + this index */ + int *aiColumn; /* Which columns are used by this index. + 1st is 0 */ + table_t *pTable; /* The SQL table being indexed */ + int tnum; /* Page containing root of this index in + database file */ + u_int8_t onError; /* OE_Abort, OE_Ignore, OE_Replace, or + OE_None */ + u_int8_t autoIndex; /* True if is automatically created + (for instance by the use of UNIQUE) */ + u_int8_t iDb; /* Index in DBSQL.aDb[] of where this index + is stored */ + index_t *pNext; /* The next index associated with the same + table */ +}; + +/* + * Each token coming out of the lexer is an instance of this structure. + * Tokens are also used as part of an expression. + * + * Note if token_t.z==0 then token_t.dyn and token_t.n are undefined and + * may contain random values. Do not make any assuptions about token_t.dyn + * and token_t.n when token_t.z==0. + */ +struct token { + const char *z; /* Text of the token. Not NULL-terminated! */ + unsigned dyn : 1; /* True for malloced memory, false for + static */ + unsigned n : 31; /* Number of characters in this token */ +}; + +/* + * Each node of an expression in the parse tree is an instance + * of this structure. + * + * expr_t.op is the opcode. The integer parser token codes are reused + * as opcodes here. For example, the parser defines TK_GE to be an integer + * code representing the ">=" operator. This same integer code is reused + * to represent the greater-than-or-equal-to operator in the expression + * tree. + * + * expr_t.pRight and expr_t.pLeft are subexpressions. expr_t.pList is a list + * of argument if the expression is a function. + * + * expr_t.token is the operator token for this node. For some expressions + * that have subexpressions, expr_t.token can be the complete text that gave + * rise to the expr_t. In the latter case, the token is marked as being + * a compound token. + * + * An expression of the form ID or ID.ID refers to a column in a table. + * For such expressions, expr_t.op is set to TK_COLUMN and expr_t.iTable is + * the integer cursor number of a VDBE cursor pointing to that table and + * expr_t.iColumn is the column number for the specific column. If the + * expression is used as a result in an aggregate SELECT, then the + * value is also stored in the expr_t.iAgg column in the aggregate so that + * it can be accessed after all aggregates are computed. + * + * If the expression is a function, the expr_t.iTable is an integer code + * representing which function. If the expression is an unbound variable + * marker (a question mark character '?' in the original SQL) then the + * expr_t.iTable holds the index number for that variable. + * + * The expr_t.pSelect field points to a SELECT statement. The SELECT might + * be the right operand of an IN operator. Or, if a scalar SELECT appears + * in an expression the opcode is TK_SELECT and expr_t.pSelect is the only + * operand. + */ +struct expr { + u_int8_t op; /* Operation performed by this node */ + u_int8_t dataType; /* Either DBSQL_SO_TEXT or DBSQL_SO_NUM */ + u_int8_t iDb; /* Database referenced by this expression */ + u_int8_t flags; /* Various flags. See below */ +/* + * The following are the meanings of bits in the expr_t.flags field. + */ +#define EP_FromJoin 0x0001 /* Originated in ON or USING clause of a + join */ + expr_t *pLeft, *pRight; /* Left and right subnodes */ + expr_list_t *pList; /* A list of expressions used as function + arguments or in " IN (useAgg==TRUE + pull result from the iAgg-th element of the + aggregator */ + select_t *pSelect; /* When the expression is a sub-select. Also + the right side of " IN (
%s
"); + output_html_string(p->out, + args[i] ? args[i] : p->nullvalue); + fprintf(p->out, "