diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-04-13 17:14:49 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-04-13 17:14:49 +0200 |
commit | c5e123fb66dfd412a0d89293f893871f9a2e7d12 (patch) | |
tree | e4351340a850ae861ce99a4e7824f2f1bd0660a6 | |
parent | b5c64fe14e2b779a715756d47d7d4c7e8e5729ea (diff) | |
download | knot-c5e123fb66dfd412a0d89293f893871f9a2e7d12.tar.gz |
Imported Upstream version 1.0.2upstream/1.0.2
77 files changed, 6485 insertions, 7457 deletions
diff --git a/KNOWN_ISSUES b/KNOWN_ISSUES index 1d87958..bd04534 100644 --- a/KNOWN_ISSUES +++ b/KNOWN_ISSUES @@ -12,3 +12,4 @@ Known bugs * IXFR may be slow when too much (10 000+) RRSets are transfered at once. * Slow start with too many zones. +* Slower compilation of zones (to be fixed soon). @@ -65,14 +65,14 @@ src/libknot/zone/zone-tree.c src/libknot/zone/dname-table.h src/libknot/zone/dname-table.c src/Makefile.am -src/common/slab/malloc.c -src/common/slab/malloc.h src/common/slab/slab.c src/common/slab/slab.h src/common/slab/alloc-common.h src/common/libtap/tap.c src/common/libtap/tap.h src/common/libtap/tap_unit.h +src/common/mempattern.c +src/common/mempattern.h src/common/lists.h src/common/lists.c src/common/base32.h @@ -119,6 +119,8 @@ src/common/fdset_epoll.h src/common/fdset_epoll.c src/common/fdset_kqueue.h src/common/fdset_kqueue.c +src/common/log.c +src/common/log.h src/zcompile/parser-descriptor.h src/zcompile/parser-descriptor.c src/zcompile/parser-util.h @@ -135,8 +137,6 @@ src/knot/ctl/knotc_main.c src/knot/ctl/process.c src/knot/ctl/process.h src/knot/other/debug.h -src/knot/other/log.c -src/knot/other/log.h src/knot/other/error.c src/knot/other/error.h src/knot/stat/gatherer.c diff --git a/Makefile.in b/Makefile.in index 3511c13..e52ea78 100644 --- a/Makefile.in +++ b/Makefile.in @@ -121,7 +121,6 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -149,7 +148,6 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -178,7 +176,6 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -211,6 +208,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -1,3 +1,21 @@ +v1.0.2 - Apr 13, 2012 +--------------------- + +New features: + * Configuration checker (invoked via knotc). + * Specifying source interface for transfers and NOTIFY requests directly. + +Bugfixes: + * Fixed leak when querying non-existing name and zone SOA TTL > minimal. + * Fixed some minor bugs in tansfers. + +Other improvements: + * Improved log messages (added date and time, better specification of XFR remote). + * Improved saving incoming IXFR to journal (memory optimized). + * Now using system scheduler (better for Linux). + * Decreased thread stack size. + + v1.0.1 - Mar 9, 2012 -------------------- @@ -13,8 +13,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, -[m4_warning([this file was generated for autoconf 2.68. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, +[m4_warning([this file was generated for autoconf 2.67. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) diff --git a/config.guess b/config.guess index 40eaed4..c2246a4 100755 --- a/config.guess +++ b/config.guess @@ -1,10 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. -timestamp='2011-05-11' +timestamp='2009-12-30' # 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 @@ -57,7 +57,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -181,7 +181,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -224,7 +224,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -270,10 +270,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 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/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; + exit ;; 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 @@ -299,7 +296,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo s390-ibm-zvmoe exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} @@ -398,23 +395,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 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} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; @@ -484,8 +481,8 @@ EOF echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # 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 ] || \ @@ -498,7 +495,7 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -555,7 +552,7 @@ EOF echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[4567]) + *:AIX:*:[456]) 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 @@ -598,52 +595,52 @@ EOF 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" ;; + 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 + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include <stdlib.h> - #include <unistd.h> + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + 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); - } + 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 @@ -734,22 +731,22 @@ EOF exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; @@ -773,14 +770,14 @@ EOF exit ;; 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 ;; + 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 ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -808,14 +805,14 @@ EOF echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) - case ${UNAME_MACHINE} in + case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; @@ -870,7 +867,7 @@ EOF EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; - esac + esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} @@ -882,13 +879,7 @@ EOF then echo ${UNAME_MACHINE}-unknown-linux-gnu else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf - fi + echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) @@ -901,7 +892,7 @@ EOF echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu @@ -969,7 +960,7 @@ EOF echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu @@ -977,9 +968,6 @@ EOF sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-tilera-linux-gnu - exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; @@ -987,7 +975,7 @@ EOF echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -996,11 +984,11 @@ EOF echo i386-sequent-sysv4 exit ;; 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, + # 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. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) @@ -1032,7 +1020,7 @@ EOF fi exit ;; i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; @@ -1060,13 +1048,13 @@ EOF exit ;; 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 i586. + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp - exit ;; + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; @@ -1101,8 +1089,8 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ @@ -1145,10 +1133,10 @@ EOF echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm @@ -1174,11 +1162,11 @@ EOF exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi - exit ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; @@ -1243,9 +1231,6 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; @@ -1291,13 +1276,13 @@ EOF echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1337,11 +1322,11 @@ main () #include <sys/param.h> printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif @@ -1,10 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. -timestamp='2011-03-23' +timestamp='2010-01-22' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -76,7 +76,7 @@ version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -124,9 +124,8 @@ esac # 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-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os @@ -158,8 +157,8 @@ case $os in os= basic_machine=$1 ;; - -bluegene*) - os=-cnk + -bluegene*) + os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= @@ -175,10 +174,10 @@ case $os in os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -hiux*) os=-hiuxwe2 ;; @@ -283,13 +282,11 @@ case $basic_machine in | moxie \ | mt \ | msp430 \ - | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ - | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | rx \ | score \ @@ -297,24 +294,15 @@ case $basic_machine in | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ | ubicom32 \ | v850 | v850e \ | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown @@ -326,18 +314,6 @@ case $basic_machine in basic_machine=mt-unknown ;; - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. @@ -358,7 +334,7 @@ case $basic_machine in | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ @@ -392,28 +368,26 @@ case $basic_machine in | mmix-* \ | mt-* \ | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile-* | tilegx-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) @@ -438,7 +412,7 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; - abacus) + abacus) basic_machine=abacus-unknown ;; adobe68k) @@ -508,20 +482,11 @@ case $basic_machine in basic_machine=powerpc-ibm os=-cnk ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; c90) basic_machine=c90-cray os=-unicos ;; - cegcc) + cegcc) basic_machine=arm-unknown os=-cegcc ;; @@ -553,7 +518,7 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16 | cr16-*) + cr16) basic_machine=cr16-unknown os=-elf ;; @@ -769,7 +734,7 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze) basic_machine=microblaze-xilinx ;; mingw32) @@ -876,12 +841,6 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -964,10 +923,9 @@ case $basic_machine in ;; power) basic_machine=power-ibm ;; - ppc | ppcbe) basic_machine=powerpc-unknown + ppc) basic_machine=powerpc-unknown ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown @@ -1061,9 +1019,6 @@ case $basic_machine in basic_machine=i860-stratus os=-sysv4 ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; sun2) basic_machine=m68000-sun ;; @@ -1120,8 +1075,20 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - # This must be matched before tile*. - tilegx*) + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + # This must be matched before tile*. + tilegx*) basic_machine=tilegx-unknown os=-linux-gnu ;; @@ -1196,9 +1163,6 @@ case $basic_machine in xps | xps100) basic_machine=xps100-honeywell ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; ymp) basic_machine=ymp-cray os=-unicos @@ -1296,11 +1260,11 @@ esac if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux + -auroraux) + os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` @@ -1337,8 +1301,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1385,7 +1348,7 @@ case $os in -opened*) os=-openedition ;; - -os400*) + -os400*) os=-os400 ;; -wince*) @@ -1434,7 +1397,7 @@ case $os in -sinix*) os=-sysv4 ;; - -tpf*) + -tpf*) os=-tpf ;; -triton*) @@ -1479,8 +1442,8 @@ case $os in -dicos*) os=-dicos ;; - -nacl*) - ;; + -nacl*) + ;; -none) ;; *) @@ -1503,10 +1466,10 @@ else # system, and we'll never get to this point. case $basic_machine in - score-*) + score-*) os=-elf ;; - spu-*) + spu-*) os=-elf ;; *-acorn) @@ -1518,17 +1481,8 @@ case $basic_machine in arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff + c4x-* | tic4x-*) + os=-coff ;; # This must come before the *-dec entry. pdp10-*) @@ -1555,7 +1509,7 @@ case $basic_machine in m68*-cisco) os=-aout ;; - mep-*) + mep-*) os=-elf ;; mips*-cisco) @@ -1582,7 +1536,7 @@ case $basic_machine in *-ibm) os=-aix ;; - *-knuth) + *-knuth) os=-mmixware ;; *-wec) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for knot 1.0.1. +# Generated by GNU Autoconf 2.67 for knot 1.0.2. # # Report bugs to <knot-dns@labs.nic.cz>. # @@ -91,7 +91,6 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -174,15 +173,7 @@ test x\$exitcode = x0 || exit 1" as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1 - - test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ - || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" +test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else @@ -225,18 +216,11 @@ IFS=$as_save_IFS # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -544,8 +528,155 @@ 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$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +ECHO=${lt_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 <<_LT_EOF +$* +_LT_EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { 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. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + test -n "$DJDIR" || exec 7<&0 </dev/null exec 6>&1 @@ -570,8 +701,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='knot' PACKAGE_TARNAME='knot' -PACKAGE_VERSION='1.0.1' -PACKAGE_STRING='knot 1.0.1' +PACKAGE_VERSION='1.0.2' +PACKAGE_STRING='knot 1.0.2' PACKAGE_BUGREPORT='knot-dns@labs.nic.cz' PACKAGE_URL='' @@ -627,11 +758,9 @@ OTOOL LIPO NMEDIT DSYMUTIL -MANIFEST_TOOL +lt_ECHO RANLIB -ac_ct_AR AR -DLLTOOL OBJDUMP LN_S NM @@ -743,7 +872,6 @@ enable_static with_pic enable_fast_install with_gnu_ld -with_sysroot enable_libtool_lock enable_ldns enable_debug @@ -1165,7 +1293,7 @@ Try \`$0 --help' for more information" $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac @@ -1303,7 +1431,7 @@ 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 knot 1.0.1 to adapt to many kinds of systems. +\`configure' configures knot 1.0.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1373,7 +1501,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of knot 1.0.1:";; + short | recursive ) echo "Configuration of knot 1.0.2:";; esac cat <<\_ACEOF @@ -1406,8 +1534,6 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-sysroot=DIR Search for dependent libraries within DIR - (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command @@ -1418,9 +1544,8 @@ Some influential environment variables: CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> CPP C preprocessor - YACC The `Yet Another Compiler Compiler' implementation to use. - Defaults to the first program found out of: `bison -y', `byacc', - `yacc'. + YACC The `Yet Another C Compiler' implementation to use. Defaults to + the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. @@ -1491,8 +1616,8 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -knot configure 1.0.1 -generated by GNU Autoconf 2.68 +knot configure 1.0.2 +generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1538,7 +1663,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1575,7 +1700,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1588,10 +1713,10 @@ fi ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : + if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1658,7 +1783,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1667,7 +1792,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel @@ -1708,7 +1833,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1722,7 +1847,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1740,7 +1865,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile @@ -1785,7 +1910,7 @@ fi # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1798,7 +1923,7 @@ ac_fn_c_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1853,7 +1978,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func @@ -1866,7 +1991,7 @@ ac_fn_c_check_type () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1907,7 +2032,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_type @@ -1920,7 +2045,7 @@ ac_fn_c_find_intX_t () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1981,7 +2106,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_find_intX_t @@ -1994,7 +2119,7 @@ ac_fn_c_find_uintX_t () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -2034,15 +2159,15 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_find_uintX_t 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 knot $as_me 1.0.1, which was -generated by GNU Autoconf 2.68. Invocation command line was +It was created by knot $as_me 1.0.2, which was +generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2300,7 +2425,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi done @@ -2440,7 +2565,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : +if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2527,11 +2652,11 @@ am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; esac # Do `set' in a subshell so we don't clobber the current shell's @@ -2617,7 +2742,7 @@ if test "$cross_compiling" != no; then set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : +if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -2657,7 +2782,7 @@ if test -z "$ac_cv_prog_STRIP"; then set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -2710,7 +2835,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : + if test "${ac_cv_path_mkdir+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2761,7 +2886,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : +if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -2801,7 +2926,7 @@ done $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -2859,7 +2984,7 @@ fi # Define the identity of the package. PACKAGE='knot' - VERSION='1.0.1' + VERSION='1.0.2' cat >>confdefs.h <<_ACEOF @@ -2975,7 +3100,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3015,7 +3140,7 @@ if test -z "$ac_cv_prog_CC"; then set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3068,7 +3193,7 @@ if test -z "$CC"; then set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3108,7 +3233,7 @@ if test -z "$CC"; then set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3167,7 +3292,7 @@ if test -z "$CC"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3211,7 +3336,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3266,7 +3391,7 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3381,7 +3506,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3424,7 +3549,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3483,7 +3608,7 @@ $as_echo "$ac_try_echo"; } >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi fi fi @@ -3494,7 +3619,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : +if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3535,7 +3660,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3545,7 +3670,7 @@ OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : +if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3582,7 +3707,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : +if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3660,7 +3785,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : +if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -3759,7 +3884,7 @@ depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -3895,7 +4020,7 @@ if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : + if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -4011,7 +4136,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c @@ -4023,7 +4148,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : +if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4086,7 +4211,7 @@ $as_echo "$ac_cv_path_GREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : +if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -4153,7 +4278,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : +if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4282,7 +4407,7 @@ done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = xyes; then : +if test "x$ac_cv_header_minix_config_h" = x""yes; then : MINIX=yes else MINIX= @@ -4304,7 +4429,7 @@ $as_echo "#define _MINIX 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if ${ac_cv_safe_to_define___extensions__+:} false; then : +if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4350,7 +4475,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid output" >&5 $as_echo_n "checking for x86 cpuid output... " >&6; } -if ${ax_cv_gcc_x86_cpuid_+:} false; then : +if test "${ax_cv_gcc_x86_cpuid_+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -4430,7 +4555,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 0x00000001 output" >&5 $as_echo_n "checking for x86 cpuid 0x00000001 output... " >&6; } -if ${ax_cv_gcc_x86_cpuid_0x00000001+:} false; then : +if test "${ax_cv_gcc_x86_cpuid_0x00000001+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -4505,7 +4630,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mmx is supported" >&5 $as_echo_n "checking whether mmx is supported... " >&6; } -if ${ax_cv_have_mmx_ext+:} false; then : +if test "${ax_cv_have_mmx_ext+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -4522,7 +4647,7 @@ $as_echo "$ax_cv_have_mmx_ext" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sse is supported" >&5 $as_echo_n "checking whether sse is supported... " >&6; } -if ${ax_cv_have_sse_ext+:} false; then : +if test "${ax_cv_have_sse_ext+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -4539,13 +4664,15 @@ $as_echo "$ax_cv_have_sse_ext" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sse2 is supported" >&5 $as_echo_n "checking whether sse2 is supported... " >&6; } -if ${ax_cv_have_sse2_ext+:} false; then : +if test "${ax_cv_have_sse2_ext+set}" = set; then : $as_echo_n "(cached) " >&6 else ax_cv_have_sse2_ext=no - if test "$((0x$edx>>26&0x01))" = 1; then - ax_cv_have_sse2_ext=yes + if test "$ax_cv_gcc_x86_cpuid_0x00000001" != "unknown"; then + if test "$((0x$edx>>26&0x01))" = 1; then + ax_cv_have_sse2_ext=yes + fi fi fi @@ -4554,7 +4681,7 @@ $as_echo "$ax_cv_have_sse2_ext" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sse3 is supported" >&5 $as_echo_n "checking whether sse3 is supported... " >&6; } -if ${ax_cv_have_sse3_ext+:} false; then : +if test "${ax_cv_have_sse3_ext+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -4571,7 +4698,7 @@ $as_echo "$ax_cv_have_sse3_ext" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ssse3 is supported" >&5 $as_echo_n "checking whether ssse3 is supported... " >&6; } -if ${ax_cv_have_ssse3_ext+:} false; then : +if test "${ax_cv_have_ssse3_ext+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -4592,7 +4719,7 @@ $as_echo "#define HAVE_MMX /**/" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -mmmx" >&5 $as_echo_n "checking whether C compiler accepts -mmmx... " >&6; } -if ${ax_cv_c_flags__mmmx+:} false; then : +if test "${ax_cv_c_flags__mmmx+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -4635,7 +4762,7 @@ $as_echo "#define HAVE_SSE /**/" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -msse" >&5 $as_echo_n "checking whether C compiler accepts -msse... " >&6; } -if ${ax_cv_c_flags__msse+:} false; then : +if test "${ax_cv_c_flags__msse+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -4678,7 +4805,7 @@ $as_echo "#define HAVE_SSE2 /**/" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -msse2" >&5 $as_echo_n "checking whether C compiler accepts -msse2... " >&6; } -if ${ax_cv_c_flags__msse2+:} false; then : +if test "${ax_cv_c_flags__msse2+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -4721,7 +4848,7 @@ $as_echo "#define HAVE_SSE3 /**/" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -msse3" >&5 $as_echo_n "checking whether C compiler accepts -msse3... " >&6; } -if ${ax_cv_c_flags__msse3+:} false; then : +if test "${ax_cv_c_flags__msse3+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -4801,8 +4928,8 @@ esac -macro_version='2.4' -macro_revision='1.3293' +macro_version='2.2.6b' +macro_revision='1.3017' @@ -4824,7 +4951,7 @@ $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : +if test "${ac_cv_build+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias @@ -4840,7 +4967,7 @@ fi $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -4858,7 +4985,7 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : +if test "${ac_cv_host+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then @@ -4873,7 +5000,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -4889,78 +5016,9 @@ IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -# Backslashify metacharacters that are still active within -# double-quoted strings. -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 delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} - -case "$ECHO" in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; -esac - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : +if test "${ac_cv_path_SED+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ @@ -5042,7 +5100,7 @@ Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : +if test "${ac_cv_path_FGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 @@ -5173,7 +5231,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi -if ${lt_cv_path_LD+:} false; then : +if test "${lt_cv_path_LD+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then @@ -5213,7 +5271,7 @@ fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : +if test "${lt_cv_prog_gnu_ld+set}" = set; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. @@ -5240,7 +5298,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : +if test "${lt_cv_path_NM+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then @@ -5293,17 +5351,14 @@ if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" + if test -n "$ac_tool_prefix"; then + for ac_prog in "dumpbin -symbols" "link -dump -symbols" 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : +if test "${ac_cv_prog_DUMPBIN+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then @@ -5341,13 +5396,13 @@ fi fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" + for ac_prog in "dumpbin -symbols" "link -dump -symbols" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : +if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then @@ -5396,15 +5451,6 @@ esac fi fi - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" @@ -5419,18 +5465,18 @@ test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : +if test "${lt_cv_nm_interface+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval echo "\"\$as_me:5473: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:5476: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) + (eval echo "\"\$as_me:5479: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5454,7 +5500,7 @@ fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : +if test "${lt_cv_sys_max_cmd_len+set}" = set; then : $as_echo_n "(cached) " >&6 else i=0 @@ -5487,11 +5533,6 @@ else lt_cv_sys_max_cmd_len=8192; ;; - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. @@ -5556,8 +5597,8 @@ else # 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"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && + while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` @@ -5599,8 +5640,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ + test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes @@ -5649,83 +5690,9 @@ esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac - -fi - -to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - #assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac - -fi - -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : +if test "${lt_cv_ld_reload_flag+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' @@ -5739,11 +5706,6 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test "$GCC" != yes; then - reload_cmds=false - fi - ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' @@ -5766,7 +5728,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : +if test "${ac_cv_prog_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then @@ -5806,7 +5768,7 @@ if test -z "$ac_cv_prog_OBJDUMP"; then set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : +if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then @@ -5865,7 +5827,7 @@ test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : +if test "${lt_cv_deplibs_check_method+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' @@ -5907,18 +5869,16 @@ mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. - if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -cegcc*) +cegcc) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' @@ -5948,10 +5908,6 @@ gnu*) lt_cv_deplibs_check_method=pass_all ;; -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in @@ -5960,11 +5916,11 @@ hpux10.20* | hpux11*) 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])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + 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_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 @@ -6067,21 +6023,6 @@ esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` - fi - ;; - esac -fi - 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 @@ -6097,165 +6038,12 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - - - - - - - if test -n "$ac_tool_prefix"; then - for ac_prog in ar - 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 + # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : +if test "${ac_cv_prog_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -6268,7 +6056,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + ac_cv_prog_AR="${ac_tool_prefix}ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -6288,18 +6076,14 @@ $as_echo "no" >&6; } fi - test -n "$AR" && break - done fi -if test -z "$AR"; then +if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR - for ac_prog in ar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then @@ -6312,7 +6096,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="$ac_prog" + ac_cv_prog_ac_ct_AR="ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -6331,10 +6115,6 @@ else $as_echo "no" >&6; } fi - - test -n "$ac_ct_AR" && break -done - if test "x$ac_ct_AR" = x; then AR="false" else @@ -6346,10 +6126,12 @@ ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi +else + AR="$ac_cv_prog_AR" fi -: ${AR=ar} -: ${AR_FLAGS=cru} +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru @@ -6361,70 +6143,12 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ar_at_file=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : +if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -6464,7 +6188,7 @@ if test -z "$ac_cv_prog_STRIP"; then set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -6523,7 +6247,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : +if test "${ac_cv_prog_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -6563,7 +6287,7 @@ if test -z "$ac_cv_prog_RANLIB"; then set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -6634,18 +6358,6 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac - - - - - - @@ -6692,7 +6404,7 @@ compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -6753,8 +6465,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \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\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -6790,7 +6502,6 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -6816,8 +6527,8 @@ _LT_EOF test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$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 + if { { eval echo "\"\$as_me\":${as_lineno-$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=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then @@ -6832,18 +6543,6 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - #ifdef __cplusplus extern "C" { #endif @@ -6855,7 +6554,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ -LT_DLSYM_CONST struct { +const struct { const char *name; void *address; } @@ -6881,8 +6580,8 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS + 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\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 @@ -6892,8 +6591,8 @@ _LT_EOF test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi @@ -6930,19 +6629,6 @@ else $as_echo "ok" >&6; } fi -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - - - - - - - @@ -6963,42 +6649,6 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } - -# Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : - withval=$with_sysroot; -else - with_sysroot=no -fi - - -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 -$as_echo "${with_sysroot}" >&6; } - as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } - - - - # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : @@ -7031,7 +6681,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext + echo '#line 6684 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7125,7 +6775,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : +if test "${lt_cv_cc_needs_belf+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_ext=c @@ -7193,123 +6843,6 @@ esac need_locks="$enable_libtool_lock" -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. -set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MANIFEST_TOOL"; then - ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL -if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_MANIFEST_TOOL"; then - ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL - # Extract the first word of "mt", so it can be a program name with args. -set dummy mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_MANIFEST_TOOL"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL -if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_MANIFEST_TOOL" = x; then - MANIFEST_TOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL - fi -else - MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" -fi - -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&5 - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi - - - - - case $host_os in rhapsody* | darwin*) @@ -7318,7 +6851,7 @@ fi set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : +if test "${ac_cv_prog_DSYMUTIL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then @@ -7358,7 +6891,7 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : +if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then @@ -7410,7 +6943,7 @@ fi set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : +if test "${ac_cv_prog_NMEDIT+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then @@ -7450,7 +6983,7 @@ if test -z "$ac_cv_prog_NMEDIT"; then set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : +if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then @@ -7502,7 +7035,7 @@ fi set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : +if test "${ac_cv_prog_LIPO+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then @@ -7542,7 +7075,7 @@ if test -z "$ac_cv_prog_LIPO"; then set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : +if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then @@ -7594,7 +7127,7 @@ fi set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : +if test "${ac_cv_prog_OTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then @@ -7634,7 +7167,7 @@ if test -z "$ac_cv_prog_OTOOL"; then set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : +if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then @@ -7686,7 +7219,7 @@ fi set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : +if test "${ac_cv_prog_OTOOL64+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then @@ -7726,7 +7259,7 @@ if test -z "$ac_cv_prog_OTOOL64"; then set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : +if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then @@ -7801,7 +7334,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : +if test "${lt_cv_apple_cc_single_mod+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no @@ -7830,7 +7363,7 @@ fi $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : +if test "${lt_cv_ld_exported_symbols_list+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no @@ -7860,38 +7393,6 @@ rm -f core conftest.err conftest.$ac_objext \ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 - echo "$RANLIB libconftest.a" >&5 - $RANLIB libconftest.a 2>&5 - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&5 - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; @@ -7919,7 +7420,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; } else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + if test "$DSYMUTIL" != ":"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -7931,7 +7432,7 @@ for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " -if test "x$ac_cv_header_dlfcn_h" = xyes; then : +if test "x$ac_cv_header_dlfcn_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF @@ -7942,8 +7443,6 @@ done - - # Set options @@ -8096,7 +7595,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' - test -z "$LN_S" && LN_S="ln -s" @@ -8118,7 +7616,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : +if test "${lt_cv_objdir+set}" = set; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null @@ -8146,6 +7644,19 @@ _ACEOF + + + + + + + + + + + + + case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some @@ -8158,6 +7669,23 @@ aix3*) ;; esac +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +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 delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + # Global variables: ofile=libtool can_build_shared=yes @@ -8186,7 +7714,7 @@ for cc_temp in $compiler""; do *) break;; esac done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it @@ -8196,7 +7724,7 @@ file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in @@ -8262,7 +7790,7 @@ if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in @@ -8395,16 +7923,11 @@ if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; - esac + lt_prog_compiler_no_builtin_flag=' -fno-builtin' { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no @@ -8420,15 +7943,15 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7946: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:7950: \$? = $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 other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes @@ -8457,6 +7980,8 @@ fi lt_prog_compiler_pic= lt_prog_compiler_static= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' @@ -8504,12 +8029,6 @@ lt_prog_compiler_static= lt_prog_compiler_pic='-fno-common' ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= - ;; - hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag @@ -8552,13 +8071,6 @@ lt_prog_compiler_static= lt_prog_compiler_pic='-fPIC' ;; esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl='-Xlinker ' - lt_prog_compiler_pic='-Xcompiler -fPIC' - ;; - esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in @@ -8621,13 +8133,7 @@ lt_prog_compiler_static= lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -8639,26 +8145,26 @@ lt_prog_compiler_static= # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in - *Sun\ F* | *Sun*Fortran*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; esac ;; esac @@ -8689,7 +8195,7 @@ lt_prog_compiler_static= lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; @@ -8746,17 +8252,13 @@ case $host_os in lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 +$as_echo "$lt_prog_compiler_pic" >&6; } + + + + -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic=$lt_prog_compiler_pic -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } -lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. @@ -8764,7 +8266,7 @@ lt_prog_compiler_pic=$lt_cv_prog_compiler_pic if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : +if test "${lt_cv_prog_compiler_pic_works+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no @@ -8780,15 +8282,15 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8285: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:8289: \$? = $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 other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes @@ -8817,18 +8319,13 @@ fi - - - - - # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : +if test "${lt_cv_prog_compiler_static_works+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no @@ -8841,7 +8338,7 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes @@ -8871,7 +8368,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : +if test "${lt_cv_prog_compiler_c_o+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no @@ -8890,16 +8387,16 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8390: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:8394: \$? = $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 - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes @@ -8926,7 +8423,7 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : +if test "${lt_cv_prog_compiler_c_o+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no @@ -8945,16 +8442,16 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8445: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:8449: \$? = $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 - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes @@ -9064,39 +8561,13 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie openbsd*) with_gnu_ld=no ;; - linux* | k*bsd*-gnu | gnu*) + linux* | k*bsd*-gnu) link_all_deplibs=no ;; esac ld_shlibs=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; - *\ \(GNU\ Binutils\)\ [3-9]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' @@ -9130,12 +8601,11 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie ld_shlibs=no cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.19, is reported +*** 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 install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. _LT_EOF fi @@ -9171,12 +8641,10 @@ _LT_EOF # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='${wl}--export-all-symbols' 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 '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -9194,11 +8662,6 @@ _LT_EOF fi ;; - haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs=yes - ;; - interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no @@ -9224,16 +8687,15 @@ _LT_EOF if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag=' $pic_flag' + tmp_addflag= tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -9244,17 +8706,13 @@ _LT_EOF lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; - xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 @@ -9270,17 +8728,17 @@ _LT_EOF fi case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) + xlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -9294,8 +8752,8 @@ _LT_EOF archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + 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 ;; @@ -9313,8 +8771,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + 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 @@ -9360,8 +8818,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + 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 @@ -9401,10 +8859,8 @@ _LT_EOF 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 - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". 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") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + 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 @@ -9492,13 +8948,7 @@ _LT_EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -9511,32 +8961,25 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# 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 "$lt_aix_libpath_sed"` +fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi +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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${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' @@ -9545,13 +8988,7 @@ fi else # Determine the default libpath from the value encoded in an # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -9564,42 +9001,30 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# 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 "$lt_aix_libpath_sed"` +fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi +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' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - fi + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' @@ -9631,63 +9056,20 @@ fi # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - always_export_symbols=yes - file_list_spec='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, )='true' - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - old_postinstall_cmds='chmod 644 $oldlib' - postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - 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_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''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' - enable_shared_with_static_runtimes=yes - ;; - esac + 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_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -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*) @@ -9697,11 +9079,7 @@ fi hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - whole_archive_flag_spec='' - fi + whole_archive_flag_spec='' link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in @@ -9709,7 +9087,7 @@ fi *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all + output_verbose_link_cmd=echo archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" @@ -9752,7 +9130,7 @@ fi # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no @@ -9760,7 +9138,7 @@ fi hpux9*) if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + 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 @@ -9775,8 +9153,8 @@ fi ;; hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi @@ -9794,16 +9172,16 @@ fi ;; hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then + if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -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 @@ -9815,46 +9193,7 @@ fi archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler__b=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -b" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker 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 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler__b=yes - fi - else - lt_cv_prog_compiler__b=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } - -if test x"$lt_cv_prog_compiler__b" = xyes; then - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -fi - + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi @@ -9882,39 +9221,26 @@ fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int foo (void) { return 0; } +int foo(void) {} _ACEOF if ac_fn_c_try_link "$LINENO"; then : - lt_cv_irix_exported_symbol=yes -else - lt_cv_irix_exported_symbol=no + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test "$lt_cv_irix_exported_symbol" = yes; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi + LDFLAGS="$save_LDFLAGS" else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' @@ -9976,17 +9302,17 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } 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' + 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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' @@ -9996,13 +9322,13 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } 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} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -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; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -10015,9 +9341,9 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared ${wl}-z ${wl}text ${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 $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) @@ -10205,50 +9531,44 @@ x|xyes) # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - 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\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + 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\":${as_lineno-$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=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } - archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + 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* + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 +$as_echo "$archive_cmds_need_lc" >&6; } ;; esac fi @@ -10419,23 +9739,16 @@ if test "$GCC" = yes; then darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_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. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= @@ -10448,7 +9761,7 @@ if test "$GCC" = yes; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' + lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; @@ -10468,13 +9781,7 @@ BEGIN {RS=" "; FS="/|\n";} { if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([A-Za-z]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi @@ -10562,7 +9869,7 @@ amigaos*) m68k) 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=`func_echo_all "$lib" | $SED '\''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' + 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' ;; esac ;; @@ -10593,9 +9900,8 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no - case $GCC,$cc_basename in - yes,*) - # gcc + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -10616,83 +9922,36 @@ cygwin* | mingw* | pw32* | cegcc*) 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="$sys_lib_search_path_spec /usr/lib/w32api" + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - 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 - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" + 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. + # 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"` + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + 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 - - # 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 - dynamic_linker='Win32 link.exe' ;; *) - # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' ;; esac + dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -10776,20 +10035,6 @@ gnu*) 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=no - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - 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=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; @@ -10835,10 +10080,8 @@ hpux9* | hpux10* | hpux11*) soname_spec='${libname}${release}${shared_ext}$major' ;; esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 ;; interix[3-9]*) @@ -10905,17 +10148,12 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu) finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -10928,17 +10166,13 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes + shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install @@ -10947,7 +10181,7 @@ fi # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -11262,11 +10496,6 @@ fi - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= @@ -11339,7 +10568,7 @@ else # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11373,7 +10602,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else @@ -11387,12 +10616,12 @@ fi *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : +if test "x$ac_cv_func_shl_load" = x""yes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : +if test "${ac_cv_lib_dld_shl_load+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11426,16 +10655,16 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : +if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : +if test "x$ac_cv_func_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11469,12 +10698,12 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : +if test "${ac_cv_lib_svld_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11508,12 +10737,12 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : +if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : +if test "${ac_cv_lib_dld_dld_link+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11547,7 +10776,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : +if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi @@ -11588,7 +10817,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : +if test "${lt_cv_dlopen_self+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -11597,7 +10826,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" +#line 10829 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11638,13 +10867,7 @@ else # endif #endif -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } +void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -11653,11 +10876,7 @@ int main () if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else @@ -11694,7 +10913,7 @@ $as_echo "$lt_cv_dlopen_self" >&6; } wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : +if test "${lt_cv_dlopen_self_static+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -11703,7 +10922,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" +#line 10925 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11744,13 +10963,7 @@ else # endif #endif -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } +void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -11759,11 +10972,7 @@ int main () if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else @@ -11953,7 +11162,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -11993,7 +11202,7 @@ if test -z "$ac_cv_prog_CC"; then set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -12046,7 +11255,7 @@ if test -z "$CC"; then set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -12086,7 +11295,7 @@ if test -z "$CC"; then set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -12145,7 +11354,7 @@ if test -z "$CC"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -12189,7 +11398,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -12244,7 +11453,7 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -12273,7 +11482,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : +if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12310,7 +11519,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : +if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -12388,7 +11597,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : +if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -12487,7 +11696,7 @@ depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -12613,7 +11822,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for reentrant lex" >&5 $as_echo_n "checking for reentrant lex... " >&6; } -if ${ac_cv_path_LEX+:} false; then : +if test "${ac_cv_path_LEX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$LEX"; then @@ -12681,7 +11890,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LEX+:} false; then : +if test "${ac_cv_prog_LEX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then @@ -12751,7 +11960,7 @@ $as_echo "$ac_try_echo"; } >&5 test $ac_status = 0; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } -if ${ac_cv_prog_lex_root+:} false; then : +if test "${ac_cv_prog_lex_root+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12770,7 +11979,7 @@ LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } -if ${ac_cv_lib_lex+:} false; then : +if test "${ac_cv_lib_lex+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -12800,7 +12009,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } -if ${ac_cv_prog_lex_yytext_pointer+:} false; then : +if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then : $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the @@ -12811,8 +12020,7 @@ ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - #define YYTEXT_POINTER 1 +#define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : @@ -12843,7 +12051,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_YACC+:} false; then : +if test "${ac_cv_prog_YACC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then @@ -12890,7 +12098,7 @@ fi ac_c_preproc_warn_flag=yes { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } -if ${ac_cv_prog_cc_c99+:} false; then : +if test "${ac_cv_prog_cc_c99+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no @@ -13071,7 +12279,7 @@ if test "${enable_ldns+set}" = set; then : enableval=$enable_ldns; case "${enableval}" in yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ldns_rr_list_pop_rrset" >&5 $as_echo_n "checking for library containing ldns_rr_list_pop_rrset... " >&6; } -if ${ac_cv_search_ldns_rr_list_pop_rrset+:} false; then : +if test "${ac_cv_search_ldns_rr_list_pop_rrset+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -13105,11 +12313,11 @@ for ac_lib in '' ldns; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_ldns_rr_list_pop_rrset+:} false; then : + if test "${ac_cv_search_ldns_rr_list_pop_rrset+set}" = set; then : break fi done -if ${ac_cv_search_ldns_rr_list_pop_rrset+:} false; then : +if test "${ac_cv_search_ldns_rr_list_pop_rrset+set}" = set; then : else ac_cv_search_ldns_rr_list_pop_rrset=no @@ -13130,7 +12338,7 @@ else fi ;; no) ldns=false ;; - *) as_fn_error $? "bad value ${enableval} for --enable-ldns" "$LINENO" 5 ;; + *) as_fn_error $? "bad value ${enableval} for --enable-ldns" "$LINENO" 5 ;; esac else ldns=false @@ -13242,7 +12450,7 @@ CFLAGS="$CFLAGS -I/usr/local/include $SIMD_FLAGS" LDFLAGS="$LDFLAGS -L/usr/local/lib" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pow" >&5 $as_echo_n "checking for library containing pow... " >&6; } -if ${ac_cv_search_pow+:} false; then : +if test "${ac_cv_search_pow+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -13276,11 +12484,11 @@ for ac_lib in '' m; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_pow+:} false; then : + if test "${ac_cv_search_pow+set}" = set; then : break fi done -if ${ac_cv_search_pow+:} false; then : +if test "${ac_cv_search_pow+set}" = set; then : else ac_cv_search_pow=no @@ -13298,7 +12506,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create" >&5 $as_echo_n "checking for library containing pthread_create... " >&6; } -if ${ac_cv_search_pthread_create+:} false; then : +if test "${ac_cv_search_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -13332,11 +12540,11 @@ for ac_lib in '' pthread; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_pthread_create+:} false; then : + if test "${ac_cv_search_pthread_create+set}" = set; then : break fi done -if ${ac_cv_search_pthread_create+:} false; then : +if test "${ac_cv_search_pthread_create+set}" = set; then : else ac_cv_search_pthread_create=no @@ -13356,7 +12564,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing rcu_set_pointer_sym" >&5 $as_echo_n "checking for library containing rcu_set_pointer_sym... " >&6; } -if ${ac_cv_search_rcu_set_pointer_sym+:} false; then : +if test "${ac_cv_search_rcu_set_pointer_sym+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -13390,11 +12598,11 @@ for ac_lib in '' urcu; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_rcu_set_pointer_sym+:} false; then : + if test "${ac_cv_search_rcu_set_pointer_sym+set}" = set; then : break fi done -if ${ac_cv_search_rcu_set_pointer_sym+:} false; then : +if test "${ac_cv_search_rcu_set_pointer_sym+set}" = set; then : else ac_cv_search_rcu_set_pointer_sym=no @@ -13412,9 +12620,65 @@ else as_fn_error $? "liburcu not found" "$LINENO" 5 fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing urcu_init" >&5 +$as_echo_n "checking for library containing urcu_init... " >&6; } +if test "${ac_cv_search_urcu_init+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 urcu_init (); +int +main () +{ +return urcu_init (); + ; + return 0; +} +_ACEOF +for ac_lib in '' urcu; 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 + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_urcu_init=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_urcu_init+set}" = set; then : + break +fi +done +if test "${ac_cv_search_urcu_init+set}" = set; then : + +else + ac_cv_search_urcu_init=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_urcu_init" >&5 +$as_echo "$ac_cv_search_urcu_init" >&6; } +ac_res=$ac_cv_search_urcu_init +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + as_fn_error $? "liburcu is too old (< 0.4.0), urcu_init symbol found" "$LINENO" 5 +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 $as_echo_n "checking for library containing dlopen... " >&6; } -if ${ac_cv_search_dlopen+:} false; then : +if test "${ac_cv_search_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -13448,11 +12712,11 @@ for ac_lib in '' dl; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_dlopen+:} false; then : + if test "${ac_cv_search_dlopen+set}" = set; then : break fi done -if ${ac_cv_search_dlopen+:} false; then : +if test "${ac_cv_search_dlopen+set}" = set; then : else ac_cv_search_dlopen=no @@ -13470,7 +12734,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 $as_echo_n "checking for library containing clock_gettime... " >&6; } -if ${ac_cv_search_clock_gettime+:} false; then : +if test "${ac_cv_search_clock_gettime+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -13504,11 +12768,11 @@ for ac_lib in '' rt; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_clock_gettime+:} false; then : + if test "${ac_cv_search_clock_gettime+set}" = set; then : break fi done -if ${ac_cv_search_clock_gettime+:} false; then : +if test "${ac_cv_search_clock_gettime+set}" = set; then : else ac_cv_search_clock_gettime=no @@ -13526,7 +12790,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing OpenSSL_add_all_digests" >&5 $as_echo_n "checking for library containing OpenSSL_add_all_digests... " >&6; } -if ${ac_cv_search_OpenSSL_add_all_digests+:} false; then : +if test "${ac_cv_search_OpenSSL_add_all_digests+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -13560,11 +12824,11 @@ for ac_lib in '' crypto; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_OpenSSL_add_all_digests+:} false; then : + if test "${ac_cv_search_OpenSSL_add_all_digests+set}" = set; then : break fi done -if ${ac_cv_search_OpenSSL_add_all_digests+:} false; then : +if test "${ac_cv_search_OpenSSL_add_all_digests+set}" = set; then : else ac_cv_search_OpenSSL_add_all_digests=no @@ -13584,7 +12848,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing capng_apply" >&5 $as_echo_n "checking for library containing capng_apply... " >&6; } -if ${ac_cv_search_capng_apply+:} false; then : +if test "${ac_cv_search_capng_apply+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -13618,11 +12882,11 @@ for ac_lib in '' cap-ng; do fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if ${ac_cv_search_capng_apply+:} false; then : + if test "${ac_cv_search_capng_apply+set}" = set; then : break fi done -if ${ac_cv_search_capng_apply+:} false; then : +if test "${ac_cv_search_capng_apply+set}" = set; then : else ac_cv_search_capng_apply=no @@ -13684,7 +12948,7 @@ done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } -if ${ac_cv_header_stdbool_h+:} false; then : +if test "${ac_cv_header_stdbool_h+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13716,7 +12980,7 @@ else char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; - /* See body of main program for 'e'. */ + bool e = &s; char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; @@ -13727,6 +12991,25 @@ else _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; +# if defined __xlc__ || defined __GNUC__ + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 + reported by James Lemley on 2005-10-05; see + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + This test is not quite right, since xlc is allowed to + reject this program, as the initializer for xlcbug is + not one of the forms that C requires support for. + However, doing the test right would require a runtime + test, and that would make cross-compilation harder. + Let us hope that IBM fixes the xlc bug, and also adds + support for this kind of constant expression. In the + meantime, this test will reject xlc, which is OK, since + our stdbool.h substitute should suffice. We also test + this with GCC, where it should work, to detect more + quickly whether someone messes up the test in the + future. */ + char digs[] = "0123456789"; + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); +# endif /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html @@ -13738,7 +13021,6 @@ int main () { - bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ @@ -13759,7 +13041,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" -if test "x$ac_cv_type__Bool" = xyes; then : +if test "x$ac_cv_type__Bool" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 @@ -13776,7 +13058,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : +if test "${ac_cv_c_inline+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no @@ -13828,7 +13110,7 @@ _ACEOF esac ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : +if test "x$ac_cv_type_pid_t" = x""yes; then : else @@ -13839,7 +13121,7 @@ _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : +if test "x$ac_cv_type_size_t" = x""yes; then : else @@ -13850,7 +13132,7 @@ _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = xyes; then : +if test "x$ac_cv_type_ssize_t" = x""yes; then : else @@ -13924,7 +13206,7 @@ $as_echo "#define DSFMT_MEXP 521" >>confdefs.h for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" -if test "x$ac_cv_header_vfork_h" = xyes; then : +if test "x$ac_cv_header_vfork_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF @@ -13948,7 +13230,7 @@ done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } -if ${ac_cv_func_fork_works+:} false; then : +if test "${ac_cv_func_fork_works+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -14001,7 +13283,7 @@ ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } -if ${ac_cv_func_vfork_works+:} false; then : +if test "${ac_cv_func_vfork_works+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -14161,7 +13443,7 @@ done for ac_func in getpagesize do : ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" -if test "x$ac_cv_func_getpagesize" = xyes; then : +if test "x$ac_cv_func_getpagesize" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPAGESIZE 1 _ACEOF @@ -14171,7 +13453,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 $as_echo_n "checking for working mmap... " >&6; } -if ${ac_cv_func_mmap_fixed_mapped+:} false; then : +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -14335,7 +13617,7 @@ $as_echo "#define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt -for ac_func in gethostbyname gettimeofday clock_gettime memalign memmove memset munmap regcomp pselect select socket sqrt strcasecmp strchr strdup strerror strncasecmp strtol strtoul poll epoll_wait kqueue setgroups sendmmsg +for ac_func in gethostbyname gettimeofday clock_gettime memalign memmove memset munmap regcomp pselect select socket sqrt strcasecmp strchr strdup strerror strncasecmp strtol strtoul poll epoll_wait kqueue setgroups sendmmsg madvise do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -14414,21 +13696,10 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then + test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi + cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -14484,7 +13755,7 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -: "${CONFIG_STATUS=./config.status}" +: ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -14585,7 +13856,6 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -14892,8 +14162,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by knot $as_me 1.0.1, which was -generated by GNU Autoconf 2.68. Invocation command line was +This file was extended by knot $as_me 1.0.2, which was +generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -14958,8 +14228,8 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -knot config.status 1.0.1 -configured by $0, generated by GNU Autoconf 2.68, +knot config.status 1.0.2 +configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -15087,153 +14357,131 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' -macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' -enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' -enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' -pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' -SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' -ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' -host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' -host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' -host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' -build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' -build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' -build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' -SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' -Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' -GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' -EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' -FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' -LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' -NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' -LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' -ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' -exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' -lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' -lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' -lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' -reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' -file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' -want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' -DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' -sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' -AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' -archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' -STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' -RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' -lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' -CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' -compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' -GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' -nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' -lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' -objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' -need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' -MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' -LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' -libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' -module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' -postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' -version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' -runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' -libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' -soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' -install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' -finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' -old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' -striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' +macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' +enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' +pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' +host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' +host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' +host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' +build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' +build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' +build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' +SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' +Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' +GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' +EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' +FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' +LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' +NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' +LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' +ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' +exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' +lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' +reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' +AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' +STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' +RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' +compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' +GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' +SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' +ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' +need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' +LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' +libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' +fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' +version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' +runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' +libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' +soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' +old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' +striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - # Quote evaled strings. -for var in SHELL \ -ECHO \ -SED \ +for var in SED \ GREP \ EGREP \ FGREP \ @@ -15246,13 +14494,8 @@ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ -file_magic_glob \ -want_nocaseglob \ -DLLTOOL \ -sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ -archiver_list_spec \ STRIP \ RANLIB \ CC \ @@ -15262,14 +14505,14 @@ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -nm_file_list_spec \ +SHELL \ +ECHO \ lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_pic \ lt_prog_compiler_wl \ +lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ -MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ @@ -15285,6 +14528,7 @@ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ +fix_srcfile_path \ exclude_expsyms \ include_expsyms \ file_list_spec \ @@ -15292,13 +14536,12 @@ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ -install_override_mode \ finish_eval \ old_striplib \ striplib; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -15320,15 +14563,14 @@ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ -postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -15336,6 +14578,12 @@ sys_lib_dlsearch_path_spec; do esac done +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` + ;; +esac + ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' @@ -15371,7 +14619,7 @@ do "samples/Makefile") CONFIG_FILES="$CONFIG_FILES samples/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done @@ -15394,10 +14642,9 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= ac_tmp= + tmp= trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -15405,13 +14652,12 @@ $debug || { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" + test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -15433,7 +14679,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF @@ -15461,7 +14707,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -15509,7 +14755,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && +cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -15541,7 +14787,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -15575,7 +14821,7 @@ fi # test -n "$CONFIG_FILES" # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || +cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -15587,8 +14833,8 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -15689,7 +14935,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -15708,7 +14954,7 @@ do for ac_f do case $ac_f in - -) ac_f="$ac_tmp/stdin";; + -) 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 `:'. @@ -15717,7 +14963,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -15743,8 +14989,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -15880,22 +15126,21 @@ s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_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 "$ac_tmp/stdin" + rm -f "$tmp/stdin" case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -15906,20 +15151,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ + mv "$tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. @@ -16081,8 +15326,7 @@ $as_echo X"$file" | # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. +# 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. @@ -16130,12 +15374,6 @@ pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that protects backslashes. -ECHO=$lt_ECHO - # The host system. host_alias=$host_alias host=$host @@ -16185,11 +15423,9 @@ SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP -# convert \$build file names to \$host format. -to_host_file_cmd=$lt_cv_to_host_file_cmd - -# convert \$build files to toolchain format. -to_tool_file_cmd=$lt_cv_to_tool_file_cmd +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds # An object symbol dumper. OBJDUMP=$lt_OBJDUMP @@ -16197,30 +15433,13 @@ OBJDUMP=$lt_OBJDUMP # 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". +# Command to use when deplibs_check_method == "file_magic". file_magic_cmd=$lt_file_magic_cmd -# How to find potential files when deplibs_check_method = "file_magic". -file_magic_glob=$lt_file_magic_glob - -# Find potential files using nocaseglob when deplibs_check_method = "file_magic". -want_nocaseglob=$lt_want_nocaseglob - -# DLL creation program. -DLLTOOL=$lt_DLLTOOL - -# Command to associate shared and link libraries. -sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd - # The archiver. AR=$lt_AR - -# Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS -# How to feed a file listing to the archiver. -archiver_list_spec=$lt_archiver_list_spec - # A symbol stripping program. STRIP=$lt_STRIP @@ -16229,9 +15448,6 @@ RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds -# Whether to use a lock for old archive extraction. -lock_old_archive_extraction=$lock_old_archive_extraction - # A C compiler. LTCC=$lt_CC @@ -16250,24 +15466,21 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix -# Specify filename containing input files for \$NM. -nm_file_list_spec=$lt_nm_file_list_spec - -# The root where to search for dependent libraries,and in which our libraries should be installed. -lt_sysroot=$lt_sysroot - # The name of the directory that contains temporary libtool files. objdir=$objdir +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that does not interpret backslashes. +ECHO=$lt_ECHO + # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks -# Manifest tool. -MANIFEST_TOOL=$lt_MANIFEST_TOOL - # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL @@ -16324,9 +15537,6 @@ library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec -# Permission mode override for installation of shared libraries. -install_override_mode=$lt_install_override_mode - # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds @@ -16366,10 +15576,6 @@ striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds @@ -16382,12 +15588,12 @@ with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static @@ -16474,6 +15680,9 @@ inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols @@ -16489,9 +15698,6 @@ include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds - # Specify filename containing input files. file_list_spec=$lt_file_list_spec @@ -16524,169 +15730,212 @@ ltmain="$ac_aux_dir/ltmain.sh" # 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) - - if test x"$xsi_shell" = xyes; then - sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ -func_dirname ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_basename ()$/,/^} # func_basename /c\ -func_basename ()\ -{\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ -func_dirname_and_basename ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ -func_stripname ()\ -{\ -\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ -\ # positional parameters, so assign one to ordinary parameter first.\ -\ func_stripname_result=${3}\ -\ func_stripname_result=${func_stripname_result#"${1}"}\ -\ func_stripname_result=${func_stripname_result%"${2}"}\ -} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ -func_split_long_opt ()\ -{\ -\ func_split_long_opt_name=${1%%=*}\ -\ func_split_long_opt_arg=${1#*=}\ -} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ -func_split_short_opt ()\ -{\ -\ func_split_short_opt_arg=${1#??}\ -\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ -} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ -func_lo2o ()\ -{\ -\ case ${1} in\ -\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ -\ *) func_lo2o_result=${1} ;;\ -\ esac\ -} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_xform ()$/,/^} # func_xform /c\ -func_xform ()\ -{\ - func_xform_result=${1%.*}.lo\ -} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_arith ()$/,/^} # func_arith /c\ -func_arith ()\ -{\ - func_arith_result=$(( $* ))\ -} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_len ()$/,/^} # func_len /c\ -func_len ()\ -{\ - func_len_result=${#1}\ -} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - -fi - -if test x"$lt_shell_append" = xyes; then - sed -e '/^func_append ()$/,/^} # func_append /c\ -func_append ()\ -{\ - eval "${1}+=\\${2}"\ -} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ -func_append_quoted ()\ -{\ -\ func_quote_for_eval "${2}"\ -\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ -} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 -$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} -fi - - - mv -f "$cfgfile" "$ofile" || + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $* )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[^=]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$@"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1+=\$2" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1=\$$1\$2" +} + +_LT_EOF + ;; + esac + + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" diff --git a/configure.ac b/configure.ac index 208cbde..e0c8feb 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- AC_PREREQ([2.65]) -AC_INIT([knot], [1.0.1], [knot-dns@labs.nic.cz]) +AC_INIT([knot], [1.0.2], [knot-dns@labs.nic.cz]) AM_INIT_AUTOMAKE([gnu -Wall -Werror]) AC_CONFIG_SRCDIR([src/knot/main.c]) AC_CONFIG_HEADERS([src/config.h]) @@ -130,6 +130,7 @@ LDFLAGS="$LDFLAGS -L/usr/local/lib" AC_SEARCH_LIBS([pow], [m]) AC_SEARCH_LIBS([pthread_create], [pthread], [], [AC_MSG_ERROR([pthreads not found])]) AC_SEARCH_LIBS([rcu_set_pointer_sym], [urcu], [], [AC_MSG_ERROR([liburcu not found])]) +AC_SEARCH_LIBS([urcu_init], [urcu], [AC_MSG_ERROR([liburcu is too old (< 0.4.0), urcu_init symbol found])], []) AC_SEARCH_LIBS([dlopen], [dl]) AC_SEARCH_LIBS([clock_gettime], [rt]) AC_SEARCH_LIBS([OpenSSL_add_all_digests], [crypto],[], [AC_MSG_ERROR([libcrypto not found])]) @@ -158,7 +159,7 @@ AC_DEFINE([DSFMT_MEXP], [521], [DSFMT parameters.]) # Checks for library functions. AC_FUNC_FORK AC_FUNC_MMAP -AC_CHECK_FUNCS([gethostbyname gettimeofday clock_gettime memalign memmove memset munmap regcomp pselect select socket sqrt strcasecmp strchr strdup strerror strncasecmp strtol strtoul poll epoll_wait kqueue setgroups sendmmsg]) +AC_CHECK_FUNCS([gethostbyname gettimeofday clock_gettime memalign memmove memset munmap regcomp pselect select socket sqrt strcasecmp strchr strdup strerror strncasecmp strtol strtoul poll epoll_wait kqueue setgroups sendmmsg madvise]) AC_CONFIG_FILES([Makefile samples/Makefile @@ -1,9 +1,9 @@ +# Generated from ltmain.m4sh. -# libtool (GNU libtool) 2.4 +# ltmain.sh (GNU libtool) 2.2.6b # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 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. @@ -32,56 +32,50 @@ # # 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 -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --no-quiet, --no-silent -# print informational messages (default) -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print more informational messages than default -# --no-verbose don't print the extra informational messages -# --version print version information -# -h, --help, --help-all print short, long, or detailed help message +# --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 +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print informational messages (default) +# --version print version information +# -h, --help print short or long help message # # 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 +# 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. When passed as first option, -# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. +# MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4 Debian-2.4-2ubuntu1 -# automake: $automake_version -# autoconf: $autoconf_version +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2 +# automake: $automake_version +# autoconf: $autoconf_version # # Report bugs to <bug-libtool@gnu.org>. -# GNU libtool home page: <http://www.gnu.org/software/libtool/>. -# General help using GNU software: <http://www.gnu.org/gethelp/>. -PROGRAM=libtool +PROGRAM=ltmain.sh PACKAGE=libtool -VERSION="2.4 Debian-2.4-2ubuntu1" +VERSION="2.2.6b Debian-2.2.6b-2" TIMESTAMP="" -package_revision=1.3293 +package_revision=1.3017 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then @@ -97,15 +91,10 @@ fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - # NLS nuisances: We save the old values to restore during execute mode. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES @@ -118,24 +107,15 @@ do lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL $lt_unset CDPATH -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" : ${CP="cp -f"} -test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +: ${ECHO="echo"} : ${EGREP="/bin/grep -E"} : ${FGREP="/bin/grep -F"} : ${GREP="/bin/grep"} @@ -164,27 +144,6 @@ IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} # func_dirname may be replaced by extended shell implementation - - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} # func_basename may be replaced by extended shell implementation - - # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: @@ -199,183 +158,33 @@ func_basename () # those functions but instead duplicate the functionality here. func_dirname_and_basename () { - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} # func_dirname_and_basename may be replaced by extended shell implementation - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname may be replaced by extended shell implementation - - -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' - -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi +# Generated shell functions inserted here. - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" # The name of this program: +# In the unlikely event $progname began with a '-', it would play havoc with +# func_echo (imagine progname=-n), so we prepend ./ in that case: func_dirname_and_basename "$progpath" progname=$func_basename_result +case $progname in + -*) progname=./$progname ;; +esac # Make sure we have an absolute path for reexecution: case $progpath in @@ -406,15 +215,6 @@ sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' -# Sed substitution that turns a string into a regex matching for the -# string literally. -sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' - -# Sed substitution that converts a w32 file name or path -# which contains forward slashes, into one that contains -# (escaped) backslashes. A very naive implementation. -lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. @@ -443,7 +243,7 @@ opt_warning=: # name if it has been set yet. func_echo () { - $ECHO "$progname: ${opt_mode+$opt_mode: }$*" + $ECHO "$progname${mode+: }$mode: $*" } # func_verbose arg... @@ -458,25 +258,18 @@ func_verbose () : } -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - # func_error arg... # Echo program name prefixed message to standard error. func_error () { - $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 + $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { - $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 # bash bug again: : @@ -533,9 +326,9 @@ func_mkdir_p () case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` + my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` + my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do @@ -585,7 +378,7 @@ func_mktempdir () func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi - $ECHO "$my_tmpdir" + $ECHO "X$my_tmpdir" | $Xsed } @@ -599,7 +392,7 @@ func_quote_for_eval () { case $1 in *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; + func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac @@ -626,7 +419,7 @@ func_quote_for_expand () { case $1 in *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ + my_arg=`$ECHO "X$1" | $Xsed \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; @@ -695,39 +488,15 @@ func_show_eval_locale () fi } -# func_tr_sh -# Turn $1 into a string suitable for a shell variable name. -# Result is stored in $func_tr_sh_result. All characters -# not in the set a-zA-Z0-9_ are replaced with '_'. Further, -# if $1 begins with a digit, a '_' is prepended as well. -func_tr_sh () -{ - case $1 in - [0-9]* | *[!a-zA-Z0-9_]*) - func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` - ;; - * ) - func_tr_sh_result=$1 - ;; - esac -} + + # func_version # Echo version message to standard output and exit. func_version () { - $opt_debug - - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# / / - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { + $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ @@ -740,28 +509,22 @@ func_version () # Echo short help message to standard output and exit. func_usage () { - $opt_debug - - $SED -n '/^# Usage:/,/^# *.*--help/ { + $SED -n '/^# Usage:/,/# -h/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" - echo + $ECHO $ECHO "run \`$progname --help | more' for full usage" exit $? } -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. +# func_help +# Echo long help message to standard output and exit. func_help () { - $opt_debug - $SED -n '/^# Usage:/,/# Report bugs to/ { - :print s/^# // s/^# *$// s*\$progname*'$progname'* @@ -774,15 +537,8 @@ func_help () s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ p - d - } - /^# .* home page:/b print - /^# General help using/b print - ' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi + }' < "$progpath" + exit $? } # func_missing_arg argname @@ -790,106 +546,63 @@ func_help () # exit_cmd. func_missing_arg () { - $opt_debug - - func_error "missing argument for $1." + func_error "missing argument for $1" exit_cmd=exit } +exit_cmd=: -# func_split_short_opt shortopt -# Set func_split_short_opt_name and func_split_short_opt_arg shell -# variables after splitting SHORTOPT after the 2nd character. -func_split_short_opt () -{ - my_sed_short_opt='1s/^\(..\).*$/\1/;q' - my_sed_short_rest='1s/^..\(.*\)$/\1/;q' - - func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` - func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` -} # func_split_short_opt may be replaced by extended shell implementation - - -# func_split_long_opt longopt -# Set func_split_long_opt_name and func_split_long_opt_arg shell -# variables after splitting LONGOPT at the `=' sign. -func_split_long_opt () -{ - my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' - my_sed_long_arg='1s/^--[^=]*=//' - - func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` - func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` -} # func_split_long_opt may be replaced by extended shell implementation -exit_cmd=: +# 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 "$progpath" --no-reexec ${1+"$@"} +fi +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit $EXIT_SUCCESS +fi magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. +# $mode is unset nonopt= +execute_dlfiles= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 +opt_dry_run=false +opt_duplicate_deps=false +opt_silent=false +opt_debug=: + # 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= -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "${1}=\$${1}\${2}" -} # func_append may be replaced by extended shell implementation - -# func_append_quoted var value -# Quote VALUE and append to the end of shell variable VAR, separated -# by a space. -func_append_quoted () -{ - func_quote_for_eval "${2}" - eval "${1}=\$${1}\\ \$func_quote_for_eval_result" -} # func_append_quoted may be replaced by extended shell implementation - - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "${@}"` -} # func_arith may be replaced by extended shell implementation - - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` -} # func_len may be replaced by extended shell implementation - - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} # func_lo2o may be replaced by extended shell implementation - - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` -} # func_xform may be replaced by extended shell implementation - - # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. @@ -923,16 +636,16 @@ func_config () # Display the features supported by this script. func_features () { - echo "host: $host" + $ECHO "host: $host" if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" + $ECHO "enable shared libraries" else - echo "disable shared libraries" + $ECHO "disable shared libraries" fi if test "$build_old_libs" = yes; then - echo "enable static libraries" + $ECHO "enable static libraries" else - echo "disable static libraries" + $ECHO "disable static libraries" fi exit $? @@ -979,204 +692,117 @@ func_enable_tag () esac } -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () +# Parse options once, thoroughly. This comes as soon as possible in +# the script to make things like `libtool --version' happen quickly. { - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF - fi - - exit $EXIT_MISMATCH - fi -} - - -# Shorthand for --mode=foo, only valid as the first argument -case $1 in -clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; -compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; -execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; -finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; -install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; -link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; -uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; -esac - - - -# Option defaults: -opt_debug=: -opt_dry_run=false -opt_config=false -opt_preserve_dup_deps=false -opt_features=false -opt_finish=false -opt_help=false -opt_help_all=false -opt_silent=: -opt_verbose=: -opt_silent=false -opt_verbose=false + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac -# Parse options once, thoroughly. This comes as soon as possible in the -# script to make things like `--version' happen as quickly as we can. -{ - # this just eases exit handling - while test $# -gt 0; do + # Parse non-mode specific arguments: + while test "$#" -gt 0; do opt="$1" shift + case $opt in - --debug|-x) opt_debug='set -x' + --config) func_config ;; + + --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" + opt_debug='set -x' $opt_debug ;; - --dry-run|--dryrun|-n) - opt_dry_run=: - ;; - --config) - opt_config=: -func_config - ;; - --dlopen|-dlopen) - optarg="$1" - opt_dlopen="${opt_dlopen+$opt_dlopen -}$optarg" + + -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break + execute_dlfiles="$execute_dlfiles $1" shift ;; - --preserve-dup-deps) - opt_preserve_dup_deps=: - ;; - --features) - opt_features=: -func_features - ;; - --finish) - opt_finish=: -set dummy --mode finish ${1+"$@"}; shift - ;; - --help) - opt_help=: - ;; - --help-all) - opt_help_all=: -opt_help=': help-all' - ;; - --mode) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_mode="$optarg" -case $optarg in - # Valid mode arguments: - clean|compile|execute|finish|install|link|relink|uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; -esac + + --dry-run | -n) opt_dry_run=: ;; + --features) func_features ;; + --finish) mode="finish" ;; + + --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break + case $1 in + # Valid mode arguments: + clean) ;; + compile) ;; + execute) ;; + finish) ;; + install) ;; + link) ;; + relink) ;; + uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; + esac + + mode="$1" shift ;; - --no-silent|--no-quiet) - opt_silent=false -func_append preserve_args " $opt" - ;; - --no-verbose) - opt_verbose=false -func_append preserve_args " $opt" - ;; - --silent|--quiet) + + --preserve-dup-deps) + opt_duplicate_deps=: ;; + + --quiet|--silent) preserve_args="$preserve_args $opt" opt_silent=: -func_append preserve_args " $opt" - opt_verbose=false ;; - --verbose|-v) - opt_verbose=: -func_append preserve_args " $opt" -opt_silent=false + + --verbose| -v) preserve_args="$preserve_args $opt" + opt_silent=false ;; - --tag) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_tag="$optarg" -func_append preserve_args " $opt $optarg" -func_enable_tag "$optarg" + + --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break + preserve_args="$preserve_args $opt $1" + func_enable_tag "$1" # tagname is set here shift ;; - -\?|-h) func_usage ;; - --help) func_help ;; - --version) func_version ;; - # Separate optargs to long options: - --*=*) - func_split_long_opt "$opt" - set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + -dlopen=*|--mode=*|--tag=*) + func_opt_split "$opt" + set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} shift ;; - # Separate non-argument short options: - -\?*|-h*|-n*|-v*) - func_split_short_opt "$opt" - set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} - shift - ;; + -\?|-h) func_usage ;; + --help) opt_help=: ;; + --version) func_version ;; + + -*) func_fatal_help "unrecognized option \`$opt'" ;; - --) break ;; - -*) func_fatal_help "unrecognized option \`$opt'" ;; - *) set dummy "$opt" ${1+"$@"}; shift; break ;; + *) nonopt="$opt" + break + ;; esac done - # Validate options: - - # save first non-option argument - if test "$#" -gt 0; then - nonopt="$opt" - shift - fi - - # preserve --debug - test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) @@ -1184,44 +810,82 @@ func_enable_tag "$optarg" opt_duplicate_compiler_generated_deps=: ;; *) - opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac - $opt_help || { - # Sanity checks first: - func_check_version_match + # Having warned about all mis-specified options, bail out if + # anything was wrong. + $exit_cmd $EXIT_FAILURE +} - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF fi - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" + exit $EXIT_MISMATCH + fi +} + - # Only execute mode is allowed to have -dlopen flags. - if test -n "$opt_dlopen" && test "$opt_mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi +## ----------- ## +## Main. ## +## ----------- ## - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$opt_mode' for more information." - } +$opt_help || { + # Sanity checks first: + func_check_version_match + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi - # Bail if the options were screwed - $exit_cmd $EXIT_FAILURE -} + test -z "$mode" && func_fatal_error "error: you must specify a MODE." + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" -## ----------- ## -## Main. ## -## ----------- ## + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$mode' for more information." +} + # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. @@ -1286,9 +950,12 @@ func_ltwrapper_executable_p () # temporary ltwrapper_script. func_ltwrapper_scriptname () { - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" + func_ltwrapper_scriptname_result="" + if func_ltwrapper_executable_p "$1"; then + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" + fi } # func_ltwrapper_p file @@ -1334,37 +1001,6 @@ func_source () } -# func_resolve_sysroot PATH -# Replace a leading = in PATH with a sysroot. Store the result into -# func_resolve_sysroot_result -func_resolve_sysroot () -{ - func_resolve_sysroot_result=$1 - case $func_resolve_sysroot_result in - =*) - func_stripname '=' '' "$func_resolve_sysroot_result" - func_resolve_sysroot_result=$lt_sysroot$func_stripname_result - ;; - esac -} - -# func_replace_sysroot PATH -# If PATH begins with the sysroot, replace it with = and -# store the result into func_replace_sysroot_result. -func_replace_sysroot () -{ - case "$lt_sysroot:$1" in - ?*:"$lt_sysroot"*) - func_stripname "$lt_sysroot" '' "$1" - func_replace_sysroot_result="=$func_stripname_result" - ;; - *) - # Including no sysroot. - func_replace_sysroot_result=$1 - ;; - esac -} - # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. @@ -1377,15 +1013,13 @@ func_infer_tag () if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do - func_append_quoted CC_quoted "$arg" + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ 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 "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) @@ -1396,13 +1030,11 @@ func_infer_tag () CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. - func_append_quoted CC_quoted "$arg" + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. @@ -1465,486 +1097,6 @@ EOF } } - -################################################## -# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # -################################################## - -# func_convert_core_file_wine_to_w32 ARG -# Helper function used by file name conversion functions when $build is *nix, -# and $host is mingw, cygwin, or some other w32 environment. Relies on a -# correctly configured wine environment available, with the winepath program -# in $build's $PATH. -# -# ARG is the $build file name to be converted to w32 format. -# Result is available in $func_convert_core_file_wine_to_w32_result, and will -# be empty on error (or when ARG is empty) -func_convert_core_file_wine_to_w32 () -{ - $opt_debug - func_convert_core_file_wine_to_w32_result="$1" - if test -n "$1"; then - # Unfortunately, winepath does not exit with a non-zero error code, so we - # are forced to check the contents of stdout. On the other hand, if the - # command is not found, the shell will set an exit code of 127 and print - # *an error message* to stdout. So we must check for both error code of - # zero AND non-empty stdout, which explains the odd construction: - func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` - if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then - func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | - $SED -e "$lt_sed_naive_backslashify"` - else - func_convert_core_file_wine_to_w32_result= - fi - fi -} -# end: func_convert_core_file_wine_to_w32 - - -# func_convert_core_path_wine_to_w32 ARG -# Helper function used by path conversion functions when $build is *nix, and -# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly -# configured wine environment available, with the winepath program in $build's -# $PATH. Assumes ARG has no leading or trailing path separator characters. -# -# ARG is path to be converted from $build format to win32. -# Result is available in $func_convert_core_path_wine_to_w32_result. -# Unconvertible file (directory) names in ARG are skipped; if no directory names -# are convertible, then the result may be empty. -func_convert_core_path_wine_to_w32 () -{ - $opt_debug - # unfortunately, winepath doesn't convert paths, only file names - func_convert_core_path_wine_to_w32_result="" - if test -n "$1"; then - oldIFS=$IFS - IFS=: - for func_convert_core_path_wine_to_w32_f in $1; do - IFS=$oldIFS - func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" - if test -n "$func_convert_core_file_wine_to_w32_result" ; then - if test -z "$func_convert_core_path_wine_to_w32_result"; then - func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" - else - func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" - fi - fi - done - IFS=$oldIFS - fi -} -# end: func_convert_core_path_wine_to_w32 - - -# func_cygpath ARGS... -# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when -# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) -# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or -# (2), returns the Cygwin file name or path in func_cygpath_result (input -# file name or path is assumed to be in w32 format, as previously converted -# from $build's *nix or MSYS format). In case (3), returns the w32 file name -# or path in func_cygpath_result (input file name or path is assumed to be in -# Cygwin format). Returns an empty string on error. -# -# ARGS are passed to cygpath, with the last one being the file name or path to -# be converted. -# -# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH -# environment variable; do not put it in $PATH. -func_cygpath () -{ - $opt_debug - if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then - func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` - if test "$?" -ne 0; then - # on failure, ensure result is empty - func_cygpath_result= - fi - else - func_cygpath_result= - func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" - fi -} -#end: func_cygpath - - -# func_convert_core_msys_to_w32 ARG -# Convert file name or path ARG from MSYS format to w32 format. Return -# result in func_convert_core_msys_to_w32_result. -func_convert_core_msys_to_w32 () -{ - $opt_debug - # awkward: cmd appends spaces to result - func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` -} -#end: func_convert_core_msys_to_w32 - - -# func_convert_file_check ARG1 ARG2 -# Verify that ARG1 (a file name in $build format) was converted to $host -# format in ARG2. Otherwise, emit an error message, but continue (resetting -# func_to_host_file_result to ARG1). -func_convert_file_check () -{ - $opt_debug - if test -z "$2" && test -n "$1" ; then - func_error "Could not determine host file name corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_file_result="$1" - fi -} -# end func_convert_file_check - - -# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH -# Verify that FROM_PATH (a path in $build format) was converted to $host -# format in TO_PATH. Otherwise, emit an error message, but continue, resetting -# func_to_host_file_result to a simplistic fallback value (see below). -func_convert_path_check () -{ - $opt_debug - if test -z "$4" && test -n "$3"; then - func_error "Could not determine the host path corresponding to" - func_error " \`$3'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This is a deliberately simplistic "conversion" and - # should not be "improved". See libtool.info. - if test "x$1" != "x$2"; then - lt_replace_pathsep_chars="s|$1|$2|g" - func_to_host_path_result=`echo "$3" | - $SED -e "$lt_replace_pathsep_chars"` - else - func_to_host_path_result="$3" - fi - fi -} -# end func_convert_path_check - - -# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG -# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT -# and appending REPL if ORIG matches BACKPAT. -func_convert_path_front_back_pathsep () -{ - $opt_debug - case $4 in - $1 ) func_to_host_path_result="$3$func_to_host_path_result" - ;; - esac - case $4 in - $2 ) func_append func_to_host_path_result "$3" - ;; - esac -} -# end func_convert_path_front_back_pathsep - - -################################################## -# $build to $host FILE NAME CONVERSION FUNCTIONS # -################################################## -# invoked via `$to_host_file_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# Result will be available in $func_to_host_file_result. - - -# func_to_host_file ARG -# Converts the file name ARG from $build format to $host format. Return result -# in func_to_host_file_result. -func_to_host_file () -{ - $opt_debug - $to_host_file_cmd "$1" -} -# end func_to_host_file - - -# func_to_tool_file ARG LAZY -# converts the file name ARG from $build format to toolchain format. Return -# result in func_to_tool_file_result. If the conversion in use is listed -# in (the comma separated) LAZY, no conversion takes place. -func_to_tool_file () -{ - $opt_debug - case ,$2, in - *,"$to_tool_file_cmd",*) - func_to_tool_file_result=$1 - ;; - *) - $to_tool_file_cmd "$1" - func_to_tool_file_result=$func_to_host_file_result - ;; - esac -} -# end func_to_tool_file - - -# func_convert_file_noop ARG -# Copy ARG to func_to_host_file_result. -func_convert_file_noop () -{ - func_to_host_file_result="$1" -} -# end func_convert_file_noop - - -# func_convert_file_msys_to_w32 ARG -# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_file_result. -func_convert_file_msys_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_to_host_file_result="$func_convert_core_msys_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_w32 - - -# func_convert_file_cygwin_to_w32 ARG -# Convert file name ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_file_cygwin_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # because $build is cygwin, we call "the" cygpath in $PATH; no need to use - # LT_CYGPATH in this case. - func_to_host_file_result=`cygpath -m "$1"` - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_cygwin_to_w32 - - -# func_convert_file_nix_to_w32 ARG -# Convert file name ARG from *nix to w32 format. Requires a wine environment -# and a working winepath. Returns result in func_to_host_file_result. -func_convert_file_nix_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_file_wine_to_w32 "$1" - func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_w32 - - -# func_convert_file_msys_to_cygwin ARG -# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_file_msys_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_cygpath -u "$func_convert_core_msys_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_cygwin - - -# func_convert_file_nix_to_cygwin ARG -# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed -# in a wine environment, working winepath, and LT_CYGPATH set. Returns result -# in func_to_host_file_result. -func_convert_file_nix_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. - func_convert_core_file_wine_to_w32 "$1" - func_cygpath -u "$func_convert_core_file_wine_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_cygwin - - -############################################# -# $build to $host PATH CONVERSION FUNCTIONS # -############################################# -# invoked via `$to_host_path_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# The result will be available in $func_to_host_path_result. -# -# Path separators are also converted from $build format to $host format. If -# ARG begins or ends with a path separator character, it is preserved (but -# converted to $host format) on output. -# -# All path conversion functions are named using the following convention: -# file name conversion function : func_convert_file_X_to_Y () -# path conversion function : func_convert_path_X_to_Y () -# where, for any given $build/$host combination the 'X_to_Y' value is the -# same. If conversion functions are added for new $build/$host combinations, -# the two new functions must follow this pattern, or func_init_to_host_path_cmd -# will break. - - -# func_init_to_host_path_cmd -# Ensures that function "pointer" variable $to_host_path_cmd is set to the -# appropriate value, based on the value of $to_host_file_cmd. -to_host_path_cmd= -func_init_to_host_path_cmd () -{ - $opt_debug - if test -z "$to_host_path_cmd"; then - func_stripname 'func_convert_file_' '' "$to_host_file_cmd" - to_host_path_cmd="func_convert_path_${func_stripname_result}" - fi -} - - -# func_to_host_path ARG -# Converts the path ARG from $build format to $host format. Return result -# in func_to_host_path_result. -func_to_host_path () -{ - $opt_debug - func_init_to_host_path_cmd - $to_host_path_cmd "$1" -} -# end func_to_host_path - - -# func_convert_path_noop ARG -# Copy ARG to func_to_host_path_result. -func_convert_path_noop () -{ - func_to_host_path_result="$1" -} -# end func_convert_path_noop - - -# func_convert_path_msys_to_w32 ARG -# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_path_result. -func_convert_path_msys_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from ARG. MSYS - # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; - # and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_msys_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_msys_to_w32 - - -# func_convert_path_cygwin_to_w32 ARG -# Convert path ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_path_cygwin_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_cygwin_to_w32 - - -# func_convert_path_nix_to_w32 ARG -# Convert path ARG from *nix to w32 format. Requires a wine environment and -# a working winepath. Returns result in func_to_host_file_result. -func_convert_path_nix_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_nix_to_w32 - - -# func_convert_path_msys_to_cygwin ARG -# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_path_msys_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_msys_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_msys_to_cygwin - - -# func_convert_path_nix_to_cygwin ARG -# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a -# a wine environment, working winepath, and LT_CYGPATH set. Returns result in -# func_to_host_file_result. -func_convert_path_nix_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_nix_to_cygwin - - # func_mode_compile arg... func_mode_compile () { @@ -1985,12 +1137,12 @@ func_mode_compile () ;; -pie | -fpie | -fPIE) - func_append pie_flag " $arg" + pie_flag="$pie_flag $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) - func_append later " $arg" + later="$later $arg" continue ;; @@ -2011,14 +1163,15 @@ func_mode_compile () save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" - func_append_quoted lastarg "$arg" + func_quote_for_eval "$arg" + lastarg="$lastarg $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. - func_append base_compile " $lastarg" + base_compile="$base_compile $lastarg" continue ;; @@ -2034,7 +1187,8 @@ func_mode_compile () esac # case $arg_mode # Aesthetically quote the previous argument. - func_append_quoted base_compile "$lastarg" + func_quote_for_eval "$lastarg" + base_compile="$base_compile $func_quote_for_eval_result" done # for arg case $arg_mode in @@ -2059,7 +1213,7 @@ func_mode_compile () *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ - *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) + *.[fF][09]? | *.for | *.java | *.obj | *.sx) func_xform "$libobj" libobj=$func_xform_result ;; @@ -2134,7 +1288,7 @@ func_mode_compile () # 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 "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} + output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= @@ -2165,16 +1319,17 @@ compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi - func_append removelist " $output_obj" + removelist="$removelist $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist - func_append removelist " $lockfile" + removelist="$removelist $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 - srcfile=$func_to_tool_file_result + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result @@ -2194,7 +1349,7 @@ compiler." if test -z "$output_obj"; then # Place PIC objects in $objdir - func_append command " -o $lobj" + command="$command -o $lobj" fi func_show_eval_locale "$command" \ @@ -2241,11 +1396,11 @@ compiler." command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then - func_append command " -o $obj" + command="$command -o $obj" fi # Suppress compiler output if we already did a PIC compilation. - func_append command "$suppress_output" + command="$command$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' @@ -2290,13 +1445,13 @@ compiler." } $opt_help || { - test "$opt_mode" = compile && func_mode_compile ${1+"$@"} +test "$mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. - case $opt_mode in + case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. @@ -2327,11 +1482,10 @@ This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to build PIC objects only - -prefer-non-pic try to build non-PIC objects only + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking - -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. @@ -2384,7 +1538,7 @@ either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: - -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." @@ -2404,8 +1558,6 @@ 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 - -bindir BINDIR specify path to binaries directory (for systems where - libraries must be found in the PATH setting at runtime) -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) @@ -2434,11 +1586,6 @@ The following components of LINK-COMMAND are treated specially: -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface - -Wc,FLAG - -Xcompiler FLAG pass linker-specific FLAG directly to the compiler - -Wl,FLAG - -Xlinker FLAG pass linker-specific FLAG directly to the linker - -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. @@ -2472,44 +1619,18 @@ Otherwise, only FILE itself is deleted using RM." ;; *) - func_fatal_help "invalid operation mode \`$opt_mode'" + func_fatal_help "invalid operation mode \`$mode'" ;; esac - echo + $ECHO $ECHO "Try \`$progname --help' for more information about other modes." + + exit $? } -# Now that we've collected a possible --mode arg, show help if necessary -if $opt_help; then - if test "$opt_help" = :; then - func_mode_help - else - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - func_mode_help - done - } | sed -n '1p; 2,$s/^Usage:/ or: /p' - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - echo - func_mode_help - done - } | - sed '1d - /^When reporting/,/^Report/{ - H - d - } - $x - /information about other modes/d - /more detailed .*MODE/d - s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' - fi - exit $? -fi + # Now that we've collected a possible --mode arg, show help if necessary + $opt_help && func_mode_help # func_mode_execute arg... @@ -2522,16 +1643,13 @@ func_mode_execute () func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. - for file in $opt_dlopen; do + for file in $execute_dlfiles; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" @@ -2553,7 +1671,7 @@ func_mode_execute () dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then - func_append dir "/$objdir" + dir="$dir/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" @@ -2594,7 +1712,7 @@ func_mode_execute () for file do case $file in - -* | *.la | *.lo ) ;; + -*) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then @@ -2610,7 +1728,8 @@ func_mode_execute () ;; esac # Quote arguments (to preserve shell metacharacters). - func_append_quoted args "$file" + func_quote_for_eval "$file" + args="$args $func_quote_for_eval_result" done if test "X$opt_dry_run" = Xfalse; then @@ -2635,66 +1754,29 @@ func_mode_execute () # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - echo "export $shlibpath_var" + $ECHO "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } -test "$opt_mode" = execute && func_mode_execute ${1+"$@"} +test "$mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug - libs= - libdirs= + libdirs="$nonopt" admincmds= - for opt in "$nonopt" ${1+"$@"} - do - if test -d "$opt"; then - func_append libdirs " $opt" - - elif test -f "$opt"; then - if func_lalib_unsafe_p "$opt"; then - func_append libs " $opt" - else - func_warning "\`$opt' is not a valid libtool archive" - fi - - else - func_fatal_error "invalid argument \`$opt'" - fi - done - - if test -n "$libs"; then - if test -n "$lt_sysroot"; then - sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` - sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" - else - sysroot_cmd= - fi - - # Remove sysroot references - if $opt_dry_run; then - for lib in $libs; do - echo "removing references to $lt_sysroot and \`=' prefixes from $lib" - done - else - tmpdir=`func_mktempdir` - for lib in $libs; do - sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ - > $tmpdir/tmp-la - mv -f $tmpdir/tmp-la $lib - done - ${RM}r "$tmpdir" - fi - fi - 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. @@ -2704,7 +1786,7 @@ func_mode_finish () if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || func_append admincmds " + $opt_dry_run || eval "$cmds" || admincmds="$admincmds $cmds" fi done @@ -2713,55 +1795,53 @@ func_mode_finish () # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - 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 "X----------------------------------------------------------------------" | $Xsed + $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 "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" - echo "pages." - ;; - *) - echo "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - echo "----------------------------------------------------------------------" + $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" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" + $ECHO "pages." + ;; + *) + $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + $ECHO "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS } -test "$opt_mode" = finish && func_mode_finish ${1+"$@"} +test "$mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... @@ -2772,7 +1852,7 @@ func_mode_install () # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. - case $nonopt in *shtool*) :;; *) false;; esac; then + $ECHO "X$nonopt" | $GREP shtool >/dev/null; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " @@ -2786,12 +1866,7 @@ func_mode_install () # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" - func_append install_prog "$func_quote_for_eval_result" - install_shared_prog=$install_prog - case " $install_prog " in - *[\\\ /]cp\ *) install_cp=: ;; - *) install_cp=false ;; - esac + install_prog="$install_prog$func_quote_for_eval_result" # We need to accept at least all the BSD install flags. dest= @@ -2801,12 +1876,10 @@ func_mode_install () install_type= isdir=no stripme= - no_mode=: for arg do - arg2= if test -n "$dest"; then - func_append files " $dest" + files="$files $dest" dest=$arg continue fi @@ -2814,9 +1887,10 @@ func_mode_install () case $arg in -d) isdir=yes ;; -f) - if $install_cp; then :; else - prev=$arg - fi + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac ;; -g | -m | -o) prev=$arg @@ -2830,10 +1904,6 @@ func_mode_install () *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then - if test "x$prev" = x-m && test -n "$install_override_mode"; then - arg2=$install_override_mode - no_mode=false - fi prev= else dest=$arg @@ -2844,11 +1914,7 @@ func_mode_install () # Aesthetically quote the argument. func_quote_for_eval "$arg" - func_append install_prog " $func_quote_for_eval_result" - if test -n "$arg2"; then - func_quote_for_eval "$arg2" - fi - func_append install_shared_prog " $func_quote_for_eval_result" + install_prog="$install_prog $func_quote_for_eval_result" done test -z "$install_prog" && \ @@ -2857,13 +1923,6 @@ func_mode_install () test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" - if test -n "$install_override_mode" && $no_mode; then - if $install_cp; then :; else - func_quote_for_eval "$install_override_mode" - func_append install_shared_prog " -m $func_quote_for_eval_result" - fi - fi - if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" @@ -2918,13 +1977,10 @@ func_mode_install () case $file in *.$libext) # Do the static libraries later. - func_append staticlibs " $file" + staticlibs="$staticlibs $file" ;; *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" @@ -2938,23 +1994,23 @@ func_mode_install () if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; - *) func_append current_libdirs " $libdir" ;; + *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; - *) func_append future_libdirs " $libdir" ;; + *) future_libdirs="$future_libdirs $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" - func_append dir "$objdir" + 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 -e "s%$libdir\$%%"` + inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that @@ -2967,9 +2023,9 @@ func_mode_install () 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%"` + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" @@ -2987,7 +2043,7 @@ func_mode_install () test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. - func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in @@ -3027,7 +2083,7 @@ func_mode_install () func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. - test -n "$old_library" && func_append staticlibs " $dir/$old_library" + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) @@ -3127,7 +2183,7 @@ func_mode_install () if test -f "$lib"; then func_source "$lib" fi - libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test + libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no @@ -3146,7 +2202,7 @@ func_mode_install () file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. - relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" @@ -3165,7 +2221,7 @@ func_mode_install () } else # Install the binary that we compiled earlier. - file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi @@ -3224,7 +2280,7 @@ func_mode_install () fi } -test "$opt_mode" = install && func_mode_install ${1+"$@"} +test "$mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p @@ -3267,22 +2323,6 @@ func_generate_dlsyms () extern \"C\" { #endif -#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) -#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" -#endif - -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - /* External symbol declarations for the compiler. */\ " @@ -3292,11 +2332,10 @@ extern \"C\" { $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. - progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do - func_to_tool_file "$progfile" func_convert_file_msys_to_w32 - func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" - $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + func_verbose "extracting global C symbols from \`$progfile'" + $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then @@ -3332,7 +2371,7 @@ extern \"C\" { eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in - *cygwin* | *mingw* | *cegcc* ) + *cygwin | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; @@ -3345,52 +2384,10 @@ extern \"C\" { func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" - case $host in - *cygwin* | *mingw* | *cegcc* ) - # if an import library, we need to obtain dlname - if func_win32_import_lib_p "$dlprefile"; then - func_tr_sh "$dlprefile" - eval "curr_lafile=\$libfile_$func_tr_sh_result" - dlprefile_dlbasename="" - if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then - # Use subshell, to avoid clobbering current variable values - dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` - if test -n "$dlprefile_dlname" ; then - func_basename "$dlprefile_dlname" - dlprefile_dlbasename="$func_basename_result" - else - # no lafile. user explicitly requested -dlpreopen <import library>. - $sharedlib_from_linklib_cmd "$dlprefile" - dlprefile_dlbasename=$sharedlib_from_linklib_result - fi - fi - $opt_dry_run || { - if test -n "$dlprefile_dlbasename" ; then - eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' - else - func_warning "Could not compute DLL name from $name" - eval '$ECHO ": $name " >> "$nlist"' - fi - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | - $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" - } - else # not an import lib - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - fi - ;; - *) - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - ;; - esac + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } done $opt_dry_run || { @@ -3418,19 +2415,36 @@ extern \"C\" { if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else - echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" fi - echo >> "$output_objdir/$my_dlsyms" "\ + $ECHO >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; -extern LT_DLSYM_CONST lt_dlsymlist +" + case $host in + *cygwin* | *mingw* | *cegcc* ) + $ECHO >> "$output_objdir/$my_dlsyms" "\ +/* DATA imports from DLLs on WIN32 con't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs. */" + lt_dlsym_const= ;; + *osf5*) + echo >> "$output_objdir/$my_dlsyms" "\ +/* This system does not cope well with relocations in const data */" + lt_dlsym_const= ;; + *) + lt_dlsym_const=const ;; + esac + + $ECHO >> "$output_objdir/$my_dlsyms" "\ +extern $lt_dlsym_const lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; -LT_DLSYM_CONST lt_dlsymlist +$lt_dlsym_const lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," @@ -3443,7 +2457,7 @@ lt_${my_prefix}_LTX_preloaded_symbols[] = eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac - echo >> "$output_objdir/$my_dlsyms" "\ + $ECHO >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; @@ -3486,7 +2500,7 @@ static const void *lt_preloaded_setup() { for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; - *) func_append symtab_cflags " $arg" ;; + *) symtab_cflags="$symtab_cflags $arg" ;; esac done @@ -3501,16 +2515,16 @@ static const void *lt_preloaded_setup() { case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` fi ;; *) - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; esac ;; @@ -3524,8 +2538,8 @@ static const void *lt_preloaded_setup() { # really was required. # Nullify the symbol file. - compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } @@ -3535,7 +2549,6 @@ static const void *lt_preloaded_setup() { # 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. -# Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug @@ -3546,11 +2559,9 @@ func_win32_libid () win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static - # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - func_to_tool_file "$1" func_convert_file_msys_to_w32 - win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | $SED -n -e ' 1,100{ / I /{ @@ -3579,131 +2590,6 @@ func_win32_libid () $ECHO "$win32_libid_type" } -# func_cygming_dll_for_implib ARG -# -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib () -{ - $opt_debug - sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` -} - -# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs -# -# The is the core of a fallback implementation of a -# platform-specific function to extract the name of the -# DLL associated with the specified import library LIBNAME. -# -# SECTION_NAME is either .idata$6 or .idata$7, depending -# on the platform and compiler that created the implib. -# -# Echos the name of the DLL associated with the -# specified import library. -func_cygming_dll_for_implib_fallback_core () -{ - $opt_debug - match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` - $OBJDUMP -s --section "$1" "$2" 2>/dev/null | - $SED '/^Contents of section '"$match_literal"':/{ - # Place marker at beginning of archive member dllname section - s/.*/====MARK====/ - p - d - } - # These lines can sometimes be longer than 43 characters, but - # are always uninteresting - /:[ ]*file format pe[i]\{,1\}-/d - /^In archive [^:]*:/d - # Ensure marker is printed - /^====MARK====/p - # Remove all lines with less than 43 characters - /^.\{43\}/!d - # From remaining lines, remove first 43 characters - s/^.\{43\}//' | - $SED -n ' - # Join marker and all lines until next marker into a single line - /^====MARK====/ b para - H - $ b para - b - :para - x - s/\n//g - # Remove the marker - s/^====MARK====// - # Remove trailing dots and whitespace - s/[\. \t]*$// - # Print - /./p' | - # we now have a list, one entry per line, of the stringified - # contents of the appropriate section of all members of the - # archive which possess that section. Heuristic: eliminate - # all those which have a first or second character that is - # a '.' (that is, objdump's representation of an unprintable - # character.) This should work for all archives with less than - # 0x302f exports -- but will fail for DLLs whose name actually - # begins with a literal '.' or a single character followed by - # a '.'. - # - # Of those that remain, print the first one. - $SED -e '/^\./d;/^.\./d;q' -} - -# func_cygming_gnu_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is a GNU/binutils-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_gnu_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` - test -n "$func_cygming_gnu_implib_tmp" -} - -# func_cygming_ms_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is an MS-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_ms_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` - test -n "$func_cygming_ms_implib_tmp" -} - -# func_cygming_dll_for_implib_fallback ARG -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# -# This fallback implementation is for use when $DLLTOOL -# does not support the --identify-strict option. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib_fallback () -{ - $opt_debug - if func_cygming_gnu_implib_p "$1" ; then - # binutils import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` - elif func_cygming_ms_implib_p "$1" ; then - # ms-generated import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` - else - # unknown - sharedlib_from_linklib_result="" - fi -} # func_extract_an_archive dir oldlib @@ -3712,18 +2598,7 @@ func_extract_an_archive () $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" - if test "$lock_old_archive_extraction" = yes; then - lockfile=$f_ex_an_ar_oldlib.lock - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - fi - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ - 'stat=$?; rm -f "$lockfile"; exit $stat' - if test "$lock_old_archive_extraction" = yes; then - $opt_dry_run || rm -f "$lockfile" - fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else @@ -3794,7 +2669,7 @@ func_extract_archives () darwin_file= darwin_files= for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ @@ -3809,30 +2684,25 @@ func_extract_archives () func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. + +# func_emit_wrapper_part1 [arg=no] # -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () +# Emit the first part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part1 () { - func_emit_wrapper_arg1=${1-no} + func_emit_wrapper_part1_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part1_arg1=$1 + fi $ECHO "\ #! $SHELL @@ -3848,6 +2718,7 @@ func_emit_wrapper () # 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' # Be Bourne compatible @@ -3878,132 +2749,31 @@ if test \"\$libtool_install_magic\" = \"$magic\"; then else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then - file=\"\$0\"" - - qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` - $ECHO "\ - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - ECHO=\"$qECHO\" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string "--lt-" -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's $0 value, followed by "$@". -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=\$0 - shift - for lt_opt - do - case \"\$lt_opt\" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` - test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. - lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` - cat \"\$lt_dump_D/\$lt_dump_F\" - exit 0 - ;; - --lt-*) - \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n \"\$lt_option_debug\"; then - echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" - lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir/\$program\" \${1+\"\$@\"} + 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\ " - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from \$@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - for lt_wr_arg - do - case \$lt_wr_arg in - --lt-*) ;; - *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; - esac - shift - done - func_exec_program_core \${1+\"\$@\"} -} - - # Parse options - func_parse_lt_options \"\$0\" \${1+\"\$@\"} + $ECHO "\ # Find the directory that this script lives in. - thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + 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'\` + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do - destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then @@ -4013,13 +2783,30 @@ func_exec_program () esac fi - file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done +" +} +# end: func_emit_wrapper_part1 + +# func_emit_wrapper_part2 [arg=no] +# +# Emit the second part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part2 () +{ + func_emit_wrapper_part2_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part2_arg1=$1 + fi + + $ECHO "\ # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then @@ -4027,7 +2814,7 @@ func_exec_program () fi # remove .libs from thisdir case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi @@ -4082,18 +2869,6 @@ func_exec_program () if test -f \"\$progdir/\$program\"; then" - # fixup the dll searchpath if we need to. - # - # Fix the DLL searchpath if we need to. Do this before prepending - # to shlibpath, because on Windows, both are PATH and uninstalled - # libraries must come first. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ @@ -4102,28 +2877,253 @@ func_exec_program () # 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 \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + $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 "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. - func_exec_program \${1+\"\$@\"} +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + 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 + $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } +# end: func_emit_wrapper_part2 + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=no + if test -n "$1" ; then + func_emit_wrapper_arg1=$1 + fi + + # split this up so that func_emit_cwrapperexe_src + # can call each part independently. + func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" + func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" +} + + +# func_to_host_path arg +# +# Convert paths to host format when used with build tools. +# Intended for use with "native" mingw (where libtool itself +# is running under the msys shell), or in the following cross- +# build environments: +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# where wine is equipped with the `winepath' executable. +# In the native mingw case, the (msys) shell automatically +# converts paths for any non-msys applications it launches, +# but that facility isn't available from inside the cwrapper. +# Similar accommodations are necessary for $host mingw and +# $build cygwin. Calling this function does no harm for other +# $host/$build combinations not listed above. +# +# ARG is the path (on $build) that should be converted to +# the proper representation for $host. The result is stored +# in $func_to_host_path_result. +func_to_host_path () +{ + func_to_host_path_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + case $build in + *mingw* ) # actually, msys + # awkward: cmd appends spaces to result + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_path_tmp1=`( cmd //c echo "$1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_path_tmp1=`cygpath -w "$1"` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # Unfortunately, winepath does not exit with a non-zero + # error code, so we are forced to check the contents of + # stdout. On the other hand, if the command is not + # found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both + # error code of zero AND non-empty stdout, which explains + # the odd construction: + func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + else + # Allow warning below. + func_to_host_path_result="" + fi + ;; + esac + if test -z "$func_to_host_path_result" ; then + func_error "Could not determine host path corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_path_result="$1" + fi + ;; + esac + fi +} +# end: func_to_host_path +# func_to_host_pathlist arg +# +# Convert pathlists to host format when used with build tools. +# See func_to_host_path(), above. This function supports the +# following $build/$host combinations (but does no harm for +# combinations not listed here): +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# +# Path separators are also converted from $build format to +# $host format. If ARG begins or ends with a path separator +# character, it is preserved (but converted to $host format) +# on output. +# +# ARG is a pathlist (on $build) that should be converted to +# the proper representation on $host. The result is stored +# in $func_to_host_pathlist_result. +func_to_host_pathlist () +{ + func_to_host_pathlist_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_to_host_pathlist_tmp2="$1" + # Once set for this call, this variable should not be + # reassigned. It is used in tha fallback case. + func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e 's|^:*||' -e 's|:*$||'` + case $build in + *mingw* ) # Actually, msys. + # Awkward: cmd appends spaces to result. + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # unfortunately, winepath doesn't convert pathlists + func_to_host_pathlist_result="" + func_to_host_pathlist_oldIFS=$IFS + IFS=: + for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do + IFS=$func_to_host_pathlist_oldIFS + if test -n "$func_to_host_pathlist_f" ; then + func_to_host_path "$func_to_host_pathlist_f" + if test -n "$func_to_host_path_result" ; then + if test -z "$func_to_host_pathlist_result" ; then + func_to_host_pathlist_result="$func_to_host_path_result" + else + func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" + fi + fi + fi + IFS=: + done + IFS=$func_to_host_pathlist_oldIFS + ;; + esac + if test -z "$func_to_host_pathlist_result" ; then + func_error "Could not determine the host path(s) corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This may break if $1 contains DOS-style drive + # specifications. The fix is not to complicate the expression + # below, but for the user to provide a working wine installation + # with winepath so that path translation in the cross-to-mingw + # case works properly. + lt_replace_pathsep_nix_to_dos="s|:|;|g" + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_replace_pathsep_nix_to_dos"` + fi + # Now, add the leading and trailing path separators back + case "$1" in + :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" + ;; + esac + case "$1" in + *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" + ;; + esac + ;; + esac + fi +} +# end: func_to_host_pathlist # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout @@ -4141,23 +3141,31 @@ func_emit_cwrapperexe_src () This wrapper executable should never be moved out of the build directory. If it is, it will not operate correctly. + + Currently, it simply execs the wrapper *script* "$SHELL $output", + but could eventually absorb all of the scripts functionality and + exec $objdir/$outputname directly. */ EOF cat <<"EOF" -#ifdef _MSC_VER -# define _CRT_SECURE_NO_DEPRECATE 1 -#endif #include <stdio.h> #include <stdlib.h> #ifdef _MSC_VER # include <direct.h> # include <process.h> # include <io.h> +# define setmode _setmode #else # include <unistd.h> # include <stdint.h> # ifdef __CYGWIN__ # include <io.h> +# define HAVE_SETENV +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif # endif #endif #include <malloc.h> @@ -4169,44 +3177,6 @@ EOF #include <fcntl.h> #include <sys/stat.h> -/* declarations of non-ANSI functions */ -#if defined(__MINGW32__) -# ifdef __STRICT_ANSI__ -int _putenv (const char *); -# endif -#elif defined(__CYGWIN__) -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif -/* #elif defined (other platforms) ... */ -#endif - -/* portability defines, excluding path handling macros */ -#if defined(_MSC_VER) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -# define S_IXUSR _S_IEXEC -# ifndef _INTPTR_T_DEFINED -# define _INTPTR_T_DEFINED -# define intptr_t int -# endif -#elif defined(__MINGW32__) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -#elif defined(__CYGWIN__) -# define HAVE_SETENV -# define FOPEN_WB "wb" -/* #elif defined (other platforms) ... */ -#endif - #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) @@ -4222,7 +3192,14 @@ int setenv (const char *, const char *, int); # define S_IXGRP 0 #endif -/* path handling portability macros */ +#ifdef _MSC_VER +# define S_IXUSR _S_IEXEC +# define stat _stat +# ifndef _INTPTR_T_DEFINED +# define intptr_t int +# endif +#endif + #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' @@ -4253,6 +3230,10 @@ int setenv (const char *, const char *, int); # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ +#ifdef __CYGWIN__ +# define FOPEN_WB "wb" +#endif + #ifndef FOPEN_WB # define FOPEN_WB "w" #endif @@ -4265,13 +3246,22 @@ int setenv (const char *, const char *, int); if (stale) { free ((void *) stale); stale = 0; } \ } while (0) -#if defined(LT_DEBUGWRAPPER) -static int lt_debug = 1; +#undef LTWRAPPER_DEBUGPRINTF +#if defined DEBUGWRAPPER +# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args +static void +ltwrapper_debugprintf (const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); +} #else -static int lt_debug = 0; +# define LTWRAPPER_DEBUGPRINTF(args) #endif -const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ +const char *program_name = NULL; void *xmalloc (size_t num); char *xstrdup (const char *string); @@ -4281,27 +3271,41 @@ char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); -void lt_debugprintf (const char *file, int line, const char *fmt, ...); -void lt_fatal (const char *file, int line, const char *message, ...); -static const char *nonnull (const char *s); -static const char *nonempty (const char *s); +void lt_fatal (const char *message, ...); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_opt_process_env_set (const char *arg); +void lt_opt_process_env_prepend (const char *arg); +void lt_opt_process_env_append (const char *arg); +int lt_split_name_value (const char *arg, char** name, char** value); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); -char **prepare_spawn (char **argv); -void lt_dump_script (FILE *f); + +static const char *script_text_part1 = EOF + func_emit_wrapper_part1 yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ "/' -e 's/$/\\n"/' + echo ";" cat <<EOF -volatile const char * MAGIC_EXE = "$magic_exe"; + +static const char *script_text_part2 = +EOF + func_emit_wrapper_part2 yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ "/' -e 's/$/\\n"/' + echo ";" + + cat <<EOF +const char * MAGIC_EXE = "$magic_exe"; const char * LIB_PATH_VARNAME = "$shlibpath_var"; EOF if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - func_to_host_path "$temp_rpath" + func_to_host_pathlist "$temp_rpath" cat <<EOF -const char * LIB_PATH_VALUE = "$func_to_host_path_result"; +const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; EOF else cat <<"EOF" @@ -4310,10 +3314,10 @@ EOF fi if test -n "$dllsearchpath"; then - func_to_host_path "$dllsearchpath:" + func_to_host_pathlist "$dllsearchpath:" cat <<EOF const char * EXE_PATH_VARNAME = "PATH"; -const char * EXE_PATH_VALUE = "$func_to_host_path_result"; +const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; EOF else cat <<"EOF" @@ -4336,10 +3340,24 @@ EOF cat <<"EOF" #define LTWRAPPER_OPTION_PREFIX "--lt-" +#define LTWRAPPER_OPTION_PREFIX_LENGTH 5 +static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH; static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; + static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; -static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; + +static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7; +static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set"; + /* argument is putenv-style "foo=bar", value of foo is set to bar */ + +static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11; +static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend"; + /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */ + +static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10; +static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append"; + /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */ int main (int argc, char *argv[]) @@ -4356,13 +3374,10 @@ main (int argc, char *argv[]) int i; program_name = (char *) xstrdup (base_name (argv[0])); - newargz = XMALLOC (char *, argc + 1); + LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0])); + LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name)); - /* very simple arg parsing; don't want to rely on getopt - * also, copy all non cwrapper options to newargz, except - * argz[0], which is handled differently - */ - newargc=0; + /* very simple arg parsing; don't want to rely on getopt */ for (i = 1; i < argc; i++) { if (strcmp (argv[i], dumpscript_opt) == 0) @@ -4376,57 +3391,25 @@ EOF esac cat <<"EOF" - lt_dump_script (stdout); + printf ("%s", script_text_part1); + printf ("%s", script_text_part2); return 0; } - if (strcmp (argv[i], debug_opt) == 0) - { - lt_debug = 1; - continue; - } - if (strcmp (argv[i], ltwrapper_option_prefix) == 0) - { - /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX - namespace, but it is not one of the ones we know about and - have already dealt with, above (inluding dump-script), then - report an error. Otherwise, targets might begin to believe - they are allowed to use options in the LTWRAPPER_OPTION_PREFIX - namespace. The first time any user complains about this, we'll - need to make LTWRAPPER_OPTION_PREFIX a configure-time option - or a configure.ac-settable value. - */ - lt_fatal (__FILE__, __LINE__, - "unrecognized %s option: '%s'", - ltwrapper_option_prefix, argv[i]); - } - /* otherwise ... */ - newargz[++newargc] = xstrdup (argv[i]); } - newargz[++newargc] = NULL; - -EOF - cat <<EOF - /* The GNU banner must be the first non-error debug message */ - lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); -EOF - cat <<"EOF" - lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); - lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); + newargz = XMALLOC (char *, argc + 1); tmp_pathspec = find_executable (argv[0]); if (tmp_pathspec == NULL) - lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); - lt_debugprintf (__FILE__, __LINE__, - "(main) found exe (before symlink chase) at: %s\n", - tmp_pathspec); + lt_fatal ("Couldn't find %s", argv[0]); + LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n", + tmp_pathspec)); actual_cwrapper_path = chase_symlinks (tmp_pathspec); - lt_debugprintf (__FILE__, __LINE__, - "(main) found exe (after symlink chase) at: %s\n", - actual_cwrapper_path); + LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n", + actual_cwrapper_path)); XFREE (tmp_pathspec); - actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); + actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path)); strendzap (actual_cwrapper_path, actual_cwrapper_name); /* wrapper name transforms */ @@ -4444,9 +3427,8 @@ EOF target_name = tmp_pathspec; tmp_pathspec = 0; - lt_debugprintf (__FILE__, __LINE__, - "(main) libtool target name: %s\n", - target_name); + LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n", + target_name)); EOF cat <<EOF @@ -4496,19 +3478,80 @@ EOF lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ lt_setenv ("DUALCASE", "1"); /* for MSK sh */ - /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must - be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) - because on Windows, both *_VARNAMEs are PATH but uninstalled - libraries must come first. */ - lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); + lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); - lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", - nonnull (lt_argv_zero)); + newargc=0; + for (i = 1; i < argc; i++) + { + if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0) + { + if (argv[i][env_set_opt_len] == '=') + { + const char *p = argv[i] + env_set_opt_len + 1; + lt_opt_process_env_set (p); + } + else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc) + { + lt_opt_process_env_set (argv[++i]); /* don't copy */ + } + else + lt_fatal ("%s missing required argument", env_set_opt); + continue; + } + if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0) + { + if (argv[i][env_prepend_opt_len] == '=') + { + const char *p = argv[i] + env_prepend_opt_len + 1; + lt_opt_process_env_prepend (p); + } + else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc) + { + lt_opt_process_env_prepend (argv[++i]); /* don't copy */ + } + else + lt_fatal ("%s missing required argument", env_prepend_opt); + continue; + } + if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0) + { + if (argv[i][env_append_opt_len] == '=') + { + const char *p = argv[i] + env_append_opt_len + 1; + lt_opt_process_env_append (p); + } + else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc) + { + lt_opt_process_env_append (argv[++i]); /* don't copy */ + } + else + lt_fatal ("%s missing required argument", env_append_opt); + continue; + } + if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0) + { + /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX + namespace, but it is not one of the ones we know about and + have already dealt with, above (inluding dump-script), then + report an error. Otherwise, targets might begin to believe + they are allowed to use options in the LTWRAPPER_OPTION_PREFIX + namespace. The first time any user complains about this, we'll + need to make LTWRAPPER_OPTION_PREFIX a configure-time option + or a configure.ac-settable value. + */ + lt_fatal ("Unrecognized option in %s namespace: '%s'", + ltwrapper_option_prefix, argv[i]); + } + /* otherwise ... */ + newargz[++newargc] = xstrdup (argv[i]); + } + newargz[++newargc] = NULL; + + LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>"))); for (i = 0; i < newargc; i++) { - lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", - i, nonnull (newargz[i])); + LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>"))); } EOF @@ -4517,14 +3560,11 @@ EOF mingw*) cat <<"EOF" /* execv doesn't actually work on mingw as expected on unix */ - newargz = prepare_spawn (newargz); rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); if (rval == -1) { /* failed to start process */ - lt_debugprintf (__FILE__, __LINE__, - "(main) failed to launch target \"%s\": %s\n", - lt_argv_zero, nonnull (strerror (errno))); + LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); return 127; } return rval; @@ -4546,7 +3586,7 @@ xmalloc (size_t num) { void *p = (void *) malloc (num); if (!p) - lt_fatal (__FILE__, __LINE__, "memory exhausted"); + lt_fatal ("Memory exhausted"); return p; } @@ -4580,8 +3620,8 @@ check_executable (const char *path) { struct stat st; - lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", - nonempty (path)); + LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); if ((!path) || (!*path)) return 0; @@ -4598,8 +3638,8 @@ make_executable (const char *path) int rval = 0; struct stat st; - lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", - nonempty (path)); + LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); if ((!path) || (!*path)) return 0; @@ -4625,8 +3665,8 @@ find_executable (const char *wrapper) int tmp_len; char *concat_name; - lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", - nonempty (wrapper)); + LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", + wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; @@ -4679,8 +3719,7 @@ find_executable (const char *wrapper) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); + lt_fatal ("getcwd failed"); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); @@ -4705,8 +3744,7 @@ find_executable (const char *wrapper) } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); + lt_fatal ("getcwd failed"); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); @@ -4732,9 +3770,8 @@ chase_symlinks (const char *pathspec) int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { - lt_debugprintf (__FILE__, __LINE__, - "checking path component for symlinks: %s\n", - tmp_pathspec); + LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", + tmp_pathspec)); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) @@ -4756,9 +3793,8 @@ chase_symlinks (const char *pathspec) } else { - lt_fatal (__FILE__, __LINE__, - "error accessing file \"%s\": %s", - tmp_pathspec, nonnull (strerror (errno))); + char *errstr = strerror (errno); + lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); } } XFREE (tmp_pathspec); @@ -4771,8 +3807,7 @@ chase_symlinks (const char *pathspec) tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { - lt_fatal (__FILE__, __LINE__, - "could not follow symlinks for %s", pathspec); + lt_fatal ("Could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif @@ -4798,25 +3833,11 @@ strendzap (char *str, const char *pat) return str; } -void -lt_debugprintf (const char *file, int line, const char *fmt, ...) -{ - va_list args; - if (lt_debug) - { - (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); - } -} - static void -lt_error_core (int exit_status, const char *file, - int line, const char *mode, +lt_error_core (int exit_status, const char *mode, const char *message, va_list ap) { - fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); @@ -4825,32 +3846,20 @@ lt_error_core (int exit_status, const char *file, } void -lt_fatal (const char *file, int line, const char *message, ...) +lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); - lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } -static const char * -nonnull (const char *s) -{ - return s ? s : "(null)"; -} - -static const char * -nonempty (const char *s) -{ - return (s && !*s) ? "(empty)" : nonnull (s); -} - void lt_setenv (const char *name, const char *value) { - lt_debugprintf (__FILE__, __LINE__, - "(lt_setenv) setting '%s' to '%s'\n", - nonnull (name), nonnull (value)); + LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", + (name ? name : "<NULL>"), + (value ? value : "<NULL>"))); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ @@ -4895,12 +3904,95 @@ lt_extend_str (const char *orig_value, const char *add, int to_end) return new_value; } +int +lt_split_name_value (const char *arg, char** name, char** value) +{ + const char *p; + int len; + if (!arg || !*arg) + return 1; + + p = strchr (arg, (int)'='); + + if (!p) + return 1; + + *value = xstrdup (++p); + + len = strlen (arg) - strlen (*value); + *name = XMALLOC (char, len); + strncpy (*name, arg, len-1); + (*name)[len - 1] = '\0'; + + return 0; +} + +void +lt_opt_process_env_set (const char *arg) +{ + char *name = NULL; + char *value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); + } + + lt_setenv (name, value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_prepend (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_append (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 1); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + void lt_update_exe_path (const char *name, const char *value) { - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); + LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + (name ? name : "<NULL>"), + (value ? value : "<NULL>"))); if (name && *name && value && *value) { @@ -4919,9 +4011,9 @@ lt_update_exe_path (const char *name, const char *value) void lt_update_lib_path (const char *name, const char *value) { - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); + LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + (name ? name : "<NULL>"), + (value ? value : "<NULL>"))); if (name && *name && value && *value) { @@ -4931,152 +4023,11 @@ lt_update_lib_path (const char *name, const char *value) } } -EOF - case $host_os in - mingw*) - cat <<"EOF" - -/* Prepares an argument vector before calling spawn(). - Note that spawn() does not by itself call the command interpreter - (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : - ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&v); - v.dwPlatformId == VER_PLATFORM_WIN32_NT; - }) ? "cmd.exe" : "command.com"). - Instead it simply concatenates the arguments, separated by ' ', and calls - CreateProcess(). We must quote the arguments since Win32 CreateProcess() - interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a - special way: - - Space and tab are interpreted as delimiters. They are not treated as - delimiters if they are surrounded by double quotes: "...". - - Unescaped double quotes are removed from the input. Their only effect is - that within double quotes, space and tab are treated like normal - characters. - - Backslashes not followed by double quotes are not special. - - But 2*n+1 backslashes followed by a double quote become - n backslashes followed by a double quote (n >= 0): - \" -> " - \\\" -> \" - \\\\\" -> \\" - */ -#define SHELL_SPECIAL_CHARS "\"\\ \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" -#define SHELL_SPACE_CHARS " \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" -char ** -prepare_spawn (char **argv) -{ - size_t argc; - char **new_argv; - size_t i; - - /* Count number of arguments. */ - for (argc = 0; argv[argc] != NULL; argc++) - ; - - /* Allocate new argument vector. */ - new_argv = XMALLOC (char *, argc + 1); - - /* Put quoted arguments into the new argument vector. */ - for (i = 0; i < argc; i++) - { - const char *string = argv[i]; - - if (string[0] == '\0') - new_argv[i] = xstrdup ("\"\""); - else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) - { - int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); - size_t length; - unsigned int backslashes; - const char *s; - char *quoted_string; - char *p; - - length = 0; - backslashes = 0; - if (quote_around) - length++; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - length += backslashes + 1; - length++; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - length += backslashes + 1; - quoted_string = XMALLOC (char, length + 1); - - p = quoted_string; - backslashes = 0; - if (quote_around) - *p++ = '"'; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - { - unsigned int j; - for (j = backslashes + 1; j > 0; j--) - *p++ = '\\'; - } - *p++ = c; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - { - unsigned int j; - for (j = backslashes; j > 0; j--) - *p++ = '\\'; - *p++ = '"'; - } - *p = '\0'; - - new_argv[i] = quoted_string; - } - else - new_argv[i] = (char *) string; - } - new_argv[argc] = NULL; - - return new_argv; -} -EOF - ;; - esac - - cat <<"EOF" -void lt_dump_script (FILE* f) -{ -EOF - func_emit_wrapper yes | - $SED -e 's/\([\\"]\)/\\\1/g' \ - -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' - - cat <<"EOF" -} EOF } # end: func_emit_cwrapperexe_src -# func_win32_import_lib_p ARG -# True if ARG is an import lib, as indicated by $file_magic_cmd -func_win32_import_lib_p () -{ - $opt_debug - case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in - *import*) : ;; - *) false ;; - esac -} - # func_mode_link arg... func_mode_link () { @@ -5121,7 +4072,6 @@ func_mode_link () new_inherited_linker_flags= avoid_version=no - bindir= dlfiles= dlprefiles= dlself=no @@ -5214,11 +4164,6 @@ func_mode_link () esac case $prev in - bindir) - bindir="$arg" - prev= - continue - ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. @@ -5250,9 +4195,9 @@ func_mode_link () ;; *) if test "$prev" = dlfiles; then - func_append dlfiles " $arg" + dlfiles="$dlfiles $arg" else - func_append dlprefiles " $arg" + dlprefiles="$dlprefiles $arg" fi prev= continue @@ -5276,7 +4221,7 @@ func_mode_link () *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; - *) func_append deplibs " $qarg.ltframework" # this is fixed later + *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; @@ -5295,7 +4240,7 @@ func_mode_link () moreargs= for fil in `cat "$save_arg"` do -# func_append moreargs " $fil" +# moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. @@ -5324,7 +4269,7 @@ func_mode_link () if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" + dlfiles="$dlfiles $pic_object" prev= continue else @@ -5336,7 +4281,7 @@ func_mode_link () # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. - func_append dlprefiles " $pic_object" + dlprefiles="$dlprefiles $pic_object" prev= fi @@ -5406,12 +4351,12 @@ func_mode_link () if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; - *) func_append rpath " $arg" ;; + *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; - *) func_append xrpath " $arg" ;; + *) xrpath="$xrpath $arg" ;; esac fi prev= @@ -5423,28 +4368,28 @@ func_mode_link () continue ;; weak) - func_append weak_libs " $arg" + weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $qarg" + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) - func_append compiler_flags " $qarg" + compiler_flags="$compiler_flags $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $wl$qarg" + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" @@ -5480,11 +4425,6 @@ func_mode_link () continue ;; - -bindir) - prev=bindir - continue - ;; - -dlopen) prev=dlfiles continue @@ -5535,16 +4475,15 @@ func_mode_link () ;; -L*) - func_stripname "-L" '' "$arg" - if test -z "$func_stripname_result"; then + func_stripname '-L' '' "$arg" + dir=$func_stripname_result + if test -z "$dir"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; @@ -5556,30 +4495,24 @@ func_mode_link () ;; esac case "$deplibs " in - *" -L$dir "* | *" $arg "*) - # Will only happen for absolute or sysroot arguments - ;; + *" -L$dir "*) ;; *) - # Preserve sysroot, but never include relative directories - case $dir in - [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; - *) func_append deplibs " -L$dir" ;; - esac - func_append lib_search_path " $dir" + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; - *) func_append dllsearchpath ":$dir";; + *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; + *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac @@ -5589,7 +4522,7 @@ func_mode_link () -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) # These systems don't actually have a C or math library (as such) continue ;; @@ -5603,7 +4536,7 @@ func_mode_link () ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework - func_append deplibs " System.ltframework" + deplibs="$deplibs System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) @@ -5623,7 +4556,7 @@ func_mode_link () ;; esac fi - func_append deplibs " $arg" + deplibs="$deplibs $arg" continue ;; @@ -5635,8 +4568,8 @@ func_mode_link () # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot|--sysroot) - func_append compiler_flags " $arg" + -model|-arch|-isysroot) + compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler @@ -5644,12 +4577,12 @@ func_mode_link () ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - func_append compiler_flags " $arg" + compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; - * ) func_append new_inherited_linker_flags " $arg" ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; esac continue ;; @@ -5716,17 +4649,13 @@ func_mode_link () # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; - =*) - func_stripname '=' '' "$dir" - dir=$lt_sysroot$func_stripname_result - ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; - *) func_append xrpath " $dir" ;; + *) xrpath="$xrpath $dir" ;; esac continue ;; @@ -5779,8 +4708,8 @@ func_mode_link () for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" - func_append arg " $func_quote_for_eval_result" - func_append compiler_flags " $func_quote_for_eval_result" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" @@ -5795,9 +4724,9 @@ func_mode_link () for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" - func_append arg " $wl$func_quote_for_eval_result" - func_append compiler_flags " $wl$func_quote_for_eval_result" - func_append linker_flags " $func_quote_for_eval_result" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" + linker_flags="$linker_flags $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" @@ -5825,27 +4754,23 @@ func_mode_link () arg="$func_quote_for_eval_result" ;; - # Flags to be passed through unchanged, with rationale: - # -64, -mips[0-9] enable 64-bit mode for the SGI compiler - # -r[0-9][0-9]* specify processor for the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler - # +DA*, +DD* enable 64-bit mode for the HP compiler - # -q* compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* architecture-specific flags for GCC - # -F/path path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* profiling flags for GCC - # @file GCC response files - # -tp=* Portland pgcc target processor selection - # --sysroot=* for sysroot support - # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -F/path gives path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC + # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-flto*|-fwhopr*|-fuse-linker-plugin) + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" - func_append compiler_flags " $arg" + compiler_flags="$compiler_flags $arg" continue ;; @@ -5857,7 +4782,7 @@ func_mode_link () *.$objext) # A standard object. - func_append objs " $arg" + objs="$objs $arg" ;; *.lo) @@ -5888,7 +4813,7 @@ func_mode_link () if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" + dlfiles="$dlfiles $pic_object" prev= continue else @@ -5900,7 +4825,7 @@ func_mode_link () # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. - func_append dlprefiles " $pic_object" + dlprefiles="$dlprefiles $pic_object" prev= fi @@ -5945,25 +4870,24 @@ func_mode_link () *.$libext) # An archive. - func_append deplibs " $arg" - func_append old_deplibs " $arg" + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. - func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. - func_append dlfiles " $func_resolve_sysroot_result" + dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. - func_append dlprefiles " $func_resolve_sysroot_result" + dlprefiles="$dlprefiles $arg" prev= else - func_append deplibs " $func_resolve_sysroot_result" + deplibs="$deplibs $arg" fi continue ;; @@ -6001,7 +4925,7 @@ func_mode_link () if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` + eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi @@ -6010,8 +4934,6 @@ func_mode_link () func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" - func_to_tool_file "$output_objdir/" - tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" @@ -6032,12 +4954,12 @@ func_mode_link () # 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 $opt_preserve_dup_deps ; then + if $opt_duplicate_deps ; then case "$libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi - func_append libs " $deplib" + libs="$libs $deplib" done if test "$linkmode" = lib; then @@ -6050,9 +4972,9 @@ func_mode_link () if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in - *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac - func_append pre_post_deps " $pre_post_dep" + pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= @@ -6122,19 +5044,17 @@ func_mode_link () for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= - func_resolve_sysroot "$lib" case $lib in - *.la) func_source "$func_resolve_sysroot_result" ;; + *.la) func_source "$lib" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do - func_basename "$deplib" - deplib_base=$func_basename_result + deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; - *) func_append deplibs " $deplib" ;; + *) deplibs="$deplibs $deplib" ;; esac done done @@ -6155,11 +5075,11 @@ func_mode_link () compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - func_append compiler_flags " $deplib" + compiler_flags="$compiler_flags $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; esac fi fi @@ -6244,7 +5164,7 @@ func_mode_link () if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; esac fi fi @@ -6257,8 +5177,7 @@ func_mode_link () test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" + newlib_search_path="$newlib_search_path $func_stripname_result" ;; prog) if test "$pass" = conv; then @@ -6272,8 +5191,7 @@ func_mode_link () finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" + newlib_search_path="$newlib_search_path $func_stripname_result" ;; *) func_warning "\`-L' is ignored for archives/objects" @@ -6284,21 +5202,17 @@ func_mode_link () -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result + dir=$func_stripname_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; - *) func_append xrpath " $dir" ;; + *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; - *.la) - func_resolve_sysroot "$deplib" - lib=$func_resolve_sysroot_result - ;; + *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" @@ -6316,7 +5230,7 @@ func_mode_link () match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi @@ -6326,15 +5240,15 @@ func_mode_link () ;; esac if test "$valid_a_lib" != yes; then - echo + $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 use here." + $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 use here." else - echo + $ECHO $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" @@ -6361,11 +5275,11 @@ func_mode_link () 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. - func_append newdlprefiles " $deplib" + newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - func_append newdlfiles " $deplib" + newdlfiles="$newdlfiles $deplib" fi fi continue @@ -6407,20 +5321,20 @@ func_mode_link () # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; - *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; esac done fi - dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && func_append dlfiles " $dlopen" - test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then @@ -6431,17 +5345,17 @@ func_mode_link () func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. - func_append convenience " $ladir/$objdir/$old_library" - func_append old_convenience " $ladir/$objdir/$old_library" + 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 $opt_preserve_dup_deps ; then + if $opt_duplicate_deps ; then case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi - func_append tmp_libs " $deplib" + tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" @@ -6452,15 +5366,9 @@ func_mode_link () # Get the name of the library we link against. linklib= - if test -n "$old_library" && - { test "$prefer_static_libs" = yes || - test "$prefer_static_libs,$installed" = "built,no"; }; then - linklib=$old_library - else - for l in $old_library $library_names; do - linklib="$l" - done - fi + for l in $old_library $library_names; do + linklib="$l" + done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi @@ -6477,9 +5385,9 @@ func_mode_link () # 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. - func_append dlprefiles " $lib $dependency_libs" + dlprefiles="$dlprefiles $lib $dependency_libs" else - func_append newdlfiles " $lib" + newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen @@ -6501,14 +5409,14 @@ func_mode_link () # Find the relevant object directory and library name. if test "X$installed" = Xyes; then - if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else - dir="$lt_sysroot$libdir" - absdir="$lt_sysroot$libdir" + dir="$libdir" + absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else @@ -6516,12 +5424,12 @@ func_mode_link () dir="$ladir" absdir="$abs_ladir" # Remove this search path later - func_append notinst_path " $abs_ladir" + notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later - func_append notinst_path " $abs_ladir" + notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" @@ -6532,46 +5440,20 @@ func_mode_link () if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi - case "$host" in - # special handling for platforms with PE-DLLs. - *cygwin* | *mingw* | *cegcc* ) - # Linker will automatically link against shared library if both - # static and shared are present. Therefore, ensure we extract - # symbols from the import library if a shared library is present - # (otherwise, the dlopen module name will be incorrect). We do - # this by putting the import library name into $newdlprefiles. - # We recover the dlopen module name by 'saving' the la file - # name in a special purpose variable, and (later) extracting the - # dlname from the la file. - if test -n "$dlname"; then - func_tr_sh "$dir/$linklib" - eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" - func_append newdlprefiles " $dir/$linklib" - else - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - fi - ;; - * ) - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - func_append newdlprefiles " $dir/$dlname" - else - func_append newdlprefiles " $dir/$linklib" - fi - ;; - esac + # 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" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + dlpreconveniencelibs="$dlpreconveniencelibs $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 @@ -6589,7 +5471,7 @@ func_mode_link () if test "$linkmode" = prog && test "$pass" != link; then - func_append newlib_search_path " $ladir" + newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no @@ -6602,8 +5484,7 @@ func_mode_link () for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" + newlib_search_path="$newlib_search_path $func_stripname_result" ;; esac # Need to link against all dependency_libs? @@ -6614,12 +5495,12 @@ func_mode_link () # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi - if $opt_preserve_dup_deps ; then + if $opt_duplicate_deps ; then case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi - func_append tmp_libs " $deplib" + tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... @@ -6634,7 +5515,7 @@ func_mode_link () # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; - *) func_append temp_rpath "$absdir:" ;; + *) temp_rpath="$temp_rpath$absdir:" ;; esac fi @@ -6646,7 +5527,7 @@ func_mode_link () *) case "$compile_rpath " in *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; + *) compile_rpath="$compile_rpath $absdir" esac ;; esac @@ -6655,7 +5536,7 @@ func_mode_link () *) case "$finalize_rpath " in *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; + *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac @@ -6680,12 +5561,12 @@ func_mode_link () case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded - func_append notinst_deplibs " $lib" + notinst_deplibs="$notinst_deplibs $lib" need_relink=no ;; *) if test "$installed" = no; then - func_append notinst_deplibs " $lib" + notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi ;; @@ -6702,7 +5583,7 @@ func_mode_link () fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - echo + $ECHO if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else @@ -6720,7 +5601,7 @@ func_mode_link () *) case "$compile_rpath " in *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; + *) compile_rpath="$compile_rpath $absdir" esac ;; esac @@ -6729,7 +5610,7 @@ func_mode_link () *) case "$finalize_rpath " in *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; + *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac @@ -6783,7 +5664,7 @@ func_mode_link () linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" - if test "$linkmode" = prog || test "$opt_mode" != relink; then + if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= @@ -6805,9 +5686,9 @@ func_mode_link () if test "X$dlopenmodule" != "X$lib"; 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" + $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 @@ -6839,7 +5720,7 @@ func_mode_link () if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" + add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi @@ -6861,7 +5742,7 @@ func_mode_link () if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; - *) func_append compile_shlibpath "$add_shlibpath:" ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then @@ -6875,13 +5756,13 @@ func_mode_link () test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi - if test "$linkmode" = prog || test "$opt_mode" = relink; then + if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= @@ -6895,7 +5776,7 @@ func_mode_link () elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then @@ -6912,7 +5793,7 @@ func_mode_link () if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" + add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi @@ -6947,21 +5828,21 @@ func_mode_link () # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - echo + $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." + $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." + $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." + $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 @@ -6989,33 +5870,27 @@ func_mode_link () temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; - *) func_append xrpath " $temp_xrpath";; + *) xrpath="$xrpath $temp_xrpath";; esac;; - *) func_append temp_deplibs " $libdir";; + *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi - func_append newlib_search_path " $absdir" + 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" - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result";; - *) func_resolve_sysroot "$deplib" ;; - esac - if $opt_preserve_dup_deps ; then + if $opt_duplicate_deps ; then case "$tmp_libs " in - *" $func_resolve_sysroot_result "*) - func_append specialdeplibs " $func_resolve_sysroot_result" ;; + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi - func_append tmp_libs " $func_resolve_sysroot_result" + tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then @@ -7025,10 +5900,8 @@ func_mode_link () case $deplib in -L*) path="$deplib" ;; *.la) - func_resolve_sysroot "$deplib" - deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." - dir=$func_dirname_result + dir="$func_dirname_result" # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; @@ -7055,8 +5928,8 @@ func_mode_link () if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi - func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" + compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi @@ -7089,7 +5962,7 @@ func_mode_link () compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else - compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" @@ -7106,7 +5979,7 @@ func_mode_link () for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; - *) func_append lib_search_path " $dir" ;; + *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= @@ -7164,10 +6037,10 @@ func_mode_link () -L*) case " $tmp_libs " in *" $deplib "*) ;; - *) func_append tmp_libs " $deplib" ;; + *) tmp_libs="$tmp_libs $deplib" ;; esac ;; - *) func_append tmp_libs " $deplib" ;; + *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" @@ -7183,7 +6056,7 @@ func_mode_link () ;; esac if test -n "$i" ; then - func_append tmp_libs " $i" + tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs @@ -7224,7 +6097,7 @@ func_mode_link () # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" - func_append objs "$old_deplibs" + objs="$objs$old_deplibs" ;; lib) @@ -7257,10 +6130,10 @@ func_mode_link () if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else - echo + $ECHO $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" - func_append libobjs " $objs" + libobjs="$libobjs $objs" fi fi @@ -7325,7 +6198,7 @@ func_mode_link () age="$number_minor" revision="$number_revision" ;; - freebsd-aout|freebsd-elf|qnx|sunos) + freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" @@ -7461,7 +6334,7 @@ func_mode_link () done # Make executables depend on our current version. - func_append verstring ":${current}.0" + verstring="$verstring:${current}.0" ;; qnx) @@ -7529,10 +6402,10 @@ func_mode_link () fi func_generate_dlsyms "$libname" "$libname" "yes" - func_append libobjs " $symfileobj" + libobjs="$libobjs $symfileobj" test "X$libobjs" = "X " && libobjs= - if test "$opt_mode" != relink; then + 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= @@ -7548,7 +6421,7 @@ func_mode_link () continue fi fi - func_append removelist " $p" + removelist="$removelist $p" ;; *) ;; esac @@ -7559,28 +6432,27 @@ func_mode_link () # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - func_append oldlibs " $output_objdir/$libname.$libext" + oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` + 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 "s% $path % %g"` - # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` - # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` + # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` + # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -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 - func_replace_sysroot "$libdir" - func_append temp_xrpath " -R$func_replace_sysroot_result" + temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then @@ -7594,7 +6466,7 @@ func_mode_link () for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; - *) func_append dlfiles " $lib" ;; + *) dlfiles="$dlfiles $lib" ;; esac done @@ -7604,19 +6476,19 @@ func_mode_link () for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; - *) func_append dlprefiles " $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* | *-cegcc* | *-*-haiku*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework - func_append deplibs " System.ltframework" + deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. @@ -7633,7 +6505,7 @@ func_mode_link () *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then - func_append deplibs " -lc" + deplibs="$deplibs -lc" fi ;; esac @@ -7682,7 +6554,7 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) - func_append newdeplibs " $i" + newdeplibs="$newdeplibs $i" i="" ;; esac @@ -7693,21 +6565,21 @@ EOF set dummy $deplib_matches; shift deplib_match=$1 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - func_append newdeplibs " $i" + newdeplibs="$newdeplibs $i" else droppeddeps=yes - echo + $ECHO $ECHO "*** Warning: dynamic linker does not accept needed library $i." - 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 I believe you do not have" - echo "*** because a test_compile did reveal that the linker did not use it for" - echo "*** its dynamic dependency list that programs get resolved with at runtime." + $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 I believe you do not have" + $ECHO "*** because a test_compile did reveal that the linker did not use it for" + $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." fi fi ;; *) - func_append newdeplibs " $i" + newdeplibs="$newdeplibs $i" ;; esac done @@ -7725,7 +6597,7 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) - func_append newdeplibs " $i" + newdeplibs="$newdeplibs $i" i="" ;; esac @@ -7736,29 +6608,29 @@ EOF set dummy $deplib_matches; shift deplib_match=$1 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - func_append newdeplibs " $i" + newdeplibs="$newdeplibs $i" else droppeddeps=yes - echo + $ECHO $ECHO "*** Warning: dynamic linker does not accept needed library $i." - 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 a test_compile did reveal that the linker did not use this one" - echo "*** as a dynamic dependency that programs can get resolved with at runtime." + $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 a test_compile did reveal that the linker did not use this one" + $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." fi fi else droppeddeps=yes - echo + $ECHO $ECHO "*** Warning! Library $i is needed by this library but I was not able to" - echo "*** make it link in! You will probably need to install it or some" - echo "*** library that it depends on before this library will be fully" - echo "*** functional. Installing it before continuing would be even better." + $ECHO "*** make it link in! You will probably need to install it or some" + $ECHO "*** library that it depends on before this library will be fully" + $ECHO "*** functional. Installing it before continuing would be even better." fi ;; *) - func_append newdeplibs " $i" + newdeplibs="$newdeplibs $i" ;; esac done @@ -7775,27 +6647,15 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) - func_append newdeplibs " $a_deplib" + newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` - if test -n "$file_magic_glob"; then - libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` - else - libnameglob=$libname - fi - test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - if test "$want_nocaseglob" = yes; then - shopt -s nocaseglob - potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` - $nocaseglob - else - potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` - fi + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | @@ -7812,13 +6672,13 @@ EOF potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; + *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" + newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi @@ -7827,12 +6687,12 @@ EOF fi if test -n "$a_deplib" ; then droppeddeps=yes - echo + $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" + $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 @@ -7843,7 +6703,7 @@ EOF ;; *) # Add a -L argument. - func_append newdeplibs " $a_deplib" + newdeplibs="$newdeplibs $a_deplib" ;; esac done # Gone through all deplibs. @@ -7859,7 +6719,7 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) - func_append newdeplibs " $a_deplib" + newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac @@ -7870,9 +6730,9 @@ EOF 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 | \ + if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" + newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi @@ -7881,12 +6741,12 @@ EOF fi if test -n "$a_deplib" ; then droppeddeps=yes - echo + $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" + $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 @@ -7897,32 +6757,32 @@ EOF ;; *) # Add a -L argument. - func_append newdeplibs " $a_deplib" + newdeplibs="$newdeplibs $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" - tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + 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 " $tmp_deplibs" | $SED "s,$i,,"` + tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` done fi - case $tmp_deplibs in - *[!\ \ ]*) - echo + 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." + $ECHO "*** Warning: inter-library dependencies are not supported in this platform." else - echo "*** Warning: inter-library dependencies are not known to be supported." + $ECHO "*** Warning: inter-library dependencies are not known to be supported." fi - echo "*** All declared inter-library dependencies are being dropped." + $ECHO "*** All declared inter-library dependencies are being dropped." droppeddeps=yes - ;; - esac + fi ;; esac versuffix=$versuffix_save @@ -7934,23 +6794,23 @@ EOF case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" + $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." + $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." + $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" @@ -7960,16 +6820,16 @@ EOF 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." + $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." + $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 @@ -7986,9 +6846,9 @@ EOF # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) - newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac @@ -8001,7 +6861,7 @@ EOF *) case " $deplibs " in *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; + new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac @@ -8011,10 +6871,10 @@ EOF -L*) case " $new_libs " in *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; + *) new_libs="$new_libs $deplib" ;; esac ;; - *) func_append new_libs " $deplib" ;; + *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" @@ -8031,12 +6891,10 @@ EOF hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" - test "$opt_mode" != relink && rpath="$compile_rpath$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 - func_replace_sysroot "$libdir" - libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else @@ -8045,18 +6903,18 @@ EOF *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - func_append dep_rpath " $flag" + dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; - *) func_apped perm_rpath " $libdir" ;; + *) perm_rpath="$perm_rpath $libdir" ;; esac fi done @@ -8074,7 +6932,7 @@ EOF # We should set the runpath_var. rpath= for dir in $perm_rpath; do - func_append rpath "$dir:" + rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi @@ -8082,7 +6940,7 @@ EOF fi shlibpath="$finalize_shlibpath" - test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi @@ -8108,18 +6966,18 @@ EOF linknames= for link do - func_append linknames " $link" + linknames="$linknames $link" done # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" - func_append delfiles " $export_symbols" + delfiles="$delfiles $export_symbols" fi orig_export_symbols= @@ -8150,45 +7008,13 @@ EOF $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' - for cmd1 in $cmds; do + for cmd in $cmds; do IFS="$save_ifs" - # Take the normal branch if the nm_file_list_spec branch - # doesn't work or if tool conversion is not needed. - case $nm_file_list_spec~$to_tool_file_cmd in - *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) - try_normal_branch=yes - eval cmd=\"$cmd1\" - func_len " $cmd" - len=$func_len_result - ;; - *) - try_normal_branch=no - ;; - esac - if test "$try_normal_branch" = yes \ - && { test "$len" -lt "$max_cmd_len" \ - || test "$max_cmd_len" -le -1; } - then - func_show_eval "$cmd" 'exit $?' - skipped_export=false - elif test -n "$nm_file_list_spec"; then - func_basename "$output" - output_la=$func_basename_result - save_libobjs=$libobjs - save_output=$output - output=${output_objdir}/${output_la}.nm - func_to_tool_file "$output" - libobjs=$nm_file_list_spec$func_to_tool_file_result - func_append delfiles " $output" - func_verbose "creating $NM input file list: $output" - for obj in $save_libobjs; do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > "$output" - eval cmd=\"$cmd1\" + eval cmd=\"$cmd\" + func_len " $cmd" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then func_show_eval "$cmd" 'exit $?' - output=$save_output - libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. @@ -8210,7 +7036,7 @@ EOF if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then @@ -8222,7 +7048,7 @@ EOF # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi @@ -8232,7 +7058,7 @@ EOF case " $convenience " in *" $test_deplib "*) ;; *) - func_append tmp_deplibs " $test_deplib" + tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done @@ -8252,21 +7078,21 @@ EOF test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" + generated="$generated $gentop" func_extract_archives $gentop $convenience - func_append libobjs " $func_extract_archives_result" + libobjs="$libobjs $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" - func_append linker_flags " $flag" + linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking - if test "$opt_mode" = relink; then + if test "$mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi @@ -8311,8 +7137,7 @@ EOF save_libobjs=$libobjs fi save_output=$output - func_basename "$output" - output_la=$func_basename_result + output_la=`$ECHO "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. @@ -8325,16 +7150,13 @@ EOF if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" - echo 'INPUT (' > $output + $ECHO 'INPUT (' > $output for obj in $save_libobjs do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output + $ECHO "$obj" >> $output done - echo ')' >> $output - func_append delfiles " $output" - func_to_tool_file "$output" - output=$func_to_tool_file_result + $ECHO ')' >> $output + delfiles="$delfiles $output" elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" @@ -8348,12 +7170,10 @@ EOF fi for obj do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output + $ECHO "$obj" >> $output done - func_append delfiles " $output" - func_to_tool_file "$output" - output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + delfiles="$delfiles $output" + output=$firstobj\"$file_list_spec$output\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." @@ -8377,19 +7197,17 @@ EOF # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. - reload_objs=$objlist - eval concat_cmds=\"$reload_cmds\" + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext - objlist=" $obj" + objlist=$obj func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result @@ -8399,12 +7217,11 @@ EOF # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\${concat_cmds}$reload_cmds\" + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi - func_append delfiles " $output" + delfiles="$delfiles $output" else output= @@ -8438,7 +7255,7 @@ EOF lt_exit=$? # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then + if test "$mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -8459,7 +7276,7 @@ EOF if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then @@ -8471,7 +7288,7 @@ EOF # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi @@ -8512,10 +7329,10 @@ EOF # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" + generated="$generated $gentop" func_extract_archives $gentop $dlprefiles - func_append libobjs " $func_extract_archives_result" + libobjs="$libobjs $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi @@ -8531,7 +7348,7 @@ EOF lt_exit=$? # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then + if test "$mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -8543,7 +7360,7 @@ EOF IFS="$save_ifs" # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then + if test "$mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then @@ -8624,21 +7441,18 @@ EOF if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` else gentop="$output_objdir/${obj}x" - func_append generated " $gentop" + generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi - # If we're not building shared, we need to use non_pic_objs - test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + 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" func_execute_cmds "$reload_cmds" 'exit $?' @@ -8698,8 +7512,8 @@ EOF case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac @@ -8710,14 +7524,14 @@ EOF if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) - func_append compile_command " ${wl}-bind_at_load" - func_append finalize_command " ${wl}-bind_at_load" + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac @@ -8731,7 +7545,7 @@ EOF *) case " $compile_deplibs " in *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; + new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac @@ -8741,17 +7555,17 @@ EOF -L*) case " $new_libs " in *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; + *) new_libs="$new_libs $deplib" ;; esac ;; - *) func_append new_libs " $deplib" ;; + *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" - func_append compile_command " $compile_deplibs" - func_append finalize_command " $finalize_deplibs" + 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. @@ -8759,7 +7573,7 @@ EOF # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi @@ -8778,18 +7592,18 @@ EOF *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" + rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; - *) func_append perm_rpath " $libdir" ;; + *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in @@ -8798,12 +7612,12 @@ EOF case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; - *) func_append dllsearchpath ":$libdir";; + *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; + *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac @@ -8829,18 +7643,18 @@ EOF *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" + rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; - *) func_append finalize_perm_rpath " $libdir" ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done @@ -8854,8 +7668,8 @@ EOF if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. - compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" @@ -8867,15 +7681,15 @@ EOF wrappers_required=yes case $host in - *cegcc* | *mingw32ce*) - # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. - wrappers_required=no - ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; + *cegcc) + # Disable wrappers for cegcc, we are cross compiling anyway. + wrappers_required=no + ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no @@ -8884,19 +7698,13 @@ EOF esac if test "$wrappers_required" = no; then # Replace the output file specification. - compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + 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. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' @@ -8919,7 +7727,7 @@ EOF # We should set the runpath_var. rpath= for dir in $perm_rpath; do - func_append rpath "$dir:" + rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -8927,7 +7735,7 @@ EOF # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do - func_append rpath "$dir:" + rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -8937,18 +7745,11 @@ EOF # 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 "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - exit $EXIT_SUCCESS fi @@ -8963,7 +7764,7 @@ EOF if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then - relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + 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= @@ -8975,19 +7776,13 @@ EOF fi # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' - if test -n "$postlink_cmds"; then - func_to_tool_file "$output_objdir/$outputname" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - # Now create the wrapper script. func_verbose "creating $output" @@ -9005,7 +7800,18 @@ EOF fi done relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $ECHO for shipping. + if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --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 not in dry run mode. @@ -9085,7 +7891,7 @@ EOF else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then - func_append oldobjs " $symfileobj" + oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" @@ -9093,10 +7899,10 @@ EOF if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" + generated="$generated $gentop" func_extract_archives $gentop $addlibs - func_append oldobjs " $func_extract_archives_result" + oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. @@ -9107,10 +7913,10 @@ EOF # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" + generated="$generated $gentop" func_extract_archives $gentop $dlprefiles - func_append oldobjs " $func_extract_archives_result" + oldobjs="$oldobjs $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have @@ -9126,9 +7932,9 @@ EOF done | sort | sort -uc >/dev/null 2>&1); then : else - echo "copying selected object files to avoid basename conflicts..." + $ECHO "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" + generated="$generated $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= @@ -9152,9 +7958,9 @@ EOF esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - func_append oldobjs " $gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" ;; - *) func_append oldobjs " $obj" ;; + *) oldobjs="$oldobjs $obj" ;; esac done fi @@ -9164,16 +7970,6 @@ EOF len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds - elif test -n "$archiver_list_spec"; then - func_verbose "using command file archive linking..." - for obj in $oldobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > $output_objdir/$libname.libcmd - func_to_tool_file "$output_objdir/$libname.libcmd" - oldobjs=" $archiver_list_spec$func_to_tool_file_result" - cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." @@ -9247,7 +8043,7 @@ EOF done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi @@ -9270,19 +8066,9 @@ EOF eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" - func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" - ;; - -L*) - func_stripname -L '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -L$func_replace_sysroot_result" - ;; - -R*) - func_stripname -R '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -R$func_replace_sysroot_result" + newdependency_libs="$newdependency_libs $libdir/$name" ;; - *) func_append newdependency_libs " $deplib" ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" @@ -9296,9 +8082,9 @@ EOF eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + newdlfiles="$newdlfiles $libdir/$name" ;; - *) func_append newdlfiles " $lib" ;; + *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" @@ -9315,7 +8101,7 @@ EOF eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done @@ -9327,7 +8113,7 @@ EOF [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac - func_append newdlfiles " $abs" + newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= @@ -9336,33 +8122,15 @@ EOF [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac - func_append newdlprefiles " $abs" + newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin - # In fact, it would be nice if we could use this code for all target - # systems that can't hard-code library paths into their executables - # and that have no shared library path variable independent of PATH, - # but it turns out we can't easily determine that from inspecting - # libtool variables, so we have to hard-code the OSs to which it - # applies here; at the moment, that means platforms that use the PE - # object format with DLL files. See the long comment at the top of - # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) - # If a -bindir argument was supplied, place the dll there. - if test "x$bindir" != x ; - then - func_relative_path "$install_libdir" "$bindir" - tdlname=$func_relative_path_result$dlname - else - # Otherwise fall back on heuristic. - tdlname=../bin/$dlname - fi - ;; + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $ECHO > $output "\ # $outputname - a libtool library file @@ -9421,7 +8189,7 @@ relink_command=\"$relink_command\"" exit $EXIT_SUCCESS } -{ test "$opt_mode" = link || test "$opt_mode" = relink; } && +{ test "$mode" = link || test "$mode" = relink; } && func_mode_link ${1+"$@"} @@ -9441,9 +8209,9 @@ func_mode_uninstall () for arg do case $arg in - -f) func_append RM " $arg"; rmforce=yes ;; - -*) func_append RM " $arg" ;; - *) func_append files " $arg" ;; + -f) RM="$RM $arg"; rmforce=yes ;; + -*) RM="$RM $arg" ;; + *) files="$files $arg" ;; esac done @@ -9452,23 +8220,24 @@ func_mode_uninstall () rmdirs= + origobjdir="$objdir" for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then - odir="$objdir" + objdir="$origobjdir" else - odir="$dir/$objdir" + objdir="$dir/$origobjdir" fi func_basename "$file" name="$func_basename_result" - test "$opt_mode" = uninstall && odir="$dir" + test "$mode" = uninstall && objdir="$dir" - # Remember odir for removal later, being careful to avoid duplicates - if test "$opt_mode" = clean; then + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then case " $rmdirs " in - *" $odir "*) ;; - *) func_append rmdirs " $odir" ;; + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; esac fi @@ -9494,17 +8263,18 @@ func_mode_uninstall () # Delete the libtool libraries and symlinks. for n in $library_names; do - func_append rmfiles " $odir/$n" + rmfiles="$rmfiles $objdir/$n" done - test -n "$old_library" && func_append rmfiles " $odir/$old_library" + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - case "$opt_mode" in + case "$mode" in clean) - case " $library_names " in + case " $library_names " in + # " " in the beginning catches empty $dlname *" $dlname "*) ;; - *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; esac - test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then @@ -9532,19 +8302,19 @@ func_mode_uninstall () # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then - func_append rmfiles " $dir/$pic_object" + 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 - func_append rmfiles " $dir/$non_pic_object" + rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) - if test "$opt_mode" = clean ; then + if test "$mode" = clean ; then noexename=$name case $file in *.exe) @@ -9554,7 +8324,7 @@ func_mode_uninstall () noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe - func_append rmfiles " $file" + rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. @@ -9563,7 +8333,7 @@ func_mode_uninstall () func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result - func_append rmfiles " $func_ltwrapper_scriptname_result" + rmfiles="$rmfiles $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename @@ -9571,12 +8341,12 @@ func_mode_uninstall () # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles - func_append rmfiles " $odir/$name $odir/${name}S.${objext}" + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then - func_append rmfiles " $odir/lt-$name" + rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then - func_append rmfiles " $odir/lt-${noexename}.c" + rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi @@ -9584,6 +8354,7 @@ func_mode_uninstall () esac func_show_eval "$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 @@ -9595,16 +8366,16 @@ func_mode_uninstall () exit $exit_status } -{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && +{ test "$mode" = uninstall || test "$mode" = clean; } && func_mode_uninstall ${1+"$@"} -test -z "$opt_mode" && { +test -z "$mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$opt_mode'" + func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" diff --git a/m4/ax_ext.m4 b/m4/ax_ext.m4 index 41536f7..898f2bf 100644 --- a/m4/ax_ext.m4 +++ b/m4/ax_ext.m4 @@ -69,8 +69,10 @@ AC_DEFUN([AX_EXT], AC_CACHE_CHECK([whether sse2 is supported], [ax_cv_have_sse2_ext], [ ax_cv_have_sse2_ext=no - if test "$((0x$edx>>26&0x01))" = 1; then - ax_cv_have_sse2_ext=yes + if test "$ax_cv_gcc_x86_cpuid_0x00000001" != "unknown"; then + if test "$((0x$edx>>26&0x01))" = 1; then + ax_cv_have_sse2_ext=yes + fi fi ]) diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 8ff3c76..a3fee53 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -1,8 +1,7 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. +# 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives @@ -11,8 +10,7 @@ m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. +# 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. @@ -39,7 +37,7 @@ m4_define([_LT_COPYING], [dnl # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) -# serial 57 LT_INIT +# serial 56 LT_INIT # LT_PREREQ(VERSION) @@ -68,7 +66,6 @@ esac # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT -AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl @@ -85,8 +82,6 @@ AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl -_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) - dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) @@ -123,7 +118,7 @@ m4_defun([_LT_CC_BASENAME], *) break;; esac done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` ]) @@ -143,9 +138,6 @@ m4_defun([_LT_FILEUTILS_DEFAULTS], m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl - _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl @@ -168,13 +160,10 @@ _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our @@ -190,6 +179,7 @@ fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl +_LT_PROG_ECHO_BACKSLASH case $host_os in aix3*) @@ -203,6 +193,23 @@ aix3*) ;; esac +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +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 delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + # Global variables: ofile=libtool can_build_shared=yes @@ -243,28 +250,6 @@ _LT_CONFIG_COMMANDS ])# _LT_SETUP -# _LT_PREPARE_SED_QUOTE_VARS -# -------------------------- -# Define a few sed substitution that help us do robust quoting. -m4_defun([_LT_PREPARE_SED_QUOTE_VARS], -[# Backslashify metacharacters that are still active within -# double-quoted strings. -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 delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' -]) - # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' @@ -423,7 +408,7 @@ m4_define([_lt_decl_all_varnames], # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) +[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS @@ -433,7 +418,7 @@ m4_define([_LT_CONFIG_STATUS_DECLARE], # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # -# <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`' +# <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) @@ -532,20 +517,12 @@ LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$[]1 -_LTECHO_EOF' -} - # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -556,9 +533,9 @@ done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -566,38 +543,16 @@ for var in lt_decl_all_varnames([[ \ esac done +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\[$]0 --fallback-echo"')dnl " + lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` + ;; +esac + _LT_OUTPUT_LIBTOOL_INIT ]) -# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) -# ------------------------------------ -# Generate a child script FILE with all initialization necessary to -# reuse the environment learned by the parent script, and make the -# file executable. If COMMENT is supplied, it is inserted after the -# `#!' sequence but before initialization text begins. After this -# macro, additional text can be appended to FILE to form the body of -# the child script. The macro ends with non-zero status if the -# file could not be fully written (such as if the disk is full). -m4_ifdef([AS_INIT_GENERATED], -[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], -[m4_defun([_LT_GENERATED_FILE_INIT], -[m4_require([AS_PREPARE])]dnl -[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl -[lt_write_fail=0 -cat >$1 <<_ASEOF || lt_write_fail=1 -#! $SHELL -# Generated by $as_me. -$2 -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$1 <<\_ASEOF || lt_write_fail=1 -AS_SHELL_SANITIZE -_AS_PREPARE -exec AS_MESSAGE_FD>&1 -_ASEOF -test $lt_write_fail = 0 && chmod +x $1[]dnl -m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- @@ -607,11 +562,20 @@ m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) -_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], -[# Run this file to recreate a libtool stub with the current configuration.]) +cat >"$CONFIG_LT" <<_LTEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate a libtool stub with the current configuration. -cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AS_SHELL_SANITIZE +_AS_PREPARE + +exec AS_MESSAGE_FD>&1 exec AS_MESSAGE_LOG_FD>>config.log { echo @@ -637,7 +601,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2008 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." @@ -682,13 +646,15 @@ chmod +x "$CONFIG_LT" # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. -lt_cl_success=: -test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" -exec AS_MESSAGE_LOG_FD>/dev/null -$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false -exec AS_MESSAGE_LOG_FD>>config.log -$lt_cl_success || AS_EXIT(1) +if test "$no_create" != yes; then + lt_cl_success=: + test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" + exec AS_MESSAGE_LOG_FD>/dev/null + $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false + exec AS_MESSAGE_LOG_FD>>config.log + $lt_cl_success || AS_EXIT(1) +fi ])# LT_OUTPUT @@ -751,12 +717,15 @@ _LT_EOF # 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) + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) - _LT_PROG_REPLACE_SHELLFNS + _LT_PROG_XSI_SHELLFNS - mv -f "$cfgfile" "$ofile" || + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], @@ -862,13 +831,11 @@ AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) -dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER @@ -973,31 +940,6 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) - AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], - [lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD - echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD - $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; @@ -1025,7 +967,7 @@ _LT_EOF else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + if test "$DSYMUTIL" != ":"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -1045,11 +987,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - fi + _LT_TAGVAR(whole_archive_flag_spec, $1)='' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in @@ -1057,7 +995,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all + output_verbose_link_cmd=echo _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" @@ -1073,141 +1011,202 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], fi ]) -# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) -# ---------------------------------- +# _LT_SYS_MODULE_PATH_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. -# Store the results from the different compilers for each TAGNAME. -# Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl -if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], - [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ - lt_aix_libpath_sed='[ - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }]' - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi],[]) - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" - fi - ]) - aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) -fi +AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# 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 "$lt_aix_libpath_sed"` +fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], -[m4_divert_text([M4SH-INIT], [$1 -])])# _LT_SHELL_INIT - +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- -# Find how we can fake an echo command that does not interpret backslash. -# In particular, with Autoconf 2.60 or later we add some code to the start -# of the generated configure script which will find a shell with a builtin -# printf (which we can use as an echo command). +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. m4_defun([_LT_PROG_ECHO_BACKSLASH], -[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -AC_MSG_CHECKING([how to print strings]) -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' +[_LT_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +ECHO=${lt_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 - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$[]1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} fi -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<_LT_EOF +[$]* +_LT_EOF + exit 0 +fi -case "$ECHO" in - printf*) AC_MSG_RESULT([printf]) ;; - print*) AC_MSG_RESULT([print -r]) ;; - *) AC_MSG_RESULT([cat]) ;; -esac +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH -m4_ifdef([_AS_DETECT_SUGGESTED], -[_AS_DETECT_SUGGESTED([ - test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test "X`printf %s $ECHO`" = "X$ECHO" \ - || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null + then + break + fi + done + fi -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) -])# _LT_PROG_ECHO_BACKSLASH + 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" -# _LT_WITH_SYSROOT -# ---------------- -AC_DEFUN([_LT_WITH_SYSROOT], -[AC_MSG_CHECKING([for sysroot]) -AC_ARG_WITH([sysroot], -[ --with-sysroot[=DIR] Search for dependent libraries within DIR - (or the compiler's sysroot if not specified).], -[], [with_sysroot=no]) - -dnl lt_sysroot will always be passed unquoted. We quote it here -dnl in case the user passed a directory name. -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - AC_MSG_RESULT([${with_sysroot}]) - AC_MSG_ERROR([The sysroot must be an absolute path.]) - ;; -esac + 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. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(lt_ECHO) +]) +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], + [An echo program that does not interpret backslashes]) +])# _LT_PROG_ECHO_BACKSLASH - AC_MSG_RESULT([${lt_sysroot:-no}]) -_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl -[dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- @@ -1237,7 +1236,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + 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 @@ -1355,47 +1354,14 @@ need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK -# _LT_PROG_AR -# ----------- -m4_defun([_LT_PROG_AR], -[AC_CHECK_TOOLS(AR, [ar], false) -: ${AR=ar} -: ${AR_FLAGS=cru} -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) - -AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], - [lt_cv_ar_at_file=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM], - [echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - ]) - ]) - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi -_LT_DECL([], [archiver_list_spec], [1], - [How to feed a file listing to the archiver]) -])# _LT_PROG_AR - - # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], -[_LT_PROG_AR +[AC_CHECK_TOOL(AR, ar, false) +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1]) AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: @@ -1422,19 +1388,10 @@ if test -n "$RANLIB"; then esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) -_LT_DECL([], [lock_old_archive_extraction], [0], - [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE @@ -1459,15 +1416,15 @@ AC_CACHE_CHECK([$1], [$2], -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (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:$LINENO: \$? = $ac_status" >&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 other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes @@ -1507,7 +1464,7 @@ AC_CACHE_CHECK([$1], [$2], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes @@ -1570,11 +1527,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=8192; ;; - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. @@ -1639,8 +1591,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl # 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"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && + while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` @@ -1691,7 +1643,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -[#line $LINENO "configure" +[#line __oline__ "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -1732,13 +1684,7 @@ else # endif #endif -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } +void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -1747,11 +1693,7 @@ int main () if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else @@ -1927,16 +1869,16 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (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:$LINENO: \$? = $ac_status" >&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 - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes @@ -2095,7 +2037,6 @@ m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ @@ -2104,23 +2045,16 @@ if test "$GCC" = yes; then darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_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. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= @@ -2133,7 +2067,7 @@ if test "$GCC" = yes; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' + lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; @@ -2153,13 +2087,7 @@ BEGIN {RS=" "; FS="/|\n";} { if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) @@ -2247,7 +2175,7 @@ amigaos*) m68k) 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=`func_echo_all "$lib" | $SED '\''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' + 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' ;; esac ;; @@ -2278,9 +2206,8 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no - case $GCC,$cc_basename in - yes,*) - # gcc + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -2301,83 +2228,36 @@ cygwin* | mingw* | pw32* | cegcc*) 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}' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - 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 - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" + 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. + # 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"` + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + 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 - - # 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 - dynamic_linker='Win32 link.exe' ;; *) - # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' ;; esac + dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -2461,20 +2341,6 @@ gnu*) 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=no - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - 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=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; @@ -2520,10 +2386,8 @@ hpux9* | hpux10* | hpux11*) soname_spec='${libname}${release}${shared_ext}$major' ;; esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 ;; interix[[3-9]]*) @@ -2590,21 +2454,16 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu) finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no - # Some binutils ld are patched to set DT_RUNPATH - AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], - [lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [lt_cv_shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - ]) - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install @@ -2613,7 +2472,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -2858,8 +2717,6 @@ _LT_DECL([], [library_names_spec], [1], The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [install_override_mode], [1], - [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], @@ -2972,7 +2829,6 @@ AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], @@ -3094,11 +2950,6 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test "$GCC" != yes; then - reload_cmds=false - fi - ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' @@ -3107,8 +2958,8 @@ case $host_os in fi ;; esac -_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl -_LT_TAGDECL([], [reload_cmds], [2])dnl +_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl +_LT_DECL([], [reload_cmds], [2])dnl ])# _LT_CMD_RELOAD @@ -3160,18 +3011,16 @@ mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. - if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -cegcc*) +cegcc) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' @@ -3201,10 +3050,6 @@ gnu*) lt_cv_deplibs_check_method=pass_all ;; -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in @@ -3213,11 +3058,11 @@ hpux10.20* | hpux11*) 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])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + [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_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 @@ -3317,21 +3162,6 @@ tpf*) ;; esac ]) - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` - fi - ;; - esac -fi - 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 @@ -3339,11 +3169,7 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method = "file_magic"]) -_LT_DECL([], [file_magic_glob], [1], - [How to find potential files when deplibs_check_method = "file_magic"]) -_LT_DECL([], [want_nocaseglob], [1], - [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) + [Command to use when deplibs_check_method == "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD @@ -3400,19 +3226,7 @@ if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi + AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" @@ -3425,13 +3239,13 @@ _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -3446,67 +3260,6 @@ dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) -# _LT_CHECK_SHAREDLIB_FROM_LINKLIB -# -------------------------------- -# how to determine the name of the shared library -# associated with a specific link library. -# -- PORTME fill in with the dynamic library characteristics -m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], -[m4_require([_LT_DECL_EGREP]) -m4_require([_LT_DECL_OBJDUMP]) -m4_require([_LT_DECL_DLLTOOL]) -AC_CACHE_CHECK([how to associate runtime and link libraries], -lt_cv_sharedlib_from_linklib_cmd, -[lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac -]) -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - -_LT_DECL([], [sharedlib_from_linklib_cmd], [1], - [Command to associate shared and link libraries]) -])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB - - -# _LT_PATH_MANIFEST_TOOL -# ---------------------- -# locate the manifest tool -m4_defun([_LT_PATH_MANIFEST_TOOL], -[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], - [lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&AS_MESSAGE_LOG_FD - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest*]) -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi -_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl -])# _LT_PATH_MANIFEST_TOOL - # LT_LIB_M # -------- @@ -3515,7 +3268,7 @@ AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in -*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) @@ -3543,12 +3296,7 @@ m4_defun([_LT_COMPILER_NO_RTTI], _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; - *) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; - esac + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, @@ -3565,7 +3313,6 @@ _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl @@ -3633,8 +3380,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \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\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -3670,7 +3417,6 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -3692,7 +3438,7 @@ _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -3704,18 +3450,6 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT@&t@_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT@&t@_DLSYM_CONST -#else -# define LT@&t@_DLSYM_CONST const -#endif - #ifdef __cplusplus extern "C" { #endif @@ -3727,7 +3461,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ -LT@&t@_DLSYM_CONST struct { +const struct { const char *name; void *address; } @@ -3753,15 +3487,15 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_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_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi @@ -3794,13 +3528,6 @@ else AC_MSG_RESULT(ok) fi -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], @@ -3811,8 +3538,6 @@ _LT_DECL([global_symbol_to_c_name_address], _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) -_LT_DECL([], [nm_file_list_spec], [1], - [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS @@ -3824,6 +3549,7 @@ _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= +AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then @@ -3874,11 +3600,6 @@ m4_if([$1], [CXX], [ # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. @@ -3928,12 +3649,6 @@ m4_if([$1], [CXX], [ ;; esac ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # 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). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; dgux*) case $cc_basename in ec++*) @@ -4023,8 +3738,8 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene + xlc* | xlC*) + # IBM XL 8.0 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' @@ -4086,7 +3801,7 @@ m4_if([$1], [CXX], [ ;; solaris*) case $cc_basename in - CC* | sunCC*) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' @@ -4190,12 +3905,6 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag @@ -4238,13 +3947,6 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' - ;; - esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in @@ -4308,13 +4010,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; - nagfor*) - # NAG Fortran compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4326,26 +4022,26 @@ m4_if([$1], [CXX], [ # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in - *Sun\ F* | *Sun*Fortran*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; esac ;; esac @@ -4376,7 +4072,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + f77* | f90* | f95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; @@ -4433,11 +4129,9 @@ case $host_os in _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac - -AC_CACHE_CHECK([for $compiler option to produce PIC], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) +AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) # # Check to make sure the PIC flag actually works. @@ -4456,8 +4150,6 @@ fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # @@ -4478,7 +4170,6 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl @@ -4487,38 +4178,30 @@ m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # 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 - # Also, AIX nm treats weak defined symbols like other global defined - # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_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_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_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; + ;; cygwin* | mingw* | cegcc*) - case $cc_basename in - cl*) ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - ;; - esac - ;; - linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + ;; + linux* | k*bsd*-gnu) _LT_TAGVAR(link_all_deplibs, $1)=no - ;; + ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; + ;; esac + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= @@ -4578,39 +4261,13 @@ dnl Note also adjust exclude_expsyms for C++ above. openbsd*) with_gnu_ld=no ;; - linux* | k*bsd*-gnu | gnu*) + linux* | k*bsd*-gnu) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; - *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' @@ -4644,12 +4301,11 @@ dnl Note also adjust exclude_expsyms for C++ above. _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.19, is reported +*** 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 install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. _LT_EOF fi @@ -4685,12 +4341,10 @@ _LT_EOF # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -4708,11 +4362,6 @@ _LT_EOF fi ;; - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -4738,16 +4387,15 @@ _LT_EOF if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag=' $pic_flag' + tmp_addflag= tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -4758,17 +4406,13 @@ _LT_EOF lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; - xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 @@ -4784,17 +4428,17 @@ _LT_EOF fi case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) + xlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -4808,8 +4452,8 @@ _LT_EOF _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_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 ;; @@ -4827,8 +4471,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_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_TAGVAR(ld_shlibs, $1)=no fi @@ -4874,8 +4518,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_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_TAGVAR(ld_shlibs, $1)=no fi @@ -4915,10 +4559,8 @@ _LT_EOF 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 - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_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_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 @@ -5006,9 +4648,9 @@ _LT_EOF _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' @@ -5017,19 +4659,14 @@ _LT_EOF else # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_SYS_MODULE_PATH_AIX _LT_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' @@ -5061,63 +4698,20 @@ _LT_EOF # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_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_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_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_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) @@ -5155,7 +4749,7 @@ _LT_EOF # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -5163,7 +4757,7 @@ _LT_EOF hpux9*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_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_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 @@ -5178,8 +4772,8 @@ _LT_EOF ;; hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi @@ -5197,16 +4791,16 @@ _LT_EOF ;; hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then + if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else @@ -5218,14 +4812,7 @@ _LT_EOF _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - m4_if($1, [], [ - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - _LT_LINKER_OPTION([if $CC understands -b], - _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], - [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi @@ -5253,34 +4840,19 @@ _LT_EOF irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], - [lt_cv_irix_exported_symbol], - [save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE( - [AC_LANG_SOURCE( - [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], - [C++], [[int foo (void) { return 0; }]], - [Fortran 77], [[ - subroutine foo - end]], - [Fortran], [[ - subroutine foo - end]])])], - [lt_cv_irix_exported_symbol=yes], - [lt_cv_irix_exported_symbol=no]) - LDFLAGS="$save_LDFLAGS"]) - if test "$lt_cv_irix_exported_symbol" = yes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE(int foo(void) {}, + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + ) + LDFLAGS="$save_LDFLAGS" else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' @@ -5342,17 +4914,17 @@ _LT_EOF _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_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_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_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' @@ -5362,13 +4934,13 @@ _LT_EOF osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5381,9 +4953,9 @@ _LT_EOF _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) @@ -5559,38 +5131,36 @@ x|xyes) # 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_CACHE_CHECK([whether -lc should be explicitly linked in], - [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), - [$RM conftest* - echo "$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_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - ]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $RM conftest* + echo "$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_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) ;; esac fi @@ -5655,6 +5225,8 @@ _LT_TAGDECL([], [inherit_rpath], [0], to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [fix_srcfile_path], [1], + [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], @@ -5665,8 +5237,6 @@ _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [postlink_cmds], [2], - [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented @@ -5760,15 +5330,14 @@ CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl +# _LT_PROG_CXX +# ------------ +# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ +# compiler, we have our own version here. +m4_defun([_LT_PROG_CXX], +[ +pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) +AC_PROG_CXX if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then @@ -5776,6 +5345,22 @@ if test -n "$CXX" && ( test "X$CXX" != "Xno" && else _lt_caught_CXX_error=yes fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_CXX + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_CXX], []) + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[AC_REQUIRE([_LT_PROG_CXX])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no @@ -5797,8 +5382,6 @@ _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -5830,7 +5413,6 @@ if test "$_lt_caught_CXX_error" != yes; then # Allow CC to be a program name with arguments. lt_save_CC=$CC - lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX @@ -5848,7 +5430,6 @@ if test "$_lt_caught_CXX_error" != yes; then fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} - CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -5870,8 +5451,8 @@ if test "$_lt_caught_CXX_error" != yes; then # 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_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5903,7 +5484,7 @@ if test "$_lt_caught_CXX_error" != yes; then # 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 -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else GXX=no @@ -6012,10 +5593,10 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. - _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' @@ -6024,19 +5605,14 @@ if test "$_lt_caught_CXX_error" != yes; then else # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_SYS_MODULE_PATH_AIX _LT_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. @@ -6066,75 +5642,28 @@ if test "$_lt_caught_CXX_error" != yes; then ;; cygwin* | mingw* | pw32* | cegcc*) - case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # g++ - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; @@ -6176,11 +5705,6 @@ if test "$_lt_caught_CXX_error" != yes; then gnu*) ;; - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: @@ -6205,11 +5729,11 @@ if test "$_lt_caught_CXX_error" != yes; then # 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; func_echo_all "$list"' + 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 "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${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' + _LT_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_TAGVAR(ld_shlibs, $1)=no @@ -6270,7 +5794,7 @@ if test "$_lt_caught_CXX_error" != yes; then # 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; func_echo_all "$list"' + 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 "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then @@ -6280,10 +5804,10 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_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 @@ -6313,7 +5837,7 @@ if test "$_lt_caught_CXX_error" != yes; then case $cc_basename in CC*) # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_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 @@ -6324,9 +5848,9 @@ if test "$_lt_caught_CXX_error" != yes; then *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -6355,7 +5879,7 @@ if test "$_lt_caught_CXX_error" != yes; then # 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; func_echo_all "$list"' + 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 "X$list" | $Xsed' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -6392,26 +5916,26 @@ if test "$_lt_caught_CXX_error" != yes; then pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in - *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; - *) # Version 6 and above use weak symbols + *) # Version 6 will use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; @@ -6419,7 +5943,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ @@ -6438,9 +5962,9 @@ if test "$_lt_caught_CXX_error" != yes; then # 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=`func_echo_all "$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; func_echo_all "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "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 "X$list" | $Xsed' ;; - xl* | mpixl* | bgxl*) + xl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -6460,13 +5984,13 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. - output_verbose_link_cmd='func_echo_all' + output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -6535,7 +6059,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi - output_verbose_link_cmd=func_echo_all + output_verbose_link_cmd=echo else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -6570,15 +6094,15 @@ if test "$_lt_caught_CXX_error" != yes; then case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_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 ${output_objdir}/so_locations -o $lib~ + $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 "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; @@ -6594,17 +6118,17 @@ if test "$_lt_caught_CXX_error" != yes; then # 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=`func_echo_all "$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; func_echo_all "$list"' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "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 "X$list" | $Xsed' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) - _LT_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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_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 "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_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" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac @@ -6614,7 +6138,7 @@ if test "$_lt_caught_CXX_error" != yes; then # 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 -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # FIXME: insert proper C++ library support @@ -6650,7 +6174,7 @@ if test "$_lt_caught_CXX_error" != yes; then solaris*) case $cc_basename in - CC* | sunCC*) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' @@ -6671,7 +6195,7 @@ if test "$_lt_caught_CXX_error" != yes; then esac _LT_TAGVAR(link_all_deplibs, $1)=yes - output_verbose_link_cmd='func_echo_all' + output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -6691,14 +6215,14 @@ if test "$_lt_caught_CXX_error" != yes; then if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $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 -v "^Configured with:" | $GREP "\-L"' + 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. @@ -6709,7 +6233,7 @@ if test "$_lt_caught_CXX_error" != yes; then # 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 -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' @@ -6763,10 +6287,6 @@ if test "$_lt_caught_CXX_error" != yes; then CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ - '"$_LT_TAGVAR(old_archive_cmds, $1)" - _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ - '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' @@ -6822,7 +6342,6 @@ if test "$_lt_caught_CXX_error" != yes; then fi # test -n "$compiler" CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC @@ -6837,29 +6356,6 @@ AC_LANG_POP ])# _LT_LANG_CXX_CONFIG -# _LT_FUNC_STRIPNAME_CNF -# ---------------------- -# func_stripname_cnf prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# -# This function is identical to the (non-XSI) version of func_stripname, -# except this one can be used by m4 code that may be executed by configure, -# rather than the libtool script. -m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl -AC_REQUIRE([_LT_DECL_SED]) -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) -func_stripname_cnf () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname_cnf -])# _LT_FUNC_STRIPNAME_CNF - # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose @@ -6868,7 +6364,6 @@ func_stripname_cnf () # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl -AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= @@ -6919,13 +6414,6 @@ public class foo { }; _LT_EOF ]) - -_lt_libdeps_save_CFLAGS=$CFLAGS -case "$CC $CFLAGS " in #( -*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; -*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; -esac - dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then @@ -6937,7 +6425,7 @@ if AC_TRY_EVAL(ac_compile); then pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do - case ${prev}${p} in + case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. @@ -6946,22 +6434,13 @@ if AC_TRY_EVAL(ac_compile); then test $p = "-R"; then prev=$p continue + else + prev= fi - # Expand the sysroot to ease extracting the directories later. - if test -z "$prev"; then - case $p in - -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; - -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; - -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; - esac - fi - case $p in - =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; - esac if test "$pre_test_object_deps_done" = no; then - case ${prev} in - -L | -R) + 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. @@ -6981,10 +6460,8 @@ if AC_TRY_EVAL(ac_compile); then _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi - prev= ;; - *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. @@ -7020,7 +6497,6 @@ else fi $RM -f confest.$objext -CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], @@ -7057,7 +6533,7 @@ linux*) solaris*) case $cc_basename in - CC* | sunCC*) + CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as @@ -7101,16 +6577,32 @@ _LT_TAGDECL([], [compiler_lib_search_path], [1], ])# _LT_SYS_HIDDEN_LIBDEPS +# _LT_PROG_F77 +# ------------ +# Since AC_PROG_F77 is broken, in that it returns the empty string +# if there is no fortran compiler, we have our own version here. +m4_defun([_LT_PROG_F77], +[ +pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) +AC_PROG_F77 +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_F77 + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_F77], []) + + # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], -[AC_LANG_PUSH(Fortran 77) -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi +[AC_REQUIRE([_LT_PROG_F77])dnl +AC_LANG_PUSH(Fortran 77) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= @@ -7129,8 +6621,6 @@ _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -7170,9 +6660,7 @@ if test "$_lt_disable_F77" != yes; then # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} - CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -7226,24 +6714,38 @@ if test "$_lt_disable_F77" != yes; then GCC=$lt_save_GCC CC="$lt_save_CC" - CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG +# _LT_PROG_FC +# ----------- +# Since AC_PROG_FC is broken, in that it returns the empty string +# if there is no fortran compiler, we have our own version here. +m4_defun([_LT_PROG_FC], +[ +pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) +AC_PROG_FC +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_FC + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_FC], []) + + # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], -[AC_LANG_PUSH(Fortran) - -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi +[AC_REQUIRE([_LT_PROG_FC])dnl +AC_LANG_PUSH(Fortran) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= @@ -7262,8 +6764,6 @@ _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -7303,9 +6803,7 @@ if test "$_lt_disable_FC" != yes; then # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} - CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu @@ -7361,8 +6859,7 @@ if test "$_lt_disable_FC" != yes; then fi # test -n "$compiler" GCC=$lt_save_GCC - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS + CC="$lt_save_CC" fi # test "$_lt_disable_FC" != yes AC_LANG_POP @@ -7399,12 +6896,10 @@ _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS +lt_save_CC="$CC" lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} -CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" @@ -7414,8 +6909,6 @@ _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change @@ -7435,8 +6928,7 @@ fi AC_LANG_RESTORE GCC=$lt_save_GCC -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS +CC="$lt_save_CC" ])# _LT_LANG_GCJ_CONFIG @@ -7471,11 +6963,9 @@ _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" -lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} -CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -7488,8 +6978,7 @@ fi GCC=$lt_save_GCC AC_LANG_RESTORE -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS +CC="$lt_save_CC" ])# _LT_LANG_RC_CONFIG @@ -7548,15 +7037,6 @@ _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) -# _LT_DECL_DLLTOOL -# ---------------- -# Ensure DLLTOOL variable is set. -m4_defun([_LT_DECL_DLLTOOL], -[AC_CHECK_TOOL(DLLTOOL, dlltool, false) -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) -AC_SUBST([DLLTOOL]) -]) # _LT_DECL_SED # ------------ @@ -7650,8 +7130,8 @@ m4_defun([_LT_CHECK_SHELL_FEATURES], # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ + test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes @@ -7690,162 +7170,208 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES -# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) -# ------------------------------------------------------ -# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and -# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. -m4_defun([_LT_PROG_FUNCTION_REPLACE], -[dnl { -sed -e '/^$1 ()$/,/^} # $1 /c\ -$1 ()\ -{\ -m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) -} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: -]) +# _LT_PROG_XSI_SHELLFNS +# --------------------- +# Bourne and XSI compatible variants of some useful shell functions. +m4_defun([_LT_PROG_XSI_SHELLFNS], +[case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} -# _LT_PROG_REPLACE_SHELLFNS -# ------------------------- -# Replace existing portable implementations of several shell functions with -# equivalent extended shell implementations where those features are available.. -m4_defun([_LT_PROG_REPLACE_SHELLFNS], -[if test x"$xsi_shell" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}"]) +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} - _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"}]) +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} - _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl - func_split_long_opt_name=${1%%=*} - func_split_long_opt_arg=${1#*=}]) +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} - _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl - func_split_short_opt_arg=${1#??} - func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} - _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac]) +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} - _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $[*] )) +} - _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} - _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) -fi +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" -if test x"$lt_shell_append" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} - _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl - func_quote_for_eval "${2}" -dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ - eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi +dnl func_dirname_and_basename +dnl A portable version of this function is already defined in general.m4sh +dnl so there is no need for it here. -if test x"$_lt_function_replace_fail" = x":"; then - AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) -fi -]) +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} -# _LT_PATH_CONVERSION_FUNCTIONS -# ----------------------------- -# Determine which file name conversion functions should be used by -# func_to_host_file (and, implicitly, by func_to_host_path). These are needed -# for certain cross-compile configurations and native mingw. -m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_MSG_CHECKING([how to convert $build file names to $host format]) -AC_CACHE_VAL(lt_cv_to_host_file_cmd, -[case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; +# sed scripts: +my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[[^=]]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$[@]"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF esac -]) -to_host_file_cmd=$lt_cv_to_host_file_cmd -AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) -_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], - [0], [convert $build file names to $host format])dnl - -AC_MSG_CHECKING([how to convert $build file names to toolchain format]) -AC_CACHE_VAL(lt_cv_to_tool_file_cmd, -[#assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$[1]+=\$[2]" +} +_LT_EOF ;; -esac + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$[1]=\$$[1]\$[2]" +} + +_LT_EOF + ;; + esac ]) -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) -_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], - [0], [convert $build files to toolchain format])dnl -])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4 index 17cfd51..34151a3 100644 --- a/m4/ltoptions.m4 +++ b/m4/ltoptions.m4 @@ -1,14 +1,13 @@ # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 7 ltoptions.m4 +# serial 6 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) @@ -126,7 +125,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) @@ -134,13 +133,13 @@ case $host in esac test -z "$AS" && AS=as -_LT_DECL([], [AS], [1], [Assembler program])dnl +_LT_DECL([], [AS], [0], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl +_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 index 9c7b5d4..f3c5309 100644 --- a/m4/ltversion.m4 +++ b/m4/ltversion.m4 @@ -7,17 +7,17 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# @configure_input@ +# Generated from ltversion.in. -# serial 3293 ltversion.m4 +# serial 3017 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.4]) -m4_define([LT_PACKAGE_REVISION], [1.3293]) +m4_define([LT_PACKAGE_VERSION], [2.2.6b]) +m4_define([LT_PACKAGE_REVISION], [1.3017]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4' -macro_revision='1.3293' +[macro_version='2.2.6b' +macro_revision='1.3017' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 index c573da9..637bb20 100644 --- a/m4/lt~obsolete.m4 +++ b/m4/lt~obsolete.m4 @@ -1,13 +1,13 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 5 lt~obsolete.m4 +# serial 4 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # @@ -77,6 +77,7 @@ m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) @@ -89,10 +90,3 @@ m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/samples/Makefile.in b/samples/Makefile.in index 6abb962..42f861e 100644 --- a/samples/Makefile.in +++ b/samples/Makefile.in @@ -66,7 +66,6 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -94,7 +93,6 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -123,7 +121,6 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -156,6 +153,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ diff --git a/samples/knot.full.conf b/samples/knot.full.conf index 91d5674..6ed027e 100644 --- a/samples/knot.full.conf +++ b/samples/knot.full.conf @@ -40,7 +40,7 @@ system { # User for running server # May also specify user.group (f.e. knot.users) - user: root; + user root; } # Section 'keys' contains list of TSIG keys @@ -101,7 +101,10 @@ remotes { server0 { # <name> is an arbitrary symbolic name address 127.0.0.1; # <address> may be ither IPv4 or IPv6 address port 53531; # port is optional (default: 53) - key key0.server0; # (optional) specification of TSIG key associated for this remote + key key0.server0; # (optional) specification of TSIG key associated for this remote + via ipv4; # (optional) source interface for queries + via 82.35.64.59; # (optional) source interface for queries, direct IPv4 + via [::cafe]; # (optional) source interface for queries, direct IPv6 } # Format 2: <name> { address <address>@<port>; } diff --git a/src/Makefile.am b/src/Makefile.am index e73b2bf..a1bb196 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -217,12 +217,12 @@ libknot_la_SOURCES = \ libknots_la_SOURCES = \ common/slab/slab.c \ - common/slab/malloc.c \ common/slab/slab.h \ - common/slab/malloc.h \ common/libtap/tap.c \ common/libtap/tap.h \ common/libtap/tap_unit.h \ + common/mempattern.h \ + common/mempattern.c \ common/lists.c \ common/base32.c \ common/lists.h \ @@ -265,7 +265,9 @@ libknots_la_SOURCES = \ common/fdset_kqueue.h \ common/fdset_kqueue.c \ common/fdset_epoll.h \ - common/fdset_epoll.c + common/fdset_epoll.c \ + common/log.c \ + common/log.h libknotd_la_SOURCES = \ knot/stat/gatherer.c \ @@ -273,8 +275,6 @@ libknotd_la_SOURCES = \ knot/stat/gatherer.h \ knot/stat/stat.h \ knot/common.h \ - knot/other/log.c \ - knot/other/log.h \ knot/other/debug.h \ knot/other/error.h \ knot/other/error.c \ diff --git a/src/Makefile.in b/src/Makefile.in index f2d122c..bc8db39 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -69,7 +69,7 @@ am_libknot_la_OBJECTS = libknot_error.lo utils.lo debug.lo conv.lo \ tsig-op.lo libknot_la_OBJECTS = $(am_libknot_la_OBJECTS) libknotd_la_DEPENDENCIES = libknot.la libknots.la @LIBOBJS@ -am_libknotd_la_OBJECTS = gatherer.lo stat.lo log.lo error.lo \ +am_libknotd_la_OBJECTS = gatherer.lo stat.lo error.lo \ libknotd_la-cf-parse.lo libknotd_la-cf-lex.lo conf.lo \ logconf.lo process.lo dthreads.lo journal.lo socket.lo \ server.lo udp-handler.lo tcp-handler.lo xfr-handler.lo \ @@ -77,11 +77,11 @@ am_libknotd_la_OBJECTS = gatherer.lo stat.lo log.lo error.lo \ zone-dump-text.lo libknotd_la_OBJECTS = $(am_libknotd_la_OBJECTS) libknots_la_DEPENDENCIES = @LIBOBJS@ -am_libknots_la_OBJECTS = slab.lo malloc.lo tap.lo lists.lo base32.lo \ - print.lo dynamic-array.lo skip-list.lo base32hex.lo \ +am_libknots_la_OBJECTS = slab.lo tap.lo mempattern.lo lists.lo \ + base32.lo print.lo dynamic-array.lo skip-list.lo base32hex.lo \ general-tree.lo evqueue.lo evsched.lo acl.lo sockaddr.lo \ crc.lo ref.lo errors.lo dSFMT.lo prng.lo fdset.lo \ - fdset_poll.lo fdset_kqueue.lo fdset_epoll.lo + fdset_poll.lo fdset_kqueue.lo fdset_epoll.lo log.lo libknots_la_OBJECTS = $(am_libknots_la_OBJECTS) am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" \ "$(DESTDIR)$(man8dir)" @@ -220,7 +220,6 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -248,7 +247,6 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -277,7 +275,6 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -310,6 +307,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -540,12 +538,12 @@ libknot_la_SOURCES = \ libknots_la_SOURCES = \ common/slab/slab.c \ - common/slab/malloc.c \ common/slab/slab.h \ - common/slab/malloc.h \ common/libtap/tap.c \ common/libtap/tap.h \ common/libtap/tap_unit.h \ + common/mempattern.h \ + common/mempattern.c \ common/lists.c \ common/base32.c \ common/lists.h \ @@ -588,7 +586,9 @@ libknots_la_SOURCES = \ common/fdset_kqueue.h \ common/fdset_kqueue.c \ common/fdset_epoll.h \ - common/fdset_epoll.c + common/fdset_epoll.c \ + common/log.c \ + common/log.h libknotd_la_SOURCES = \ knot/stat/gatherer.c \ @@ -596,8 +596,6 @@ libknotd_la_SOURCES = \ knot/stat/gatherer.h \ knot/stat/stat.h \ knot/common.h \ - knot/other/log.c \ - knot/other/log.h \ knot/other/debug.h \ knot/other/error.h \ knot/other/error.c \ @@ -892,7 +890,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logconf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mempattern.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/name-server.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/node.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/node_tests.Po@am__quote@ @@ -1203,13 +1201,6 @@ stat.lo: knot/stat/stat.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stat.lo `test -f 'knot/stat/stat.c' || echo '$(srcdir)/'`knot/stat/stat.c -log.lo: knot/other/log.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT log.lo -MD -MP -MF $(DEPDIR)/log.Tpo -c -o log.lo `test -f 'knot/other/log.c' || echo '$(srcdir)/'`knot/other/log.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/log.Tpo $(DEPDIR)/log.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='knot/other/log.c' object='log.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o log.lo `test -f 'knot/other/log.c' || echo '$(srcdir)/'`knot/other/log.c - error.lo: knot/other/error.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT error.lo -MD -MP -MF $(DEPDIR)/error.Tpo -c -o error.lo `test -f 'knot/other/error.c' || echo '$(srcdir)/'`knot/other/error.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/error.Tpo $(DEPDIR)/error.Plo @@ -1336,13 +1327,6 @@ slab.lo: common/slab/slab.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o slab.lo `test -f 'common/slab/slab.c' || echo '$(srcdir)/'`common/slab/slab.c -malloc.lo: common/slab/malloc.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT malloc.lo -MD -MP -MF $(DEPDIR)/malloc.Tpo -c -o malloc.lo `test -f 'common/slab/malloc.c' || echo '$(srcdir)/'`common/slab/malloc.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/malloc.Tpo $(DEPDIR)/malloc.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common/slab/malloc.c' object='malloc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o malloc.lo `test -f 'common/slab/malloc.c' || echo '$(srcdir)/'`common/slab/malloc.c - tap.lo: common/libtap/tap.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tap.lo -MD -MP -MF $(DEPDIR)/tap.Tpo -c -o tap.lo `test -f 'common/libtap/tap.c' || echo '$(srcdir)/'`common/libtap/tap.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tap.Tpo $(DEPDIR)/tap.Plo @@ -1350,6 +1334,13 @@ tap.lo: common/libtap/tap.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tap.lo `test -f 'common/libtap/tap.c' || echo '$(srcdir)/'`common/libtap/tap.c +mempattern.lo: common/mempattern.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mempattern.lo -MD -MP -MF $(DEPDIR)/mempattern.Tpo -c -o mempattern.lo `test -f 'common/mempattern.c' || echo '$(srcdir)/'`common/mempattern.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mempattern.Tpo $(DEPDIR)/mempattern.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common/mempattern.c' object='mempattern.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mempattern.lo `test -f 'common/mempattern.c' || echo '$(srcdir)/'`common/mempattern.c + lists.lo: common/lists.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lists.lo -MD -MP -MF $(DEPDIR)/lists.Tpo -c -o lists.lo `test -f 'common/lists.c' || echo '$(srcdir)/'`common/lists.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/lists.Tpo $(DEPDIR)/lists.Plo @@ -1490,6 +1481,13 @@ fdset_epoll.lo: common/fdset_epoll.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fdset_epoll.lo `test -f 'common/fdset_epoll.c' || echo '$(srcdir)/'`common/fdset_epoll.c +log.lo: common/log.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT log.lo -MD -MP -MF $(DEPDIR)/log.Tpo -c -o log.lo `test -f 'common/log.c' || echo '$(srcdir)/'`common/log.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/log.Tpo $(DEPDIR)/log.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='common/log.c' object='log.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o log.lo `test -f 'common/log.c' || echo '$(srcdir)/'`common/log.c + zcompile_main.o: zcompile/zcompile_main.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT zcompile_main.o -MD -MP -MF $(DEPDIR)/zcompile_main.Tpo -c -o zcompile_main.o `test -f 'zcompile/zcompile_main.c' || echo '$(srcdir)/'`zcompile/zcompile_main.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/zcompile_main.Tpo $(DEPDIR)/zcompile_main.Po diff --git a/src/common/acl.c b/src/common/acl.c index d739319..a3cabd4 100644 --- a/src/common/acl.c +++ b/src/common/acl.c @@ -52,34 +52,29 @@ static int acl_compare(void *k1, void *k2) } /* Compare integers if IPv4. */ - if (a1->len == sizeof(struct sockaddr_in)) { + if (a1->family == AF_INET) { /* Compute mask .*/ uint32_t mask = acl_fill_mask32(a1->prefix); /* Compare address. */ - ldiff = (int)((acl_sa_ipv4(a1) & mask) - (acl_sa_ipv4(a2) & mask)); - if (ldiff < 0) { - return -1; - } else if (ldiff > 0) { - return 1; - } else { - return 0; - } - + int cmp1 = (acl_sa_ipv4(a1) & mask); + int cmp2 = (acl_sa_ipv4(a2) & mask); + if (cmp1 > cmp2) return 1; + if (cmp1 < cmp2) return -1; return 0; } /* IPv6 matching. */ #ifndef DISABLE_IPV6 - if (a1->len == sizeof(struct sockaddr_in6)) { + if (a1->family == AF_INET6) { /* Get mask .*/ short chunk = a1->prefix; /* Compare address by 32bit chunks. */ - uint32_t* a1p = (uint32_t*)&a1->addr6.sin6_addr; - uint32_t* a2p = (uint32_t*)&a2->addr6.sin6_addr; + uint32_t* a1p = (uint32_t *)(&a1->addr6.sin6_addr); + uint32_t* a2p = (uint32_t *)(&a2->addr6.sin6_addr); /* Mask 0 = 0 bits to compare from LO->HO (in big-endian). * Mask 128 = 128 bits to compare. @@ -93,12 +88,10 @@ static int acl_compare(void *k1, void *k2) chunk = 0; } - ldiff = (*(a1p++) & mask) ^ (*(a2p++) & mask); - if (ldiff < 0) { - return -1; - } else if (ldiff > 0) { - return 1; - } + int cmp1 = (*(a1p++) & mask); + int cmp2 = (*(a2p++) & mask); + if (cmp1 > cmp2) return 1; + if (cmp1 < cmp2) return -1; } return 0; @@ -157,9 +150,8 @@ void acl_delete(acl_t **acl) } /* Truncate rules. */ - if (acl_truncate(*acl) != ACL_ACCEPT) { - return; - } + skip_destroy_list(&(*acl)->rules, 0, free); + skip_destroy_list(&(*acl)->rules_pref, 0, free); /* Free ACL. */ free(*acl); @@ -227,6 +219,11 @@ int acl_truncate(acl_t *acl) /* Destroy all rules. */ skip_destroy_list(&acl->rules, 0, free); skip_destroy_list(&acl->rules_pref, 0, free); + acl->rules = skip_create_list(acl_compare); + acl->rules_pref = skip_create_list(acl_compare); + if (acl->rules == NULL || acl->rules_pref == NULL) { + return ACL_ERROR; + } return ACL_ACCEPT; } diff --git a/src/common/fdset.c b/src/common/fdset.c index d674d4a..c915e01 100644 --- a/src/common/fdset.c +++ b/src/common/fdset.c @@ -103,10 +103,10 @@ void __attribute__ ((constructor)) fdset_init() * \retval 0 if a == b * \retval 1 if a > b */ -static int fdset_compare(void *a, void *b) +static inline int fdset_compare(void *a, void *b) { - if ((size_t)a < (size_t)b) return -1; - if ((size_t)a > (size_t)b) return 1; + if (a > b) return 1; + if (a < b) return -1; return 0; } diff --git a/src/common/fdset.h b/src/common/fdset.h index ead4d5b..4fbd9bc 100644 --- a/src/common/fdset.h +++ b/src/common/fdset.h @@ -34,6 +34,7 @@ #include <stddef.h> #include "skip-list.h" +#include "mempattern.h" /*! \brief Waiting for completion constants. */ enum fdset_wait_t { diff --git a/src/common/fdset_epoll.c b/src/common/fdset_epoll.c index dbd803f..f6f42f0 100644 --- a/src/common/fdset_epoll.c +++ b/src/common/fdset_epoll.c @@ -27,7 +27,6 @@ #include "skip-list.h" #define OS_FDS_CHUNKSIZE 8 /*!< Number of pollfd structs in a chunk. */ -#define OS_FDS_KEEPCHUNKS 32 /*!< Will attempt to free memory when reached. */ struct fdset_t { fdset_base_t _base; @@ -41,22 +40,20 @@ struct fdset_t { fdset_t *fdset_epoll_new() { fdset_t *set = malloc(sizeof(fdset_t)); - if (!set) { - return NULL; + if (set) { + /* Blank memory. */ + memset(set, 0, sizeof(fdset_t)); + + /* Create epoll fd. */ + set->epfd = epoll_create(OS_FDS_CHUNKSIZE); } - - /* Blank memory. */ - memset(set, 0, sizeof(fdset_t)); - - /* Create epoll fd. */ - set->epfd = epoll_create(OS_FDS_CHUNKSIZE); - + return set; } int fdset_epoll_destroy(fdset_t * fdset) { - if(!fdset) { + if(fdset == NULL) { return -1; } @@ -71,27 +68,14 @@ int fdset_epoll_destroy(fdset_t * fdset) int fdset_epoll_add(fdset_t *fdset, int fd, int events) { - if (!fdset || fd < 0 || events <= 0) { + if (fdset == NULL || fd < 0 || events <= 0) { return -1; } /* Realloc needed. */ - if (fdset->nfds == fdset->reserved) { - const size_t chunk = OS_FDS_CHUNKSIZE; - const size_t nsize = (fdset->reserved + chunk) * - sizeof(struct epoll_event); - struct epoll_event *events_n = malloc(nsize); - if (!events_n) { - return -1; - } - - /* Clear and copy old fdset data. */ - memset(events_n, 0, nsize); - memcpy(events_n, fdset->events, - fdset->nfds * sizeof(struct epoll_event)); - free(fdset->events); - fdset->events = events_n; - fdset->reserved += chunk; + if (mreserve((char **)&fdset->events, sizeof(struct epoll_event), + fdset->nfds + 1, OS_FDS_CHUNKSIZE, &fdset->reserved) < 0) { + return -1; } /* Add to epoll set. */ @@ -109,7 +93,7 @@ int fdset_epoll_add(fdset_t *fdset, int fd, int events) int fdset_epoll_remove(fdset_t *fdset, int fd) { - if (!fdset || fd < 0) { + if (fdset == NULL || fd < 0) { return -1; } @@ -123,13 +107,16 @@ int fdset_epoll_remove(fdset_t *fdset, int fd) /* Overwrite current item. */ --fdset->nfds; - /*! \todo Return memory if unused (issue #1582). */ + /* Trim excessive memory if possible (retval is not interesting). */ + mreserve((char **)&fdset->events, sizeof(struct epoll_event), fdset->nfds, + OS_FDS_CHUNKSIZE, &fdset->reserved); + return 0; } int fdset_epoll_wait(fdset_t *fdset, int timeout) { - if (!fdset || fdset->nfds < 1 || !fdset->events) { + if (fdset == NULL || fdset->nfds < 1 || fdset->events == NULL) { return -1; } @@ -149,7 +136,7 @@ int fdset_epoll_wait(fdset_t *fdset, int timeout) int fdset_epoll_begin(fdset_t *fdset, fdset_it_t *it) { - if (!fdset || !it) { + if (fdset == NULL || it == NULL) { return -1; } @@ -160,7 +147,7 @@ int fdset_epoll_begin(fdset_t *fdset, fdset_it_t *it) int fdset_epoll_end(fdset_t *fdset, fdset_it_t *it) { - if (!fdset || !it || fdset->nfds < 1) { + if (fdset == NULL || it == NULL || fdset->nfds < 1) { return -1; } @@ -181,7 +168,7 @@ int fdset_epoll_end(fdset_t *fdset, fdset_it_t *it) int fdset_epoll_next(fdset_t *fdset, fdset_it_t *it) { - if (!fdset || !it || fdset->nfds < 1) { + if (fdset == NULL || it == NULL || fdset->nfds < 1) { return -1; } diff --git a/src/common/fdset_kqueue.c b/src/common/fdset_kqueue.c index b9f639d..2c7dd52 100644 --- a/src/common/fdset_kqueue.c +++ b/src/common/fdset_kqueue.c @@ -37,32 +37,31 @@ struct fdset_t { struct kevent *revents; size_t nfds; size_t reserved; + size_t rreserved; size_t polled; }; fdset_t *fdset_kqueue_new() { fdset_t *set = malloc(sizeof(fdset_t)); - if (!set) { - return 0; - } - - /* Blank memory. */ - memset(set, 0, sizeof(fdset_t)); - - /* Create kqueue fd. */ - set->kq = kqueue(); - if (set->kq < 0) { - free(set); - set = 0; + if (set) { + /* Blank memory. */ + memset(set, 0, sizeof(fdset_t)); + + /* Create kqueue fd. */ + set->kq = kqueue(); + if (set->kq < 0) { + free(set); + set = 0; + } } - + return set; } int fdset_kqueue_destroy(fdset_t * fdset) { - if(!fdset) { + if(fdset == NULL) { return -1; } @@ -76,45 +75,20 @@ int fdset_kqueue_destroy(fdset_t * fdset) return 0; } -int fdset_kqueue_realloc(struct kevent **old, size_t oldsize, size_t nsize) -{ - void *nmem = malloc(nsize); - if (!nmem) { - return -1; - } - - /* Clear and copy old fdset data. */ - memset(nmem, 0, nsize); - if (oldsize > 0) { - memcpy(nmem, *old, oldsize); - free(*old); - } - - *old = nmem; - return 0; -} - int fdset_kqueue_add(fdset_t *fdset, int fd, int events) { - if (!fdset || fd < 0 || events <= 0) { + if (fdset == NULL || fd < 0 || events <= 0) { return -1; } /* Realloc needed. */ - if (fdset->nfds == fdset->reserved) { - size_t chunk = OS_FDS_CHUNKSIZE; - size_t nsize = (fdset->reserved + chunk) * - sizeof(struct kevent); - size_t oldsize = fdset->nfds * sizeof(struct kevent); - - if (fdset_kqueue_realloc(&fdset->events, oldsize, nsize) < 0) { - return -1; - } - - if (fdset_kqueue_realloc(&fdset->revents, oldsize, nsize) < 0) { - return -1; - } - + int ret = 0; + ret += mreserve((char **)&fdset->events, sizeof(struct kevent), + fdset->nfds + 1, OS_FDS_CHUNKSIZE, &fdset->reserved); + ret += mreserve((char **)&fdset->revents, sizeof(struct kevent), + fdset->nfds + 1, OS_FDS_CHUNKSIZE, &fdset->rreserved); + if (ret != 0) { + return ret; } /* Add to kqueue set. */ @@ -128,7 +102,7 @@ int fdset_kqueue_add(fdset_t *fdset, int fd, int events) int fdset_kqueue_remove(fdset_t *fdset, int fd) { - if (!fdset || fd < 0) { + if (fdset == NULL || fd < 0) { return -1; } @@ -153,16 +127,35 @@ int fdset_kqueue_remove(fdset_t *fdset, int fd) size_t remaining = ((fdset->nfds - pos) - 1) * sizeof(struct kevent); memmove(fdset->events + pos, fdset->events + (pos + 1), remaining); + /* Attempt to remove from revents set. */ + pos = -1; + for (int i = 0; i < fdset->nfds; ++i) { + if (fdset->events[i].ident == fd) { + pos = i; + break; + } + } + if (pos >= 0) { + size_t remaining = ((fdset->nfds - pos) - 1) * sizeof(struct kevent); + memmove(fdset->revents + pos, fdset->revents + (pos + 1), remaining); + } + + /* Overwrite current item. */ --fdset->nfds; - /*! \todo Return memory if unused (issue #1582). */ + /* Trim excessive memory if possible (retval is not interesting). */ + mreserve((char **)&fdset->events, sizeof(struct kevent), + fdset->nfds, OS_FDS_CHUNKSIZE, &fdset->reserved); + mreserve((char **)&fdset->revents, sizeof(struct kevent), + fdset->nfds, OS_FDS_CHUNKSIZE, &fdset->rreserved); + return 0; } int fdset_kqueue_wait(fdset_t *fdset, int timeout) { - if (!fdset || fdset->nfds < 1 || !fdset->events) { + if (fdset == NULL || fdset->nfds < 1 || fdset->events == NULL) { return -1; } @@ -196,7 +189,7 @@ int fdset_kqueue_wait(fdset_t *fdset, int timeout) int fdset_kqueue_begin(fdset_t *fdset, fdset_it_t *it) { - if (!fdset || !it) { + if (fdset == NULL || it == NULL) { return -1; } @@ -207,7 +200,7 @@ int fdset_kqueue_begin(fdset_t *fdset, fdset_it_t *it) int fdset_kqueue_end(fdset_t *fdset, fdset_it_t *it) { - if (!fdset || !it || fdset->nfds < 1) { + if (fdset == NULL || it == NULL || fdset->nfds < 1) { return -1; } @@ -228,7 +221,7 @@ int fdset_kqueue_end(fdset_t *fdset, fdset_it_t *it) int fdset_kqueue_next(fdset_t *fdset, fdset_it_t *it) { - if (!fdset || !it || fdset->nfds < 1) { + if (fdset == NULL || it == NULL || fdset->nfds < 1) { return -1; } diff --git a/src/common/fdset_poll.c b/src/common/fdset_poll.c index 02ed8d4..19804f5 100644 --- a/src/common/fdset_poll.c +++ b/src/common/fdset_poll.c @@ -26,7 +26,6 @@ #include "common/fdset_poll.h" #define OS_FDS_CHUNKSIZE 8 /*!< Number of pollfd structs in a chunk. */ -#define OS_FDS_KEEPCHUNKS 32 /*!< Will attempt to free memory when reached. */ struct fdset_t { fdset_base_t _base; @@ -40,18 +39,16 @@ struct fdset_t { fdset_t *fdset_poll_new() { fdset_t *set = malloc(sizeof(fdset_t)); - if (!set) { - return 0; + if (set != NULL) { + memset(set, 0, sizeof(fdset_t)); } - /* Blank memory. */ - memset(set, 0, sizeof(fdset_t)); return set; } int fdset_poll_destroy(fdset_t * fdset) { - if(!fdset) { + if(fdset == NULL) { return -1; } @@ -63,29 +60,18 @@ int fdset_poll_destroy(fdset_t * fdset) int fdset_poll_add(fdset_t *fdset, int fd, int events) { - if (!fdset || fd < 0 || events <= 0) { + if (fdset == NULL || fd < 0 || events <= 0) { return -1; } /* Realloc needed. */ - if (fdset->nfds == fdset->reserved) { - const size_t chunk = OS_FDS_CHUNKSIZE; - const size_t nsize = sizeof(struct pollfd) * (fdset->reserved + chunk); - struct pollfd *fds_n = malloc(nsize); - if (!fds_n) { - return -1; - } - - /* Clear and copy old fdset data. */ - memset(fds_n, 0, nsize); - memcpy(fds_n, fdset->fds, fdset->nfds * sizeof(struct pollfd)); - free(fdset->fds); - fdset->fds = fds_n; - fdset->reserved += chunk; + if (mreserve((char **)&fdset->fds, sizeof(struct pollfd), + fdset->nfds + 1, OS_FDS_CHUNKSIZE, &fdset->reserved) < 0) { + return -1; } /* Append. */ - int nid = fdset->nfds++; + int nid = fdset->nfds++;; fdset->fds[nid].fd = fd; fdset->fds[nid].events = POLLIN; return 0; @@ -93,7 +79,7 @@ int fdset_poll_add(fdset_t *fdset, int fd, int events) int fdset_poll_remove(fdset_t *fdset, int fd) { - if (!fdset || fd < 0) { + if (fdset == NULL || fd < 0) { return -1; } @@ -118,13 +104,16 @@ int fdset_poll_remove(fdset_t *fdset, int fd) memmove(fdset->fds + pos, fdset->fds + (pos + 1), remaining); --fdset->nfds; - /*! \todo Return memory if unused (issue #1582). */ + /* Trim excessive memory if possible (retval is not interesting). */ + mreserve((char **)&fdset->fds, sizeof(struct pollfd), fdset->nfds, + OS_FDS_CHUNKSIZE, &fdset->reserved); + return 0; } int fdset_poll_wait(fdset_t *fdset, int timeout) { - if (!fdset || fdset->nfds < 1 || !fdset->fds) { + if (fdset == NULL || fdset->nfds < 1 || fdset->fds == NULL) { return -1; } @@ -146,7 +135,7 @@ int fdset_poll_wait(fdset_t *fdset, int timeout) int fdset_poll_begin(fdset_t *fdset, fdset_it_t *it) { - if (!fdset || !it) { + if (fdset == NULL || it == NULL) { return -1; } @@ -157,7 +146,7 @@ int fdset_poll_begin(fdset_t *fdset, fdset_it_t *it) int fdset_poll_end(fdset_t *fdset, fdset_it_t *it) { - if (!fdset || !it || fdset->nfds < 1) { + if (fdset == NULL || it == NULL || fdset->nfds < 1) { return -1; } @@ -186,7 +175,7 @@ int fdset_poll_end(fdset_t *fdset, fdset_it_t *it) int fdset_poll_next(fdset_t *fdset, fdset_it_t *it) { - if (!fdset || !it || fdset->nfds < 1) { + if (fdset == NULL || it == NULL || fdset->nfds < 1) { return -1; } diff --git a/src/knot/other/log.c b/src/common/log.c index 488763d..6d77ccb 100644 --- a/src/knot/other/log.c +++ b/src/common/log.c @@ -20,10 +20,10 @@ #include <string.h> #include <stdlib.h> +#include "common/log.h" +#include "common/lists.h" #include "knot/common.h" #include "knot/other/error.h" -#include "knot/other/log.h" -#include "common/lists.h" #include "knot/conf/conf.h" /*! Log source table. */ @@ -208,6 +208,20 @@ static int _log_msg(logsrc_t src, int level, const char *msg) // Convert level to mask level = LOG_MASK(level); + + /* Prefix date and time. */ + char tstr[128] = {0}; + int tlen = 0; + time_t t = time(NULL); + struct tm *lt = localtime(&t); + if (lt != NULL) { + tlen = strftime(tstr, sizeof(tstr) - 1, + "%d-%m-%Y %H:%M:%S", lt); + if (tlen > 0) { + tstr[tlen] = ' '; + tstr[tlen + 1] = '\0'; + } + } // Log streams for (int i = LOGT_STDERR; i < LOGT_FILE + LOG_FDS_OPEN; ++i) { @@ -224,7 +238,7 @@ static int _log_msg(logsrc_t src, int level, const char *msg) } // Print - ret = fprintf(stream, "%s", msg); + ret = fprintf(stream, "%s%s", tstr, msg); if (stream == stdout) { fflush(stream); } @@ -248,15 +262,15 @@ int log_msg(logsrc_t src, int level, const char *msg, ...) /* Prefix error level. */ const char *prefix = ""; switch (level) { - case LOG_DEBUG: break; - case LOG_INFO: break; - case LOG_NOTICE: prefix = "notice: "; break; - case LOG_WARNING: prefix = "warning: "; break; - case LOG_ERR: prefix = "error: "; break; - case LOG_FATAL: prefix = "fatal: "; break; + case LOG_DEBUG: prefix = "[debug] "; break; + case LOG_INFO: prefix = ""; break; + case LOG_NOTICE: prefix = "[notice] "; break; + case LOG_WARNING: prefix = "[warning] "; break; + case LOG_ERR: prefix = "[error] "; break; + case LOG_FATAL: prefix = "[fatal] "; break; default: break; } - + /* Prepend prefix. */ int plen = strlen(prefix); if (plen > buflen) { diff --git a/src/knot/other/log.h b/src/common/log.h index 305020c..305020c 100644 --- a/src/knot/other/log.h +++ b/src/common/log.h diff --git a/src/common/slab/malloc.c b/src/common/mempattern.c index ec5a68d..5982e18 100644 --- a/src/common/slab/malloc.c +++ b/src/common/mempattern.c @@ -14,17 +14,37 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <config.h> -/* - * Skip unit if not debugging memory. - */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/resource.h> +#include <config.h> #include "common/slab/alloc-common.h" + +int mreserve(char **p, size_t tlen, size_t min, size_t allow, size_t *reserved) +{ + /* Trim excessive memory if possible. */ + size_t maxlen = min + allow; + if (maxlen < min) { + return -2; /* size_t overflow */ + } + + /* Meet target size but trim excessive amounts. */ + if (*reserved < min || *reserved > maxlen) { + void *trimmed = realloc(*p, maxlen * tlen); + if (trimmed != NULL) { + *p = trimmed; + *reserved = maxlen; + } else { + return -1; + } + } + + return 0; +} + #ifdef MEM_DEBUG /* * ((destructor)) attribute executes this function after main(). diff --git a/src/common/slab/malloc.h b/src/common/mempattern.h index 8ca9f58..ae1fa78 100644 --- a/src/common/slab/malloc.h +++ b/src/common/mempattern.h @@ -14,7 +14,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ /*! - * \file malloc.h + * \file mempattern.h * * \author Marek Vavrusa <marek.vavrusa@nic.cz> * @@ -27,7 +27,32 @@ #ifndef _KNOTD_COMMON_MALLOC_H_ #define _KNOTD_COMMON_MALLOC_H_ -#include <stdlib.h> +/*! + * \brief Reserve new or trim excessive memory. + * + * \param p Double-pointer to memory region. + * \param tlen Memory unit (f.e. sizeof(int) for int* array) + * \param min Minimum number of items required. + * \param allow Maximum extra items to keep (for trimming). + * \param reserved Pointer to number of already reserved items. + * + * \note Example usage: + * char *buf = NULL; size_t len = 0; + * if (mreserve(&buf, sizeof(char), 6, 0, &len) == 0) { + * memcpy(buf, "hello", strlen("hello"); + * if (mreserve(&buf, sizeof(char), 20, 0, &len) == 0) { + * strncat(buf, "!", 1); + * mreserve(&buf, sizeof(char), strlen("hello!")+1, 0, &len); + * } + * } + * free(buf); + * + * \retval 0 on success. + * \retval -1 on error. + * + * \note Memory region will be left untouched if function fails. + */ +int mreserve(char **p, size_t tlen, size_t min, size_t allow, size_t *reserved); /*! \brief Print usage statistics. * diff --git a/src/common/sockaddr.c b/src/common/sockaddr.c index 48551bc..b4e75ee 100644 --- a/src/common/sockaddr.c +++ b/src/common/sockaddr.c @@ -49,6 +49,20 @@ int sockaddr_init(sockaddr_t *addr, int af) return sockaddr_update(addr); } +int sockaddr_isvalid(sockaddr_t *addr) +{ + return addr && addr->family > -1; +} + +int sockaddr_copy(sockaddr_t *dst, const sockaddr_t *src) +{ + if (memcpy(dst, src, sizeof(sockaddr_t)) != NULL) { + return sockaddr_update(dst); + } + + return -1; +} + int sockaddr_update(sockaddr_t *addr) { /* Update internal pointer. */ @@ -117,7 +131,7 @@ int sockaddr_setprefix(sockaddr_t *dst, int prefix) return dst->prefix = prefix; } -int sockaddr_tostr(sockaddr_t *addr, char *dst, size_t size) +int sockaddr_tostr(const sockaddr_t *addr, char *dst, size_t size) { if (!addr || !dst || size == 0) { return -1; @@ -159,7 +173,7 @@ int sockaddr_tostr(sockaddr_t *addr, char *dst, size_t size) return 0; } -int sockaddr_portnum(sockaddr_t *addr) +int sockaddr_portnum(const sockaddr_t *addr) { if (!addr) { return -1; diff --git a/src/common/sockaddr.h b/src/common/sockaddr.h index b2725c0..52e621c 100644 --- a/src/common/sockaddr.h +++ b/src/common/sockaddr.h @@ -74,6 +74,16 @@ typedef struct sockaddr_t { int sockaddr_init(sockaddr_t *addr, int af); /*! + * \brief Return true value if sockaddr is valid. + * + * \param addr Socket address structure. + * + * \retval true on succes. + * \retval false otherwise. + */ +int sockaddr_isvalid(sockaddr_t *addr); + +/*! * \brief Update internal pointers according to length. * * \param addr Socket address structure. @@ -84,6 +94,17 @@ int sockaddr_init(sockaddr_t *addr, int af); int sockaddr_update(sockaddr_t *addr); /*! + * \brief Copy socket address structure. + * + * \param dst Target address structure. + * \param src Source address structure. + * + * \retval 0 on success. + * \retval -1 on error. + */ +int sockaddr_copy(sockaddr_t *dst, const sockaddr_t *src); + +/*! * \brief Set address and port. * * \param dst Target address structure. @@ -119,7 +140,7 @@ int sockaddr_setprefix(sockaddr_t *dst, int prefix); * \retval 0 on success. * \retval -1 on invalid parameters. */ -int sockaddr_tostr(sockaddr_t *addr, char *dst, size_t size); +int sockaddr_tostr(const sockaddr_t *addr, char *dst, size_t size); /*! * \brief Return port number from address. @@ -129,7 +150,7 @@ int sockaddr_tostr(sockaddr_t *addr, char *dst, size_t size); * \retval Port number on success. * \retval -1 on errors. */ -int sockaddr_portnum(sockaddr_t *addr); +int sockaddr_portnum(const sockaddr_t *addr); #endif /* _KNOTD_SOCKADDR_H_ */ diff --git a/src/config.h.in b/src/config.h.in index dfcea86..905e327 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -63,6 +63,9 @@ /* Define to 1 if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H +/* Define to 1 if you have the `madvise' function. */ +#undef HAVE_MADVISE + /* Define to 1 if you have the <malloc.h> header file. */ #undef HAVE_MALLOC_H diff --git a/src/knot/common.h b/src/knot/common.h index 027962a..c321b94 100644 --- a/src/knot/common.h +++ b/src/knot/common.h @@ -79,7 +79,7 @@ typedef unsigned int uint; /*!< \brief Unsigned. */ #include "common/latency.h" #include "common/print.h" -#include "knot/other/log.h" +#include "common/log.h" #include "knot/other/debug.h" /*! \brief Eliminate compiler warning with unused parameters. */ diff --git a/src/knot/conf/cf-lex.l b/src/knot/conf/cf-lex.l index 6683edc..dfd0ac7 100644 --- a/src/knot/conf/cf-lex.l +++ b/src/knot/conf/cf-lex.l @@ -15,7 +15,7 @@ #include "common/sockaddr.h" #include "knot/conf/conf.h" -#include "knot/other/log.h" +#include "common/log.h" #include "libknotd_la-cf-parse.h" /* Automake generated header. */ /* Imported symbols. */ @@ -65,7 +65,6 @@ BLANK [ \t\n] %% \#.*\n /* Ignore comments */; {BLANK}+ /* Ignore whitespace */; -: /* Optional : in assignments. */; [\!\$\%\^\&\*\(\)\/\+\-\@\{\}\;\,] { return yytext[0]; } system { lval.t = yytext; return SYSTEM; } identity { lval.t = yytext; return IDENTITY; } @@ -255,6 +254,7 @@ hmac-sha512 { lval.alg = KNOT_TSIG_ALG_HMAC_SHA512; return TSIG_ALGO_NAME; } return TEXT /* Last resort, alphanumeric word. */; } +: /* Optional : in assignments. */; <<EOF>> return END; %% diff --git a/src/knot/conf/cf-parse.y b/src/knot/conf/cf-parse.y index c7efa10..4981606 100644 --- a/src/knot/conf/cf-parse.y +++ b/src/knot/conf/cf-parse.y @@ -52,6 +52,7 @@ static void conf_start_remote(void *scanner, char *remote) memset(this_remote, 0, sizeof(conf_iface_t)); this_remote->name = remote; add_tail(&new_config->remotes, &this_remote->n); + sockaddr_init(&this_remote->via, -1); ++new_config->remotes_count; } @@ -71,7 +72,7 @@ static void conf_remote_set_via(void *scanner, char *item) { snprintf(buf, sizeof(buf), "remote '%s' is not defined", item); cf_error(scanner, buf); } else { - this_remote->via = found; + sockaddr_set(&this_remote->via, found->family, found->address, 0); } } @@ -541,13 +542,17 @@ remote: } free($3.t); } + | remote VIA IPA ';' { + sockaddr_set(&this_remote->via, AF_INET, $3.t, 0); + free($3.t); + } + | remote VIA IPA6 ';' { + sockaddr_set(&this_remote->via, AF_INET6, $3.t, 0); + free($3.t); + } | remote VIA TEXT ';' { - if (this_remote->key != 0) { - cf_error(scanner, "only one 'via' definition is allowed in remote section\n"); - } else { conf_remote_set_via(scanner, $3.t); - } - free($3.t); + free($3.t); } ; diff --git a/src/knot/conf/conf.h b/src/knot/conf/conf.h index 1e6644e..40cd1cc 100644 --- a/src/knot/conf/conf.h +++ b/src/knot/conf/conf.h @@ -37,7 +37,8 @@ #include "libknot/util/descriptor.h" #include "libknot/tsig.h" #include "common/lists.h" -#include "knot/other/log.h" +#include "common/log.h" +#include "common/sockaddr.h" /* Constants. */ #define CONFIG_DEFAULT_PORT 53 @@ -60,7 +61,7 @@ typedef struct conf_iface_t { int port; /*!< Port number for this interface */ int family; /*!< Address family. */ knot_key_t *key; /*!< TSIG key (only valid for remotes). */ - struct conf_iface_t *via; /*!< Used for remotes to specify qry endpoint.*/ + sockaddr_t via; /*!< Used for remotes to specify qry endpoint.*/ } conf_iface_t; /*! diff --git a/src/knot/conf/logconf.c b/src/knot/conf/logconf.c index a57afd9..4d7334f 100644 --- a/src/knot/conf/logconf.c +++ b/src/knot/conf/logconf.c @@ -23,7 +23,7 @@ #include "knot/other/debug.h" #include "knot/conf/logconf.h" #include "knot/conf/conf.h" -#include "knot/other/log.h" +#include "common/log.h" #include "knot/other/error.h" #include "common/lists.h" #include "knot/common.h" diff --git a/src/knot/ctl/knotc_main.c b/src/knot/ctl/knotc_main.c index 814fbc3..436cc5e 100644 --- a/src/knot/ctl/knotc_main.c +++ b/src/knot/ctl/knotc_main.c @@ -71,7 +71,8 @@ void help(int argc, char **argv) " stop Stop %s server (no-op if not running).\n" " restart Stops and then starts %s server.\n" " reload Reload %s configuration and compiled zones.\n" - " running check if server is running.\n" + " running Check if server is running.\n" + " checkconf Check server configuration.\n" "\n" " compile Compile zone file.\n", PACKAGE_NAME, PACKAGE_NAME, PACKAGE_NAME, PACKAGE_NAME); @@ -105,8 +106,7 @@ int check_zone(const char *db, const char* source) break; } - fprintf(stderr, "error: "); - fprintf(stderr, emsg, source); + log_zone_error(emsg, source); return KNOTD_ENOENT; } @@ -161,7 +161,7 @@ pid_t start_cmd(const char *argv[], int argc) execvp(args[0], args); /* Execute failed. */ - fprintf(stderr, "Failed to run executable '%s'\n", args[0]); + log_server_error("Failed to run executable '%s'\n", args[0]); for (int i = 0; i < argc; ++i) { free(args[i]); } @@ -222,23 +222,23 @@ int zctask_wait(knotc_zctask_t *tasks, int count) } if (z == 0) { - fprintf(stderr, "error: Failed to find zone for finished " - "zone compilation process.\n"); + log_server_error("Failed to find zone for finished " + "zone compilation process.\n"); return 1; } /* Evaluate. */ if (!WIFEXITED(rc)) { - fprintf(stderr, "error: Compilation of '%s' " - "failed, process was killed.\n", - z->name); + log_server_error("Compilation of '%s' " + "failed, process was killed.\n", + z->name); return 1; } else { if (rc < 0 || WEXITSTATUS(rc) != 0) { - fprintf(stderr, "error: Compilation of " - "'%s' failed, knot-zcompile " - "return code was '%d'\n", - z->name, WEXITSTATUS(rc)); + log_server_error("Compilation of " + "'%s' failed, knot-zcompile " + "return code was '%d'\n", + z->name, WEXITSTATUS(rc)); return 1; } } @@ -289,7 +289,8 @@ int execute(const char *action, char **argv, int argc, pid_t pid, // Check pidfile for w+ FILE* chkf = fopen(pidfile, "w+"); if (chkf == NULL) { - fprintf(stderr, "control: PID file '%s' is not writeable, refusing to start\n", pidfile); + log_server_error("PID file '%s' is not writeable, " + "refusing to start\n", pidfile); return 1; } else { fclose(chkf); @@ -305,15 +306,15 @@ int execute(const char *action, char **argv, int argc, pid_t pid, // } if (pid > 0 && pid_running(pid)) { - fprintf(stderr, "control: Server PID found, " - "already running.\n"); + log_server_error("Server PID found, " + "already running.\n"); if (!has_flag(flags, F_FORCE)) { return 1; } else { - fprintf(stderr, "control: forcing " - "server start, killing old pid=%ld.\n", - (long)pid); + log_server_info("Forcing server start, " + "killing old pid=%ld.\n", + (long)pid); kill(pid, SIGKILL); pid_remove(pidfile); } @@ -344,7 +345,7 @@ int execute(const char *action, char **argv, int argc, pid_t pid, // Execute command if (has_flag(flags, F_INTERACTIVE)) { - printf("control: Running in interactive mode.\n"); + log_server_info("Running in interactive mode.\n"); fflush(stderr); fflush(stdout); } @@ -358,8 +359,7 @@ int execute(const char *action, char **argv, int argc, pid_t pid, // Wait for finish if (has_flag(flags, F_WAIT) && !has_flag(flags, F_INTERACTIVE)) { if (has_flag(flags, F_VERBOSE)) { - fprintf(stdout, "control: waiting for server " - "to load.\n"); + log_server_info("Waiting for server to load.\n"); } /* Periodically read pidfile and wait for * valid result. */ @@ -379,14 +379,13 @@ int execute(const char *action, char **argv, int argc, pid_t pid, valid_cmd = 1; rc = 0; if (pid <= 0 || !pid_running(pid)) { - fprintf(stderr, "Server PID not found, " - "probably not running.\n"); + log_server_warning("Server PID not found, " + "probably not running.\n"); if (!has_flag(flags, F_FORCE)) { rc = 1; } else { - fprintf(stderr, "control: forcing " - "server stop.\n"); + log_server_info("Forcing server stop.\n"); } } @@ -401,8 +400,8 @@ int execute(const char *action, char **argv, int argc, pid_t pid, // Wait for finish if (rc == 0 && has_flag(flags, F_WAIT)) { if (has_flag(flags, F_VERBOSE)) { - fprintf(stdout, "control: waiting for server " - "to stop.\n"); + log_server_info("Waiting for server " + "to stop.\n"); } /* Periodically read pidfile and wait for * valid result. */ @@ -426,8 +425,8 @@ int execute(const char *action, char **argv, int argc, pid_t pid, break; } if (i == WAITPID_TIMEOUT) { - fprintf(stderr, "Timeout while " - "waiting for the server to finish.\n"); + log_server_error("Timeout while waiting for " + "the server to finish.\n"); //pid_remove(pidfile); break; } else { @@ -436,7 +435,7 @@ int execute(const char *action, char **argv, int argc, pid_t pid, } } - printf("Restarting server.\n"); + log_server_info("Restarting server.\n"); rc = execute("start", argv, argc, -1, flags, jobs, pidfile); } if (strcmp(action, "reload") == 0) { @@ -444,12 +443,11 @@ int execute(const char *action, char **argv, int argc, pid_t pid, // Check PID valid_cmd = 1; if (pid <= 0 || !pid_running(pid)) { - fprintf(stderr, "Server PID not found, " - "probably not running.\n"); + log_server_warning("Server PID not found, " + "probably not running.\n"); if (has_flag(flags, F_FORCE)) { - fprintf(stderr, "control: forcing " - "server stop.\n"); + log_server_info("Forcing server stop.\n"); } else { return 1; } @@ -472,29 +470,33 @@ int execute(const char *action, char **argv, int argc, pid_t pid, // Check PID valid_cmd = 1; if (pid <= 0) { - printf("Server PID not found, " - "probably not running.\n"); + log_server_info("Server PID not found, " + "probably not running.\n"); rc = 1; } else { if (!pid_running(pid)) { - printf("Server PID not found, " - "probably not running.\n"); - fprintf(stderr, - "warning: PID file is stale.\n"); + log_server_info("Server PID not found, " + "probably not running.\n"); + log_server_warning("PID file is stale.\n"); } else { - printf("Server running as PID %ld.\n", - (long)pid); + log_server_info("Server running as PID %ld.\n", + (long)pid); } rc = 0; } } + if (strcmp(action, "checkconf") == 0) { + log_server_info("OK, configuration is valid.\n"); + rc = 0; + valid_cmd = 1; + } if (strcmp(action, "compile") == 0) { // Print job count if (jobs > 1) { - printf("warning: Will attempt to compile %d zones " - "in parallel, this increases memory consumption " - "for large zones.\n", jobs); + log_server_warning("Will attempt to compile %d zones " + "in parallel, this increases memory " + "consumption for large zones.\n", jobs); } // Check zone @@ -515,12 +517,12 @@ int execute(const char *action, char **argv, int argc, pid_t pid, // Check source files and mtime int zone_status = check_zone(zone->db, zone->file); if (zone_status == KNOTD_EOK) { - printf("Zone '%s' is up-to-date.\n", - zone->name); + log_zone_info("Zone '%s' is up-to-date.\n", + zone->name); if (has_flag(flags, F_FORCE)) { - fprintf(stderr, "control: forcing " - "zone recompilation.\n"); + log_zone_info("Forcing zone " + "recompilation.\n"); } else { continue; } @@ -533,7 +535,7 @@ int execute(const char *action, char **argv, int argc, pid_t pid, /* Evaluate space for new task. */ if (running == jobs) { - zctask_wait(tasks, jobs); + rc |= zctask_wait(tasks, jobs); --running; } @@ -549,8 +551,8 @@ int execute(const char *action, char **argv, int argc, pid_t pid, // Execute command if (has_flag(flags, F_VERBOSE)) { - printf("Compiling '%s' as '%s'...\n", - zone->name, zone->db); + log_zone_info("Compiling '%s' as '%s'...\n", + zone->name, zone->db); } fflush(stdout); fflush(stderr); @@ -570,13 +572,13 @@ int execute(const char *action, char **argv, int argc, pid_t pid, conf_read_unlock(); } if (!valid_cmd) { - fprintf(stderr, "Invalid command: '%s'\n", action); + log_server_error("Invalid command: '%s'\n", action); return 1; } // Log if (has_flag(flags, F_VERBOSE)) { - printf("'%s' finished (return code %d)\n", action, rc); + log_server_info("'%s' finished (return code %d)\n", action, rc); } return rc; } @@ -640,11 +642,8 @@ int main(int argc, char **argv) return 1; } - // Initialize log (no output) + // Initialize log log_init(); - log_levels_set(LOGT_SYSLOG, LOG_ANY, 0); - log_levels_set(LOGT_STDOUT, LOG_ANY, 0); - closelog(); // Find implicit configuration file char *default_fn = 0; @@ -657,11 +656,11 @@ int main(int argc, char **argv) int conf_ret = conf_open(config_fn); if (conf_ret != KNOTD_EOK) { if (conf_ret == KNOTD_ENOENT) { - fprintf(stderr, "Couldn't open configuration file " - "'%s'.\n", config_fn); + log_server_error("Couldn't open configuration file " + "'%s'.\n", config_fn); } else { - fprintf(stderr, "Failed to parse configuration '%s'.\n", - config_fn); + log_server_error("Failed to parse configuration '%s'.\n", + config_fn); } free(default_fn); return 1; @@ -679,8 +678,8 @@ int main(int argc, char **argv) // Fetch PID char* pidfile = pid_filename(); if (!pidfile) { - fprintf(stderr, "No configuration found, " - "please specify with '-c' parameter.\n"); + log_server_error("No configuration found, " + "please specify with '-c' parameter.\n"); log_close(); return 1; } diff --git a/src/knot/other/debug.h b/src/knot/other/debug.h index 7768d22..1a8698e 100644 --- a/src/knot/other/debug.h +++ b/src/knot/other/debug.h @@ -47,9 +47,11 @@ #ifdef KNOT_COMPILER_DEBUG #define KNOTD_ZDUMP_DEBUG #define KNOTD_ZLOAD_DEBUG + #define KNOTD_SEMCHECK_DEBUG + #define KNOTD_COMPILE_DEBUG #endif -#include "knot/other/log.h" +#include "common/log.h" #include "common/print.h" /******************************************************************************/ @@ -434,6 +436,90 @@ #define dbg_zload_exec_detail(cmds) #endif +#ifdef KNOTD_COMPILER_DEBUG + +/* Brief messages. */ +#ifdef DEBUG_ENABLE_BRIEF +#define dbg_zp(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_zp_hex(data, len) hex_log(LOG_SERVER, (data), (len)) +#else +#define dbg_zp(msg...) +#define dbg_zp_hex(data, len) +#endif + +/* Verbose messages. */ +#ifdef DEBUG_ENABLE_VERBOSE +#define dbg_zp_verb(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_zp_hex_verb(data, len) hex_log(LOG_SERVER, (data), (len)) +#else +#define dbg_zp_verb(msg...) +#define dbg_zp_hex_verb(data, len) +#endif + +/* Detail messages. */ +#ifdef DEBUG_ENABLE_DETAILS +#define dbg_zp_detail(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_zp_hex_detail(data, len) hex_log(LOG_SERVER, (data), (len)) +#define dbg_zp_exec_detail(cmds) do { cmds } while (0) +#else +#define dbg_zp_detail(msg...) +#define dbg_zp_hex_detail(data, len) +#define dbg_zp_exec_detail(cmds) +#endif + +/* No messages. */ +#else +#define dbg_zp(msg...) +#define dbg_zp_hex(data, len) +#define dbg_zp_verb(msg...) +#define dbg_zp_hex_verb(data, len) +#define dbg_zp_detail(msg...) +#define dbg_zp_hex_detail(data, len) +#define dbg_zp_exec_detail(cmds) +#endif + +#ifdef KNOTD_SEMCHECK_DEBUG + +/* Brief messages. */ +#ifdef DEBUG_ENABLE_BRIEF +#define dbg_semcheck(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_semcheck_hex(data, len) hex_log(LOG_SERVER, (data), (len)) +#else +#define dbg_semcheck(msg...) +#define dbg_semcheck_hex(data, len) +#endif + +/* Verbose messages. */ +#ifdef DEBUG_ENABLE_VERBOSE +#define dbg_semcheck_verb(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_semcheck_hex_verb(data, len) hex_log(LOG_SERVER, (data), (len)) +#else +#define dbg_semcheck_verb(msg...) +#define dbg_semcheck_hex_verb(data, len) +#endif + +/* Detail messages. */ +#ifdef DEBUG_ENABLE_DETAILS +#define dbg_semcheck_detail(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_semcheck_hex_detail(data, len) hex_log(LOG_SERVER, (data), (len)) +#define dbg_semcheck_exec_detail(cmds) do { cmds } while (0) +#else +#define dbg_semcheck_detail(msg...) +#define dbg_semcheck_hex_detail(data, len) +#define dbg_semcheck_exec_detail(cmds) +#endif + +/* No messages. */ +#else +#define dbg_semcheck(msg...) +#define dbg_semcheck_hex(data, len) +#define dbg_semcheck_verb(msg...) +#define dbg_semcheck_hex_verb(data, len) +#define dbg_semcheck_detail(msg...) +#define dbg_semcheck_hex_detail(data, len) +#define dbg_semcheck_exec_detail(cmds) +#endif + /******************************************************************************/ #endif /* _KNOTD_DEBUG_H_ */ diff --git a/src/knot/other/error.c b/src/knot/other/error.c index 0ab7568..70c84a3 100644 --- a/src/knot/other/error.c +++ b/src/knot/other/error.c @@ -26,7 +26,7 @@ const error_table_t knotd_error_msgs[] = { {KNOTD_ENOTSUP, "Parameter not supported."}, {KNOTD_EBUSY, "Requested resource is busy."}, {KNOTD_EAGAIN, "The system lacked the necessary resource, try again."}, - {KNOTD_EACCES, "Permission to perform requested operation is denied."}, + {KNOTD_EACCES, "Operation not permitted."}, {KNOTD_ECONNREFUSED, "Connection refused."}, {KNOTD_EISCONN, "Already connected."}, {KNOTD_EADDRINUSE, "Address already in use."}, diff --git a/src/knot/server/dthreads.c b/src/knot/server/dthreads.c index be6fc24..4e2b490 100644 --- a/src/knot/server/dthreads.c +++ b/src/knot/server/dthreads.c @@ -27,7 +27,7 @@ #include "knot/common.h" #include "knot/server/dthreads.h" -#include "knot/other/log.h" +#include "common/log.h" #include "knot/other/error.h" /*! \brief Lock thread state for R/W. */ @@ -124,6 +124,7 @@ static void *thread_ep(void *data) sigaddset(&ignset, SIGTERM); sigaddset(&ignset, SIGHUP); sigaddset(&ignset, SIGPIPE); + sigaddset(&ignset, SIGUSR1); pthread_sigmask(SIG_BLOCK, &ignset, 0); /*! \todo Review under BSD (issue #1441). */ dbg_dt("dthreads: [%p] entered ep\n", thread); @@ -236,8 +237,9 @@ static dthread_t *dt_create_thread(dt_unit_t *unit) // Initialize attribute pthread_attr_t *attr = &thread->_attr; pthread_attr_init(attr); - pthread_attr_setinheritsched(attr, PTHREAD_INHERIT_SCHED); - pthread_attr_setschedpolicy(attr, SCHED_OTHER); + //pthread_attr_setinheritsched(attr, PTHREAD_INHERIT_SCHED); + //pthread_attr_setschedpolicy(attr, SCHED_OTHER); + pthread_attr_setstacksize(attr, 1024*1024); return thread; } @@ -814,43 +816,43 @@ int dt_stop(dt_unit_t *unit) return KNOTD_EOK; } -int dt_setprio(dthread_t *thread, int prio) -{ - // Check input - if (thread == 0) { - return KNOTD_EINVAL; - } - - // Clamp priority - int policy = SCHED_FIFO; - prio = MIN(MAX(sched_get_priority_min(policy), prio), - sched_get_priority_max(policy)); - - // Update scheduler policy - int ret = pthread_attr_setschedpolicy(&thread->_attr, policy); - - // Update priority - if (ret == 0) { - struct sched_param sp; - sp.sched_priority = prio; - ret = pthread_attr_setschedparam(&thread->_attr, &sp); - } - - /* Map error codes. */ - if (ret != 0) { - dbg_dt("dthreads: [%p] %s(%d): failed", - thread, __func__, prio); - - /* Map "not supported". */ - if (errno == ENOTSUP) { - return KNOTD_ENOTSUP; - } - - return KNOTD_EINVAL; - } - - return KNOTD_EOK; -} +//int dt_setprio(dthread_t *thread, int prio) +//{ +// // Check input +// if (thread == 0) { +// return KNOTD_EINVAL; +// } + +// // Clamp priority +// int policy = SCHED_FIFO; +// prio = MIN(MAX(sched_get_priority_min(policy), prio), +// sched_get_priority_max(policy)); + +// // Update scheduler policy +// int ret = pthread_attr_setschedpolicy(&thread->_attr, policy); + +// // Update priority +// if (ret == 0) { +// struct sched_param sp; +// sp.sched_priority = prio; +// ret = pthread_attr_setschedparam(&thread->_attr, &sp); +// } + +// /* Map error codes. */ +// if (ret != 0) { +// dbg_dt("dthreads: [%p] %s(%d): failed", +// thread, __func__, prio); + +// /* Map "not supported". */ +// if (errno == ENOTSUP) { +// return KNOTD_ENOTSUP; +// } + +// return KNOTD_EINVAL; +// } + +// return KNOTD_EOK; +//} int dt_repurpose(dthread_t *thread, runnable_t runnable, void *data) { diff --git a/src/knot/server/dthreads.h b/src/knot/server/dthreads.h index 8a5e2b4..2347e1d 100644 --- a/src/knot/server/dthreads.h +++ b/src/knot/server/dthreads.h @@ -45,6 +45,9 @@ struct dthread_t; struct dt_unit_t; +/* Constants. */ +#define DTHREADS_STACKSIZE (1024*1024) /* 1M lightweight stack size. */ + /*! * \brief Thread state enumeration. */ @@ -238,10 +241,14 @@ int dt_stop(dt_unit_t *unit); * \param thread Target thread instance. * \param prio Requested priority (positive integer, default is 0). * + * \warning Thread priority setting is disabled as the compatible scheduler + * has significant performance deficiencies (SCHED_OTHER). + * (issue #1809) + * * \retval KNOTD_EOK on success. * \retval KNOTD_EINVAL on invalid parameters. */ -int dt_setprio(dthread_t *thread, int prio); +//int dt_setprio(dthread_t *thread, int prio); /*! * \brief Set thread to execute another runnable. diff --git a/src/knot/server/journal.c b/src/knot/server/journal.c index 6b566f6..fc8ec5c 100644 --- a/src/knot/server/journal.c +++ b/src/knot/server/journal.c @@ -14,13 +14,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <config.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> -#include <sys/stat.h> #include <fcntl.h> +#include <sys/stat.h> +#include <sys/mman.h> +#include "common/crc.h" #include "knot/other/error.h" #include "knot/other/debug.h" #include "knot/zone/zone-dump.h" @@ -51,15 +54,9 @@ static inline int sfwrite(const void *src, size_t len, int fd) /*! \brief Equality compare function. */ static inline int journal_cmp_eq(uint64_t k1, uint64_t k2) { - if (k1 == k2) { - return 0; - } - - if (k1 < k2) { - return -1; - } - - return 1; + if (k1 > k2) return 1; + if (k1 < k2) return -1; + return 0; } /*! \brief Recover metadata from journal. */ @@ -132,6 +129,183 @@ static int journal_recover(journal_t *j) return KNOTD_EOK; } +int journal_write_in(journal_t *j, journal_node_t **rn, uint64_t id, size_t len) +{ + const size_t node_len = sizeof(journal_node_t); + *rn = NULL; + + /* Find next free node. */ + uint16_t jnext = (j->qtail + 1) % j->max_nodes; + + dbg_journal("journal: will write id=%llu, node=%u, size=%zu, fsize=%zu\n", + (unsigned long long)id, j->qtail, len, j->fsize); + + /* Calculate remaining bytes to reach file size limit. */ + size_t fs_remaining = j->fslimit - j->fsize; + + /* Increase free segment if on the end of file. */ + journal_node_t *n = j->nodes + j->qtail; + if (j->free.pos + j->free.len == j->fsize) { + + dbg_journal_verb("journal: * is last node\n"); + + /* Grow journal file until the size limit. */ + if(j->free.len < len && len <= fs_remaining) { + size_t diff = len - j->free.len; + dbg_journal("journal: * growing by +%zu, pos=%u, " + "new fsize=%zu\n", + diff, j->free.pos, + j->fsize + diff); + j->fsize += diff; /* Appending increases file size. */ + j->free.len += diff; + + } + + /* Rewind if resize is needed, but the limit is reached. */ + if(j->free.len < len && len > fs_remaining) { + journal_node_t *head = j->nodes + j->qhead; + j->fsize = j->free.pos; + j->free.pos = head->pos; + j->free.len = 0; + dbg_journal_verb("journal: * fslimit reached, " + "rewinding to %u\n", + head->pos); + dbg_journal_verb("journal: * file size trimmed to %zu\n", + j->fsize); + } + } + + /* Evict occupied nodes if necessary. */ + while (j->free.len < len || + j->nodes[jnext].flags > JOURNAL_FREE) { + + /* Evict least recent node if not empty. */ + journal_node_t *head = j->nodes + j->qhead; + + /* Check if it has been synced to disk. */ + if (head->flags & JOURNAL_DIRTY) { + return KNOTD_EAGAIN; + } + + /* Write back evicted node. */ + head->flags = JOURNAL_FREE; + lseek(j->fd, JOURNAL_HSIZE + (j->qhead + 1) * node_len, SEEK_SET); + if (!sfwrite(head, node_len, j->fd)) { + return KNOTD_ERROR; + } + + dbg_journal("journal: * evicted node=%u, growing by +%u\n", + j->qhead, head->len); + + /* Write back query state. */ + j->qhead = (j->qhead + 1) % j->max_nodes; + uint16_t qstate[2] = {j->qhead, j->qtail}; + lseek(j->fd, JOURNAL_HSIZE - 2 * sizeof(uint16_t), SEEK_SET); + if (!sfwrite(qstate, 2 * sizeof(uint16_t), j->fd)) { + return KNOTD_ERROR; + } + + /* Increase free segment. */ + j->free.len += head->len; + } + + /* Invalidate node and write back. */ + n->id = id; + n->pos = j->free.pos; + n->len = len; + n->flags = JOURNAL_FREE; + n->next = jnext; + journal_update(j, n); + *rn = n; + return KNOTD_EOK; +} + +int journal_write_out(journal_t *journal, journal_node_t *n) +{ + /* Mark node as valid and write back. */ + uint16_t jnext = n->next; + size_t size = n->len; + const size_t node_len = sizeof(journal_node_t); + n->flags = JOURNAL_VALID | journal->bflags; + n->next = 0; + journal_update(journal, n); + + /* Handle free segment on node rotation. */ + if (journal->qtail > jnext && journal->fslimit == FSLIMIT_INF) { + /* Trim free space. */ + journal->fsize -= journal->free.len; + dbg_journal_verb("journal: * trimmed filesize to %zu\n", + journal->fsize); + + /* Rewind free segment. */ + journal_node_t *n = journal->nodes + jnext; + journal->free.pos = n->pos; + journal->free.len = 0; + + } else { + /* Mark used space. */ + journal->free.pos += size; + journal->free.len -= size; + } + + dbg_journal("journal: finishing node=%u id=%llu flags=0x%x, " + "data=<%u, %u> free=<%u, %u>\n", + journal->qtail, (unsigned long long)n->id, + n->flags, n->pos, n->pos + n->len, + journal->free.pos, + journal->free.pos + journal->free.len); + + /* Write back free segment state. */ + lseek(journal->fd, JOURNAL_HSIZE, SEEK_SET); + if (!sfwrite(&journal->free, node_len, journal->fd)) { + /* Node is marked valid and failed to shrink free space, + * node will be overwritten on the next write. Return error. + */ + dbg_journal("journal: failed to write back " + "free segment descriptor\n"); + return KNOTD_ERROR; + } + + /* Node write successful. */ + journal->qtail = jnext; + + /* Write back queue state, not essential as it may be recovered. + * qhead - lowest valid node identifier (least recent) + * qtail - highest valid node identifier (most recently used) + */ + uint16_t qstate[2] = {journal->qhead, journal->qtail}; + lseek(journal->fd, JOURNAL_HSIZE - 2 * sizeof(uint16_t), SEEK_SET); + if (!sfwrite(qstate, 2 * sizeof(uint16_t), journal->fd)) { + dbg_journal("journal: failed to write back queue state\n"); + return KNOTD_ERROR; + } + + return KNOTD_EOK; +} + +/* Recalculate CRC. */ +int journal_update_crc(int fd) +{ + if (fcntl(fd, F_GETFL) < 0) { + return KNOTD_EINVAL; + } + + char buf[4096]; + ssize_t rb = 0; + crc_t crc = crc_init(); + lseek(fd, MAGIC_LENGTH + sizeof(crc_t), SEEK_SET); + while((rb = read(fd, buf, sizeof(buf))) > 0) { + crc = crc_update(crc, (const unsigned char *)buf, rb); + } + lseek(fd, MAGIC_LENGTH, SEEK_SET); + if (!sfwrite(&crc, sizeof(crc_t), fd)) { + dbg_journal("journal: couldn't write CRC to fd=%d\n", fd); + return KNOTD_ERROR; + } + + return KNOTD_EOK; +} + int journal_create(const char *fn, uint16_t max_nodes) { if (fn == NULL) { @@ -151,7 +325,7 @@ int journal_create(const char *fn, uint16_t max_nodes) int fd = open(fn, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); if (fd < 0) { dbg_journal("journal: failed to create file '%s'\n", fn); - return KNOTD_EINVAL; + return knot_map_errno(errno); } /* Lock. */ @@ -160,13 +334,20 @@ int journal_create(const char *fn, uint16_t max_nodes) /* Create journal header. */ dbg_journal("journal: creating header\n"); - const char magic[MAGIC_LENGTH] = MAGIC_BYTES; + const char magic[MAGIC_LENGTH] = JOURNAL_MAGIC; if (!sfwrite(magic, MAGIC_LENGTH, fd)) { fcntl(fd, F_SETLK, &fl); close(fd); remove(fn); return KNOTD_ERROR; } + crc_t crc = crc_init(); + if (!sfwrite(&crc, sizeof(crc_t), fd)) { + fcntl(fd, F_SETLK, &fl); + close(fd); + remove(fn); + return KNOTD_ERROR; + } if (!sfwrite(&max_nodes, sizeof(uint16_t), fd)) { fcntl(fd, F_SETLK, &fl); close(fd); @@ -222,6 +403,14 @@ int journal_create(const char *fn, uint16_t max_nodes) } } + /* Recalculate CRC. */ + if (journal_update_crc(fd) != KNOTD_EOK) { + fcntl(fd, F_SETLK, &fl); + close(fd); + remove(fn); + return KNOTD_ERROR; + } + /* Unlock and close. */ fcntl(fd, F_SETLK, &fl); close(fd); @@ -241,7 +430,6 @@ journal_t* journal_open(const char *fn, size_t fslimit, int mode, uint16_t bflag /* Open journal file for r/w (returns error if not exists). */ int fd = open(fn, O_RDWR); if (fd < 0) { - dbg_journal("journal: failed to open file '%s'\n", fn); return NULL; } @@ -274,7 +462,7 @@ journal_t* journal_open(const char *fn, size_t fslimit, int mode, uint16_t bflag /* Read magic bytes. */ dbg_journal("journal: reading magic bytes\n"); - const char magic_req[MAGIC_LENGTH] = MAGIC_BYTES; + const char magic_req[MAGIC_LENGTH] = JOURNAL_MAGIC; char magic[MAGIC_LENGTH]; if (!sfread(magic, MAGIC_LENGTH, fd)) { dbg_journal_detail("journal: cannot read magic bytes\n"); @@ -289,6 +477,32 @@ journal_t* journal_open(const char *fn, size_t fslimit, int mode, uint16_t bflag close(fd); return NULL; } + crc_t crc = 0; + if (!sfread(&crc, sizeof(crc_t), fd)) { + dbg_journal_detail("journal: cannot read CRC\n"); + fcntl(fd, F_SETLK, &fl); + close(fd); + return NULL; + } + + /* Recalculate CRC. */ + char buf[4096]; + ssize_t rb = 0; + crc_t crc_calc = crc_init(); + while((rb = read(fd, buf, sizeof(buf))) > 0) { + crc_calc = crc_update(crc_calc, (const unsigned char *)buf, rb); + } + + /* Compare */ + if (crc == crc_calc) { + lseek(fd, MAGIC_LENGTH + sizeof(crc_t), SEEK_SET); /* Rewind. */ + } else { + log_server_warning("Journal file '%s' CRC error, " + "it will be flushed.\n", fn); + fcntl(fd, F_SETLK, &fl); + close(fd); + return NULL; + } /* Check for lazy mode. */ if (mode & JOURNAL_LAZY) { @@ -452,7 +666,9 @@ int journal_fetch(journal_t *journal, uint64_t id, size_t i = jnode_prev(journal, journal->qtail); size_t endp = jnode_prev(journal, journal->qhead); for(; i != endp; i = jnode_prev(journal, i)) { - if (cf(journal->nodes[i].id, id) == 0) { + /* Ignore nodes in uncommited transaction. */ + journal_node_t *n = journal->nodes + i; + if (!(n->flags & JOURNAL_TRANS) && cf(n->id, id) == 0) { *dst = journal->nodes + i; return KNOTD_EOK; } @@ -497,156 +713,111 @@ int journal_read(journal_t *journal, uint64_t id, journal_cmp_t cf, char *dst) int journal_write(journal_t *journal, uint64_t id, const char *src, size_t size) { - if (journal == 0 || src == 0) { + if (journal == NULL || src == NULL) { return KNOTD_EINVAL; } - const size_t node_len = sizeof(journal_node_t); - - /* Find next free node. */ - uint16_t jnext = (journal->qtail + 1) % journal->max_nodes; - - dbg_journal("journal: will write id=%llu, node=%u, size=%zu, fsize=%zu\n", - (unsigned long long)id, journal->qtail, size, journal->fsize); - - /* Calculate remaining bytes to reach file size limit. */ - size_t fs_remaining = journal->fslimit - journal->fsize; - - /* Increase free segment if on the end of file. */ - journal_node_t *n = journal->nodes + journal->qtail; - if (journal->free.pos + journal->free.len == journal->fsize) { - - dbg_journal_verb("journal: * is last node\n"); - - /* Grow journal file until the size limit. */ - if(journal->free.len < size && size <= fs_remaining) { - size_t diff = size - journal->free.len; - dbg_journal("journal: * growing by +%zu, pos=%u, " - "new fsize=%zu\n", - diff, journal->free.pos, - journal->fsize + diff); - journal->fsize += diff; /* Appending increases file size. */ - journal->free.len += diff; - - } + /* Prepare journal write. */ + journal_node_t *n = NULL; + int ret = journal_write_in(journal, &n, id, size); + if (ret != KNOTD_EOK) { + return ret; + } - /* Rewind if resize is needed, but the limit is reached. */ - if(journal->free.len < size && size > fs_remaining) { - journal_node_t *head = journal->nodes + journal->qhead; - journal->fsize = journal->free.pos; - journal->free.pos = head->pos; - journal->free.len = 0; - dbg_journal_verb("journal: * fslimit reached, " - "rewinding to %u\n", - head->pos); - dbg_journal_verb("journal: * file size trimmed to %zu\n", - journal->fsize); - } + /* Write data to permanent storage. */ + lseek(journal->fd, n->pos, SEEK_SET); + if (!sfwrite(src, size, journal->fd)) { + return KNOTD_ERROR; } - /* Evict occupied nodes if necessary. */ - while (journal->free.len < size || - journal->nodes[jnext].flags > JOURNAL_FREE) { - - /* Evict least recent node if not empty. */ - journal_node_t *head = journal->nodes + journal->qhead; + /* Finalize journal write. */ + return journal_write_out(journal, n); +} - /* Check if it has been synced to disk. */ - if (head->flags & JOURNAL_DIRTY) { - return KNOTD_EAGAIN; - } +int journal_map(journal_t *journal, uint64_t id, char **dst, size_t size) +{ + if (journal == NULL || dst == NULL) { + return KNOTD_EINVAL; + } + + /* Prepare journal write. */ + journal_node_t *n = NULL; + int ret = journal_write_in(journal, &n, id, size); + if (ret != KNOTD_EOK) { + return ret; + } - /* Write back evicted node. */ - head->flags = JOURNAL_FREE; - lseek(journal->fd, JOURNAL_HSIZE + (journal->qhead + 1) * node_len, SEEK_SET); - if (!sfwrite(head, node_len, journal->fd)) { - return KNOTD_ERROR; + /* Reserve data in permanent storage. */ + /*! \todo This is only needed when inflating journal file. */ + lseek(journal->fd, n->pos, SEEK_SET); + char nbuf[4096] = {0}; + size_t wb = sizeof(nbuf); + while (size > 0) { + if (size < sizeof(nbuf)) { + wb = size; } - - dbg_journal("journal: * evicted node=%u, growing by +%u\n", - journal->qhead, head->len); - - /* Write back query state. */ - journal->qhead = (journal->qhead + 1) % journal->max_nodes; - uint16_t qstate[2] = {journal->qhead, journal->qtail}; - lseek(journal->fd, JOURNAL_HSIZE - 2 * sizeof(uint16_t), SEEK_SET); - if (!sfwrite(qstate, 2 * sizeof(uint16_t), journal->fd)) { + if (!sfwrite(nbuf, wb, journal->fd)) { return KNOTD_ERROR; } - - /* Increase free segment. */ - journal->free.len += head->len; + size -= wb; } - - /* Invalidate node and write back. */ - n->id = id; - n->pos = journal->free.pos; - n->len = size; - n->flags = JOURNAL_FREE; - journal_update(journal, n); - - /* Write data to permanent storage. */ - lseek(journal->fd, n->pos, SEEK_SET); - if (!sfwrite(src, size, journal->fd)) { + + /* Align offset to page size (required). */ + const size_t ps = sysconf(_SC_PAGESIZE); + off_t ps_delta = (n->pos % ps); + off_t off = n->pos - ps_delta; + + /* Map file region. */ + *dst = mmap(NULL, n->len + ps_delta, PROT_READ | PROT_WRITE, MAP_SHARED, + journal->fd, off); + if (*dst == ((void*)-1)) { + dbg_journal("journal: couldn't mmap() fd=%d <%u,%u> %d\n", + journal->fd, n->pos, n->pos+n->len, errno); return KNOTD_ERROR; } + + /* Advise usage of memory. */ +#ifdef HAVE_MADVISE + madvise(*dst, n->len + ps_delta, MADV_SEQUENTIAL); +#endif + /* Correct dst pointer to alignment. */ + *dst += ps_delta; + + return KNOTD_EOK; +} - /* Mark node as valid and write back. */ - n->flags = JOURNAL_VALID | journal->bflags; - journal_update(journal, n); - - /* Handle free segment on node rotation. */ - if (journal->qtail > jnext && journal->fslimit == FSLIMIT_INF) { - /* Trim free space. */ - journal->fsize -= journal->free.len; - dbg_journal_verb("journal: * trimmed filesize to %zu\n", - journal->fsize); - - /* Rewind free segment. */ - journal_node_t *n = journal->nodes + jnext; - journal->free.pos = n->pos; - journal->free.len = 0; - - } else { - /* Mark used space. */ - journal->free.pos += size; - journal->free.len -= size; +int journal_unmap(journal_t *journal, uint64_t id, void *ptr, int finalize) +{ + if (journal == NULL || ptr == NULL) { + return KNOTD_EINVAL; } - dbg_journal("journal: finished node=%u, data=<%u, %u> free=<%u, %u>\n", - journal->qtail, n->pos, n->pos + n->len, - journal->free.pos, - journal->free.pos + journal->free.len); - - /* Write back free segment state. */ - lseek(journal->fd, JOURNAL_HSIZE, SEEK_SET); - if (!sfwrite(&journal->free, node_len, journal->fd)) { - /* Node is marked valid and failed to shrink free space, - * node will be overwritten on the next write. Return error. - */ - dbg_journal("journal: failed to write back " - "free segment descriptor\n"); - return KNOTD_ERROR; + + /* Mapped node is on tail. */ + journal_node_t *n = journal->nodes + journal->qtail; + if(n->id != id) { + dbg_journal("journal: failed to find mmap node with id=%llu\n", + (unsigned long long)id); + return KNOTD_ENOENT; } - /* Node write successful. */ - journal->qtail = jnext; - - /* Write back queue state, not essential as it may be recovered. - * qhead - lowest valid node identifier (least recent) - * qtail - highest valid node identifier (most recently used) - */ - uint16_t qstate[2] = {journal->qhead, journal->qtail}; - lseek(journal->fd, JOURNAL_HSIZE - 2 * sizeof(uint16_t), SEEK_SET); - if (!sfwrite(qstate, 2 * sizeof(uint16_t), journal->fd)) { - dbg_journal("journal: failed to write back queue state\n"); + /* Realign memory. */ + const size_t ps = sysconf(_SC_PAGESIZE); + off_t ps_delta = (n->pos % ps); + ptr = ((char*)ptr - ps_delta); + + /* Unmap memory. */ + if (munmap(ptr, n->len + ps_delta) != 0) { + dbg_journal("journal: couldn't munmap() fd=%d <%u,%u> %d\n", + journal->fd, n->pos, n->pos+n->len, errno); return KNOTD_ERROR; } - - /*! \todo Delayed write-back? (issue #964) */ - dbg_journal_verb("journal: write of finished, nqueue=<%u, %u>\n", - journal->qhead, journal->qtail); - - return KNOTD_EOK; + + /* Finalize. */ + int ret = KNOTD_EOK; + if (finalize) { + ret = journal_write_out(journal, n); + } + return ret; } int journal_walk(journal_t *journal, journal_apply_t apply) @@ -677,8 +848,8 @@ int journal_update(journal_t *journal, journal_node_t *n) /* Calculate node position in permanent storage. */ long jn_fpos = JOURNAL_HSIZE + (i + 1) * node_len; - dbg_journal("journal: syncing journal node=%zu at %ld\n", - i, jn_fpos); + dbg_journal("journal: syncing journal node=%zu id=%llu flags=0x%x\n", + i, (unsigned long long)n->id, n->flags); /* Write back. */ lseek(journal->fd, jn_fpos, SEEK_SET); @@ -691,6 +862,82 @@ int journal_update(journal_t *journal, journal_node_t *n) return KNOTD_EOK; } +int journal_trans_begin(journal_t *journal) +{ + if (journal == NULL) { + return KNOTD_EINVAL; + } + + /* Already pending transactions. */ + if (journal->bflags & JOURNAL_TRANS) { + return KNOTD_EBUSY; + } + + journal->bflags |= JOURNAL_TRANS; + journal->tmark = journal->qtail; + dbg_journal("journal: starting transaction at qtail=%hu\n", + journal->tmark); + + return KNOTD_EOK; +} + +int journal_trans_commit(journal_t *journal) +{ + if (journal == NULL) { + return KNOTD_EINVAL; + } + if ((journal->bflags & JOURNAL_TRANS) == 0) { + return KNOTD_ENOENT; + } + + /* Mark affected nodes as commited. */ + int ret = KNOTD_EOK; + size_t i = journal->tmark; + for(; i != journal->qtail; i = (i + 1) % journal->max_nodes) { + journal->nodes[i].flags &= (~JOURNAL_TRANS); + ret = journal_update(journal, journal->nodes + i); + if (ret != KNOTD_EOK) { + dbg_journal("journal: failed to clear TRANS flag from " + "node %zu\n", i); + return ret; + } + } + + /* Clear in-transaction flags. */ + journal->tmark = 0; + journal->bflags &= (~JOURNAL_TRANS); + return KNOTD_EOK; +} + +int journal_trans_rollback(journal_t *journal) +{ + if (journal == NULL) { + return KNOTD_EINVAL; + } + if ((journal->bflags & JOURNAL_TRANS) == 0) { + return KNOTD_ENOENT; + } + + /* Expand free space and rewind node queue tail. */ + /*! \note This shouldn't be relied upon and probably shouldn't + * be written back to file, as crashing anywhere between + * transaction begin and rollback would result in corrupted + * journal. Also write function should recognize TRANS nodes. + */ + //journal->free.pos = journal->nodes[journal->tmark].pos; + //journal->free.len = 0; + + dbg_journal("journal: rollback transaction id=<%hu,%hu>\n", + journal->tmark, journal->qtail); + //journal->qtail = journal->tmark; + + /* Clear in-transaction flags. */ + journal->tmark = 0; + journal->bflags &= (~JOURNAL_TRANS); + + return KNOTD_EOK; +} + int journal_close(journal_t *journal) { /* Check journal. */ @@ -699,9 +946,13 @@ int journal_close(journal_t *journal) } /* Check if lazy. */ + int ret = KNOTD_EOK; if (journal->fd < 0) { free(journal->path); } else { + /* Recalculate CRC. */ + ret = journal_update_crc(journal->fd); + /* Unlock journal file. */ journal->fl.l_type = F_UNLCK; fcntl(journal->fd, F_SETLK, &journal->fl); @@ -714,10 +965,9 @@ int journal_close(journal_t *journal) dbg_journal("journal: closed journal %p\n", journal); /* Free allocated resources. */ - free(journal); - return KNOTD_EOK; + return ret; } journal_t *journal_retain(journal_t *journal) diff --git a/src/knot/server/journal.h b/src/knot/server/journal.h index b12bfc9..d874996 100644 --- a/src/knot/server/journal.h +++ b/src/knot/server/journal.h @@ -43,7 +43,6 @@ #include <stdint.h> #include <fcntl.h> -#include "knot/zone/zone-dump.h" /*! * \brief Journal entry flags. @@ -52,7 +51,8 @@ typedef enum journal_flag_t { JOURNAL_NULL = 0 << 0, /*!< Invalid journal entry. */ JOURNAL_FREE = 1 << 0, /*!< Free journal entry. */ JOURNAL_VALID = 1 << 1, /*!< Valid journal entry. */ - JOURNAL_DIRTY = 1 << 2 /*!< Journal entry cannot be evicted. */ + JOURNAL_DIRTY = 1 << 2, /*!< Journal entry cannot be evicted. */ + JOURNAL_TRANS = 1 << 3 /*!< Entry is in transaction (uncommited). */ } journal_flag_t; /*! @@ -73,6 +73,7 @@ typedef struct journal_node_t { uint64_t id; /*!< Node ID. */ uint16_t flags; /*!< Node flags. */ + uint16_t next; /*!< Next node ptr. */ uint32_t pos; /*!< Position in journal file. */ uint32_t len; /*!< Entry data length. */ } journal_node_t; @@ -94,6 +95,7 @@ typedef struct journal_t struct flock fl; /*!< File lock. */ char *path; /*!< Path to journal file. */ int refs; /*!< Number of references. */ + uint16_t tmark; /*!< Transaction start mark. */ uint16_t max_nodes; /*!< Number of nodes. */ uint16_t qhead; /*!< Node queue head. */ uint16_t qtail; /*!< Node queue tail. */ @@ -125,7 +127,9 @@ typedef int (*journal_apply_t)(journal_t *j, journal_node_t *n); * Journal defaults and constants. */ #define JOURNAL_NCOUNT 1024 /*!< Default node count. */ -#define JOURNAL_HSIZE (MAGIC_LENGTH + sizeof(uint16_t) * 3) /*!< magic, max_entries, qhead, qtail */ +/* HEADER = magic, crc, max_entries, qhead, qtail */ +#define JOURNAL_HSIZE (MAGIC_LENGTH + sizeof(crc_t) + sizeof(uint16_t) * 3) +#define JOURNAL_MAGIC {'k', 'n', 'o', 't', '1', '0', '2'} /*! * \brief Create new journal. @@ -195,6 +199,36 @@ int journal_read(journal_t *journal, uint64_t id, journal_cmp_t cf, char *dst); int journal_write(journal_t *journal, uint64_t id, const char *src, size_t size); /*! + * \brief Map journal entry for read/write. + * + * \warning New nodes shouldn't be created until the entry is unmapped. + * + * \param journal Associated journal. + * \param id Entry identifier. + * \param dst Will contain mapped memory. + * + * \retval KNOTD_EOK if successful. + * \retval KNOTD_EAGAIN if no free node is available, need to remove dirty nodes. + * \retval KNOTD_ERROR on I/O error. + */ +int journal_map(journal_t *journal, uint64_t id, char **dst, size_t size); + +/*! + * \brief Finalize mapped journal entry. + * + * \param journal Associated journal. + * \param id Entry identifier. + * \param ptr Mapped memory. + * \param finalize Set to true to finalize node or False to discard it. + * + * \retval KNOTD_EOK if successful. + * \retval KNOTD_ENOENT if the entry cannot be found. + * \retval KNOTD_EAGAIN if no free node is available, need to remove dirty nodes. + * \retval KNOTD_ERROR on I/O error. + */ +int journal_unmap(journal_t *journal, uint64_t id, void *ptr, int finalize); + +/*! * \brief Return least recent node (journal head). * * \param journal Associated journal. @@ -243,6 +277,45 @@ int journal_walk(journal_t *journal, journal_apply_t apply); int journal_update(journal_t *journal, journal_node_t *n); /*! + * \brief Begin transaction of multiple entries. + * + * \note Only one transaction at a time is supported. + * + * \param journal Associated journal. + * + * \retval KNOTD_EOK on success. + * \retval KNOTD_EINVAL on invalid parameters. + * \retval KNOTD_EBUSY if transaction is already pending. + */ +int journal_trans_begin(journal_t *journal); + +/*! + * \brief Commit pending transaction. + * + * \note Only one transaction at a time is supported. + * + * \param journal Associated journal. + * + * \retval KNOTD_EOK on success. + * \retval KNOTD_EINVAL on invalid parameters. + * \retval KNOTD_ENOENT if no transaction is pending. + */ +int journal_trans_commit(journal_t *journal); + +/*! + * \brief Rollback pending transaction. + * + * \note Only one transaction at a time is supported. + * + * \param journal Associated journal. + * + * \retval KNOTD_EOK on success. + * \retval KNOTD_EINVAL on invalid parameters. + * \retval KNOTD_ENOENT if no transaction is pending. + */ +int journal_trans_rollback(journal_t *journal); + +/*! * \brief Close journal file. * * \param journal Associated journal. @@ -270,4 +343,19 @@ journal_t *journal_retain(journal_t *journal); */ void journal_release(journal_t *journal); +/*! + * \brief Recompute journal CRC. + * + * \warning Use only if you altered the journal file somehow + * and need it to pass CRC checks. CRC check normally + * checks file integrity, so you should not touch it unless + * you know what you're doing. + * + * \param fd Open journal file. + * + * \retval KNOTD_EOK on success. + * \retval KNOTD_EINVAL if not valid fd. + */ +int journal_update_crc(int fd); + #endif /* _KNOTD_JOURNAL_H_ */ diff --git a/src/knot/server/notify.c b/src/knot/server/notify.c index 566d66f..d12247b 100644 --- a/src/knot/server/notify.c +++ b/src/knot/server/notify.c @@ -193,7 +193,7 @@ static int notify_check_and_schedule(knot_nameserver_t *nameserver, char straddr[SOCKADDR_STRLEN]; sockaddr_tostr(from, straddr, sizeof(straddr)); log_zone_notice("Unauthorized NOTIFY query " - "from %s:%d to zone '%s'.\n", + "from '%s@%d' to zone '%s'.\n", straddr, sockaddr_portnum(from), zd->conf->name); return KNOT_ERROR; diff --git a/src/knot/server/server.c b/src/knot/server/server.c index ceab716..ba7ccd7 100644 --- a/src/knot/server/server.c +++ b/src/knot/server/server.c @@ -759,7 +759,7 @@ int server_conf_hook(const struct conf_t *conf, void *data) h->state = ServerRunning; ret = dt_start(h->unit); if (ret < 0) { - log_server_error("Handler for %s:%d " + log_server_error("Handler for '%s@%d' " "has failed to start.\n", h->iface->addr, h->iface->port); diff --git a/src/knot/server/tcp-handler.c b/src/knot/server/tcp-handler.c index a59ba7c..e53e286 100644 --- a/src/knot/server/tcp-handler.c +++ b/src/knot/server/tcp-handler.c @@ -53,7 +53,7 @@ typedef struct tcp_worker_t { /* * Forward decls. */ -#define TCP_THROTTLE_LO 10 /*!< Minimum recovery time on errors. */ +#define TCP_THROTTLE_LO 5 /*!< Minimum recovery time on errors. */ #define TCP_THROTTLE_HI 50 /*!< Maximum recovery time on errors. */ /*! \brief Calculate TCP throttle time (random). */ @@ -119,7 +119,7 @@ static void tcp_sweep(fdset_t *set, int fd, void* data) #endif } - log_server_notice("Connection with %s:%d was terminated due to " + log_server_notice("Connection with '%s@%d' was terminated due to " "inactivity.\n", r_addr, r_port); fdset_remove(set, fd); close(fd); @@ -164,9 +164,9 @@ static int tcp_handle(tcp_worker_t *w, int fd, uint8_t *qbuf, size_t qbuf_maxlen char r_addr[SOCKADDR_STRLEN]; sockaddr_tostr(&addr, r_addr, sizeof(r_addr)); int r_port = sockaddr_portnum(&addr); - log_server_warning("Couldn't receive query from %s:%d " - "within the time limit %ds.\n", - r_addr, r_port, TCP_ACTIVITY_WD); + log_server_warning("Couldn't receive query from '%s@%d'" + " within the time limit of %ds.\n", + r_addr, r_port, TCP_ACTIVITY_WD); } return KNOTD_ECONNREFUSED; } @@ -290,7 +290,6 @@ static int tcp_accept(int fd) /* Evaluate connection. */ if (incoming < 0) { int en = errno; - /*! \todo Better solution so it doesn't block current connections (issue #1542). */ if (en != EINTR) { log_server_error("Cannot accept connection " "(%d).\n", errno); diff --git a/src/knot/server/udp-handler.c b/src/knot/server/udp-handler.c index 6e50926..73c557d 100644 --- a/src/knot/server/udp-handler.c +++ b/src/knot/server/udp-handler.c @@ -72,7 +72,7 @@ int udp_handle(int fd, uint8_t *qbuf, size_t qbuflen, size_t *resp_len, #ifdef DEBUG_ENABLE_BRIEF char strfrom[SOCKADDR_STRLEN]; sockaddr_tostr(addr, strfrom, sizeof(strfrom)); - dbg_net("udp: fd=%d received %zd bytes from %s:%d.\n", fd, qbuflen, + dbg_net("udp: fd=%d received %zd bytes from '%s@%d'.\n", fd, qbuflen, strfrom, sockaddr_portnum(addr)); #endif @@ -458,8 +458,8 @@ void __attribute__ ((constructor)) udp_master_init() } /* Check for sendmmsg() support. */ -#ifdef ENABLE_SENDMMSG _send_mmsg = udp_sendto; +#ifdef ENABLE_SENDMMSG sendmmsg(0, 0, 0, 0); /* Just check if syscall exists */ if (errno != ENOSYS) { _send_mmsg = udp_sendmmsg; diff --git a/src/knot/server/xfr-handler.c b/src/knot/server/xfr-handler.c index 3a1b7da..8e6d6ca 100644 --- a/src/knot/server/xfr-handler.c +++ b/src/knot/server/xfr-handler.c @@ -46,6 +46,7 @@ #define XFR_SWEEP_INTERVAL 2 /*! [seconds] between sweeps. */ #define XFR_BUFFER_SIZE 65535 /*! Do not change this - maximum value for UDP packet length. */ +/*! \brief Send interrupt to all workers. */ void xfr_interrupt(xfrhandler_t *h) { for(unsigned i = 0; i < h->unit->size; ++i) { @@ -53,6 +54,7 @@ void xfr_interrupt(xfrhandler_t *h) } } +/*! \brief Deinitialize allocated values from xfer descriptor. */ static void xfr_request_deinit(knot_ns_xfr_t *r) { if (r) { @@ -61,7 +63,7 @@ static void xfr_request_deinit(knot_ns_xfr_t *r) } } -/*! \todo Document me (issue #1586) */ +/*! \brief Free allocated xfer descriptor (also deinitializes). */ static void xfr_free_task(knot_ns_xfr_t *task) { if (!task) { @@ -89,20 +91,29 @@ static void xfr_free_task(knot_ns_xfr_t *task) pthread_mutex_unlock(&zd->xfr_in.lock); } } - - /* Remove fd-related data. */ - xfrhandler_t *h = w->master; - pthread_mutex_lock(&h->tasks_mx); - skip_remove(h->tasks, (void*)((size_t)task->session), 0, 0); - pthread_mutex_unlock(&h->tasks_mx); /* Deinitialize */ xfr_request_deinit(task); - - close(task->session); + if (!task->session_closed) { + /* Remove fd-related data. */ + xfrhandler_t *h = w->master; + pthread_mutex_lock(&h->tasks_mx); + skip_remove(h->tasks, (void*)((size_t)task->session), 0, 0); + pthread_mutex_unlock(&h->tasks_mx); + close(task->session); + } free(task); } +/*! + * \brief Return xfer descriptor associated with given fd. + * + * \param w Current worker. + * \param fd Requested descriptor. + * + * \retval xfer descriptor if found. + * \retval NULL if no descriptor found. + */ static knot_ns_xfr_t *xfr_handler_task(xfrworker_t *w, int fd) { xfrhandler_t *h = w->master; @@ -157,8 +168,8 @@ static int xfr_process_udp_resp(xfrworker_t *w, int fd, knot_ns_xfr_t *data) udp_handle(fd, data->wire, n, &resp_len, &data->addr, w->ns); } - xfr_free_task(data); - return KNOTD_EOK; + /* Invalidate pending query. */ + return KNOTD_ECONNREFUSED; } /*! \brief Sweep non-replied connection. */ @@ -188,8 +199,18 @@ static void xfr_sweep(fdset_t *set, int fd, void *data) } } -/*! \todo Document me (issue #1586) */ -static knot_ns_xfr_t *xfr_register_task(xfrworker_t *w, knot_ns_xfr_t *req) +/*! + * \brief Register task in given worker. + * + * \warning Must be freed with xfr_free_task() when finished. + * + * \param w Given worker. + * \param req Pointer to template xfer descriptor. + * + * \retval Newly allocated xfer descriptor if success. + * \retval NULL on error. + */ +static knot_ns_xfr_t *xfr_register_task(xfrworker_t *w, const knot_ns_xfr_t *req) { knot_ns_xfr_t *t = malloc(sizeof(knot_ns_xfr_t)); if (!t) { @@ -279,19 +300,12 @@ static int xfr_xfrin_cleanup(xfrworker_t *w, knot_ns_xfr_t *data) */ static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data) { - /* CLEANUP */ -// // get the zone name from Question -// dbg_xfr_verb("Query: %p, response: %p\n", data->query, data->response); -// const knot_dname_t *qname = knot_packet_qname(data->query); -// char *zorigin = "(unknown)"; -// if (qname != NULL) { -// zorigin = knot_dname_to_str(qname); -// } - + int ret = KNOTD_EOK; int apply_ret = KNOT_EOK; int switch_ret = KNOT_EOK; knot_changesets_t *chs = NULL; + journal_t *transaction = NULL; switch(data->type) { case XFR_TYPE_AIN: @@ -319,15 +333,21 @@ static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data) case XFR_TYPE_IIN: chs = (knot_changesets_t *)data->data; - /* First, serialize changesets. */ - ret = zones_changesets_to_binary(chs); + /* Serialize and store changesets. */ + dbg_xfr("xfr: IXFR/IN serializing and saving changesets\n"); + transaction = zones_store_changesets_begin(data); + if (transaction != NULL) { + ret = zones_store_changesets(data); + } else { + ret = KNOTD_ERROR; + } if (ret != KNOTD_EOK) { - log_zone_error("%s Failed to serialize changesets - %s" - "\n", data->msgpref, + log_zone_error("%s Failed to serialize and store " + "changesets - %s\n", data->msgpref, knotd_strerror(ret)); /* Free changesets, but not the data. */ knot_free_changesets(&chs); - data->data = 0; + data->data = NULL; break; } @@ -336,40 +356,30 @@ static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data) &data->new_contents); if (apply_ret != KNOT_EOK) { + zones_store_changesets_rollback(transaction); log_zone_error("%s Failed to apply changesets - %s\n", data->msgpref, knot_strerror(apply_ret)); /* Free changesets, but not the data. */ knot_free_changesets(&chs); - data->data = 0; + data->data = NULL; ret = KNOTD_ERROR; break; } - /* Save changesets. */ - dbg_xfr("xfr: IXFR/IN saving changesets\n"); - - /*! \note Here, the changesets may already be modified. - * Only the 'data' field of each changeset contains the - * proper serialized changesets. Serials should be - * OK too. - */ - ret = zones_store_changesets(data); + /* Commit transaction. */ + ret = zones_store_changesets_commit(transaction); if (ret != KNOTD_EOK) { - log_zone_error("%s Failed to save " - "transferred changesets - %s\n", - data->msgpref, knotd_strerror(ret)); - - // Cleanup old and new contents - xfrin_rollback_update(data->zone->contents, - &data->new_contents, - &chs->changes); - /* Free changesets, but not the data. */ + log_zone_error("%s Failed to commit stored changesets " + "- %s\n", + data->msgpref, + knot_strerror(apply_ret)); knot_free_changesets(&chs); - data->data = 0; + data->data = NULL; break; } + /* Switch zone contents. */ switch_ret = xfrin_switch_zone(data->zone, data->new_contents, data->type); @@ -386,7 +396,7 @@ static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data) /* Free changesets, but not the data. */ knot_free_changesets(&chs); - data->data = 0; + data->data = NULL; ret = KNOTD_ERROR; break; } @@ -395,7 +405,7 @@ static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data) /* Free changesets, but not the data. */ knot_free_changesets(&chs); - data->data = 0; + data->data = NULL; assert(ret == KNOTD_EOK); log_zone_info("%s Finished.\n", data->msgpref); break; @@ -404,11 +414,6 @@ static int xfr_xfrin_finalize(xfrworker_t *w, knot_ns_xfr_t *data) break; } - /* CLEANUP */ -// if (qname != NULL) { -// free(zorigin); -// } - return ret; } @@ -661,11 +666,20 @@ int xfr_process_event(xfrworker_t *w, int fd, knot_ns_xfr_t *data, uint8_t *buf, data->msgpref, knot_strerror(ret)); } - /* Check finished zone. */ int result = KNOTD_EOK; if (xfer_finished) { + /* Close early to free up fd for storing zone. */ + data->session_closed = 1; + close(data->session); + + /* Remove fd-related data. */ + xfrhandler_t *h = w->master; + pthread_mutex_lock(&h->tasks_mx); + skip_remove(h->tasks, (void*)((size_t)data->session), 0, 0); + pthread_mutex_unlock(&h->tasks_mx); + knot_zone_t *zone = (knot_zone_t *)data->zone; zonedata_t *zd = (zonedata_t *)knot_zone_data(zone); @@ -714,7 +728,14 @@ int xfr_process_event(xfrworker_t *w, int fd, knot_ns_xfr_t *data, uint8_t *buf, return result; } -/*! \todo Document me (issue #1586) +/*! + * \brief Start incoming transfer (applicable to AXFR/IN or IXFR/IN). + * + * \warning xfer descriptor will be registered if successful. + * \warning data->fd will be duplicated if successful. + * + * \param w Given worker. + * \param data xfer descriptor. */ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data) { @@ -759,32 +780,20 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data) /* Presume port is already preset. */ ret = bind(fd, data->saddr.ptr, data->saddr.len); } + if (ret < 0) { + log_server_warning("%s Failed to create socket.\n", + data->msgpref); + } else { + ret = connect(fd, data->addr.ptr, data->addr.len); + } } else { - pthread_mutex_unlock(&zd->xfr_in.lock); - log_server_warning("%s Failed to create socket " - "(type=%s, family=%s).\n", - "SOCK_STREAM", - data->msgpref, - data->addr.family == AF_INET ? - "AF_INET" : "AF_INET6"); - return KNOTD_ERROR; + ret = -1; } - ret = connect(fd, data->addr.ptr, data->addr.len); if (ret < 0) { pthread_mutex_unlock(&zd->xfr_in.lock); - if (!knot_zone_contents(zone)) { - /* Reschedule request (120 - 240s random delay). */ - int tmr_s = AXFR_BOOTSTRAP_RETRY * 2; /* Malus x2 */ - tmr_s += (int)((120.0 * 1000) * tls_rand()); - event_t *ev = zd->xfr_in.timer; - if (ev) { - evsched_cancel(ev->parent, ev); - evsched_schedule(ev->parent, ev, tmr_s); - } - log_zone_notice("%s Bootstrap failed, next " - "attempt in %d seconds.\n", - data->msgpref, tmr_s / 1000); + if (fd >= 0) { + close(fd); } return KNOTD_ECONNREFUSED; } @@ -794,6 +803,12 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data) } else { /* Duplicate existing socket descriptor. */ data->session = dup(data->session); + if (data->session < 0) { + pthread_mutex_unlock(&zd->xfr_in.lock); + log_server_warning("Not enough memory to duplicate \n" + "sockets.\n"); + return KNOTD_ENOMEM; + } } /* Fetch zone contents. */ @@ -804,6 +819,8 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data) rcu_read_unlock(); log_server_warning("%s Refusing to start IXFR/IN on zone with no " "contents.\n", data->msgpref); + close(data->session); + data->session = -1; return KNOTD_EINVAL; } @@ -842,8 +859,10 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data) /* Handle errors. */ if (ret != KNOT_EOK) { pthread_mutex_unlock(&zd->xfr_in.lock); - fprintf(stderr, "xfr: failed to create XFR query type %d: %s\n", + dbg_xfr("xfr: failed to create XFR query type %d: %s\n", data->type, knot_strerror(ret)); + close(data->session); + data->session = -1; return KNOTD_ERROR; } @@ -858,30 +877,39 @@ static int xfr_client_start(xfrworker_t *w, knot_ns_xfr_t *data) log_server_info("%s Failed to send query (%s).\n", data->msgpref, buf); pthread_mutex_unlock(&zd->xfr_in.lock); + close(data->session); + data->session = -1; return KNOTD_ECONNREFUSED; } /* Add to pending transfers. */ - knot_ns_xfr_t *task = xfr_register_task(w, data); + knot_ns_xfr_t *task = xfr_register_task(w, data); + if (task == NULL) { + log_server_warning("%s Couldn't start connection.\n", + data->msgpref); + close(data->session); + data->session = -1; + return KNOTD_ERROR; + } /* Send XFR query. */ - log_server_info("%s Started.\n", task->msgpref); + log_server_info("%s Started.\n", data->msgpref); return KNOTD_EOK; } +/*! + * \brief Compare file descriptors. + * + * \note Return values of {-1,0,1} are required by skip-list structure. + */ static int xfr_fd_compare(void *k1, void *k2) { - if (k1 < k2) { - return -1; - } - - if (k1 > k2) { - return 1; - } - + if (k1 > k2) return 1; + if (k1 < k2) return -1; return 0; } +/*! \brief Return I/A character depending on xfer type. */ static inline char xfr_strtype(knot_ns_xfr_t *xfr) { if (xfr->type == XFR_TYPE_IOUT) { return 'I'; @@ -890,6 +918,7 @@ static inline char xfr_strtype(knot_ns_xfr_t *xfr) { } } +/*! \brief Wrapper function for answering AXFR/OUT. */ static int xfr_answer_axfr(knot_nameserver_t *ns, knot_ns_xfr_t *xfr) { int ret = knot_ns_answer_axfr(ns, xfr); @@ -897,22 +926,21 @@ static int xfr_answer_axfr(knot_nameserver_t *ns, knot_ns_xfr_t *xfr) return ret; } +/*! \brief Wrapper function for answering IXFR/OUT. */ static int xfr_answer_ixfr(knot_nameserver_t *ns, knot_ns_xfr_t *xfr) { /* Check serial differeces. */ int ret = KNOT_EOK; uint32_t serial_from = 0; uint32_t serial_to = 0; - dbg_xfr_verb("Loading serials for IXFR.\n"); ret = ns_ixfr_load_serials(xfr, &serial_from, &serial_to); - dbg_xfr_detail("Loaded serials: from: %u, to: %u\n", - serial_from, serial_to); + dbg_xfr_verb("xfr: loading changesets for IXFR %u-%u\n", + serial_from, serial_to); if (ret != KNOT_EOK) { return ret; } /* Load changesets from journal. */ - dbg_xfr_verb("Loading changesets from journal.\n"); int chsload = zones_xfr_load_changesets(xfr, serial_from, serial_to); if (chsload != KNOTD_EOK) { /* History cannot be reconstructed, fallback to AXFR. */ @@ -943,6 +971,7 @@ static int xfr_answer_ixfr(knot_nameserver_t *ns, knot_ns_xfr_t *xfr) return ret; } +/*! \brief Build string for logging related to given xfer descriptor. */ static int xfr_update_msgpref(knot_ns_xfr_t *req, const char *keytag) { /* Check */ @@ -990,22 +1019,22 @@ static int xfr_update_msgpref(knot_ns_xfr_t *req, const char *keytag) const char *pformat = NULL; switch (req->type) { case XFR_TYPE_AIN: - pformat = "AXFR transfer of '%s/IN' with %s:%d%s:"; + pformat = "AXFR transfer of '%s/IN' with '%s@%d'%s:"; break; case XFR_TYPE_IIN: - pformat = "IXFR transfer of '%s/IN' with %s:%d%s:"; + pformat = "IXFR transfer of '%s/IN' with '%s@%d'%s:"; break; case XFR_TYPE_AOUT: - pformat = "AXFR transfer of '%s/OUT' to %s:%d%s:"; + pformat = "AXFR transfer of '%s/OUT' to '%s@%d'%s:"; break; case XFR_TYPE_IOUT: - pformat = "IXFR transfer of '%s/OUT' to %s:%d%s:"; + pformat = "IXFR transfer of '%s/OUT' to '%s@%d'%s:"; break; case XFR_TYPE_NOTIFY: - pformat = "NOTIFY query of '%s' to %s:%d%s:"; + pformat = "NOTIFY query of '%s' to '%s@%d'%s:"; break; case XFR_TYPE_SOA: - pformat = "SOA query of '%s' to %s:%d%s:"; + pformat = "SOA query of '%s' to '%s@%d'%s:"; break; default: pformat = ""; @@ -1032,10 +1061,7 @@ static int xfr_update_msgpref(knot_ns_xfr_t *req, const char *keytag) return KNOTD_EOK; } -/* - * Public APIs. - */ - +/*! \brief Create XFR worker. */ static xfrworker_t* xfr_worker_create(xfrhandler_t *h, knot_nameserver_t *ns) { xfrworker_t *w = malloc(sizeof(xfrworker_t)); @@ -1068,6 +1094,7 @@ static xfrworker_t* xfr_worker_create(xfrhandler_t *h, knot_nameserver_t *ns) return w; } +/*! \brief Free created XFR worker. */ static void xfr_worker_free(xfrworker_t *w) { if (w) { evqueue_free(&w->q); @@ -1076,6 +1103,10 @@ static void xfr_worker_free(xfrworker_t *w) { } } +/* + * Public APIs. + */ + xfrhandler_t *xfr_create(size_t thrcount, knot_nameserver_t *ns) { /* Create XFR handler data. */ @@ -1243,7 +1274,6 @@ int xfr_answer(knot_nameserver_t *ns, knot_ns_xfr_t *xfr) // use the QNAME as the zone name to get names also for // zones that are not in the server - /*! \todo Update msgpref with zname from query. */ const knot_dname_t *qname = knot_packet_qname(xfr->query); if (qname != NULL) { xfr->zname = knot_dname_to_str(qname); @@ -1348,7 +1378,13 @@ static int xfr_process_request(xfrworker_t *w, uint8_t *buf, size_t buflen) /* Update XFR message prefix. */ xfr_update_msgpref(&xfr, NULL); - + + /* Check if not already processing. */ + zonedata_t *zd = NULL; + if (xfr.zone != NULL) { + zd = (zonedata_t *)knot_zone_data(xfr.zone); + } + conf_read_lock(); /* Handle request. */ @@ -1362,8 +1398,22 @@ static int xfr_process_request(xfrworker_t *w, uint8_t *buf, size_t buflen) /* Report. */ if (ret != KNOTD_EOK && ret != KNOTD_EACCES) { - log_server_error("%s %s\n", - xfr.msgpref, knotd_strerror(ret)); + if (zd != NULL && !knot_zone_contents(xfr.zone)) { + /* Reschedule request (120 - 240s random delay). */ + int tmr_s = AXFR_BOOTSTRAP_RETRY * 2; /* Malus x2 */ + tmr_s += (int)((120.0 * 1000) * tls_rand()); + event_t *ev = zd->xfr_in.timer; + if (ev) { + evsched_cancel(ev->parent, ev); + evsched_schedule(ev->parent, ev, tmr_s); + } + log_zone_notice("%s Bootstrap failed, next " + "attempt in %d seconds.\n", + xfr.msgpref, tmr_s / 1000); + } else { + log_server_error("%s %s\n", + xfr.msgpref, knotd_strerror(ret)); + } } break; @@ -1445,16 +1495,12 @@ int xfr_worker(dthread_t *thread) int rfd = evqueue_pollfd(w->q); fdset_it_t it; fdset_begin(w->fdset, &it); + int rfd_event = 0; while(nfds > 0) { /* Check if it request. */ if (it.fd == rfd) { - dbg_xfr_verb("xfr: worker=%p processing request\n", - w); - ret = xfr_process_request(w, buf, buflen); - if (ret == KNOTD_ENOTRUNNING) { - break; - } + rfd_event = 1; /* Delay new tasks after processing. */ } else { /* Find data. */ data = xfr_handler_task(w, it.fd); @@ -1481,6 +1527,12 @@ int xfr_worker(dthread_t *thread) } } + /* Lazily process new tasks. */ + if (rfd_event) { + dbg_xfr_verb("xfr: worker=%p processing request\n", w); + ret = xfr_process_request(w, buf, buflen); + } + /* Sweep inactive. */ timev_t now; if (time_now(&now) == 0) { diff --git a/src/knot/server/zones.c b/src/knot/server/zones.c index be072e8..ba6340d 100644 --- a/src/knot/server/zones.c +++ b/src/knot/server/zones.c @@ -28,7 +28,7 @@ #include "knot/conf/conf.h" #include "knot/other/debug.h" #include "knot/other/error.h" -#include "knot/other/log.h" +#include "common/log.h" #include "knot/server/notify.h" #include "knot/server/server.h" #include "libknot/updates/xfr-in.h" @@ -42,6 +42,7 @@ static const size_t XFRIN_CHANGESET_BINARY_SIZE = 100; static const size_t XFRIN_CHANGESET_BINARY_STEP = 100; +static const size_t XFRIN_BOOTSTRAP_DELAY = 60; /*!< AXFR bootstrap avg. delay */ /* Forward declarations. */ static int zones_dump_zone_text(knot_zone_contents_t *zone, const char *zf); @@ -157,7 +158,7 @@ static int zonedata_init(conf_zone_t *cfg, knot_zone_t *zone) zd->xfr_in.next_id = -1; zd->xfr_in.acl = 0; zd->xfr_in.wrkr = 0; - zd->xfr_in.bootstrap_retry = 0; + zd->xfr_in.bootstrap_retry = XFRIN_BOOTSTRAP_DELAY * 1000 * tls_rand(); pthread_mutex_init(&zd->xfr_in.lock, 0); /* Initialize NOTIFY. */ @@ -169,16 +170,19 @@ static int zonedata_init(conf_zone_t *cfg, knot_zone_t *zone) if (!zd->ixfr_db) { int ret = journal_create(cfg->ixfr_db, JOURNAL_NCOUNT); if (ret != KNOTD_EOK) { - log_server_error("Failed to create journal file " - "'%s'\n", cfg->ixfr_db); + log_server_warning("Failed to create journal file " + "'%s' (%s)\n", cfg->ixfr_db, + knotd_strerror(ret)); } zd->ixfr_db = journal_open(cfg->ixfr_db, cfg->ixfr_fslimit, JOURNAL_LAZY, JOURNAL_DIRTY); } - if (zd->ixfr_db == 0) { - log_server_error("Failed to open journal file " - "'%s'\n", cfg->ixfr_db); + if (zd->ixfr_db == NULL) { + char ebuf[128] = {0}; + strerror_r(errno, ebuf, sizeof(ebuf)); + log_server_warning("Couldn't open journal file for zone '%s', " + "disabling IXFR/IN. (%s)\n", cfg->name, ebuf); } /* Initialize IXFR database syncing event. */ @@ -299,14 +303,32 @@ static int zones_expire_ev(event_t *e) rcu_read_lock(); dbg_zones("zones: EXPIRE timer event\n"); knot_zone_t *zone = (knot_zone_t *)e->data; - if (!zone) { - return KNOTD_EINVAL; - } - if (!zone->data) { + if (zone == NULL || zone->data == NULL) { return KNOTD_EINVAL; } - + zonedata_t *zd = (zonedata_t *)zone->data; + rcu_read_lock(); + + /* Do not issue SOA query if transfer is pending. */ + int locked = pthread_mutex_trylock(&zd->xfr_in.lock); + if (locked != 0) { + dbg_zones("zones: zone '%s' is being transferred, " + "deferring EXPIRE\n", + zd->conf->name); + + /* Reschedule as EXPIRE timer. */ + uint32_t exp_tmr = zones_soa_expire(zone); + evsched_schedule(e->parent, e, exp_tmr); + dbg_zones("zones: EXPIRE of '%s' after %u seconds\n", + zd->conf->name, exp_tmr / 1000); + + /* Unlock RCU. */ + rcu_read_unlock(); + return KNOTD_EOK; + } + dbg_zones_verb("zones: zone %s locked, no xfers are running\n", + zd->conf->name); /* Won't accept any pending SOA responses. */ zd->xfr_in.next_id = -1; @@ -316,23 +338,18 @@ static int zones_expire_ev(event_t *e) zd->server->nameserver->zone_db, zone->name); if (contents == NULL) { + pthread_mutex_unlock(&zd->xfr_in.lock); log_server_warning("Non-existent zone expired. Ignoring.\n"); rcu_read_unlock(); return 0; } - + /* Publish expired zone. */ rcu_read_unlock(); - - dbg_zones_verb("zones: zone %s expired, waiting for xfers to finish\n", - zd->conf->name); - pthread_mutex_lock(&zd->xfr_in.lock); - dbg_zones_verb("zones: zone %s locked, no xfers are running\n", - zd->conf->name); - synchronize_rcu(); - pthread_mutex_unlock(&zd->xfr_in.lock); + rcu_read_lock(); + /* Log event. */ log_server_info("Zone '%s' expired.\n", zd->conf->name); /* Early finish this event to prevent lockup during cancellation. */ @@ -353,6 +370,8 @@ static int zones_expire_ev(event_t *e) } knot_zone_contents_deep_free(&contents, 0); + pthread_mutex_unlock(&zd->xfr_in.lock); + rcu_read_unlock(); return 0; } @@ -364,20 +383,15 @@ static int zones_refresh_ev(event_t *e) { dbg_zones("zones: REFRESH or RETRY timer event\n"); knot_zone_t *zone = (knot_zone_t *)e->data; - if (!zone) { + if (zone == NULL || zone->data == NULL) { return KNOTD_EINVAL; } /* Cancel pending timers. */ zonedata_t *zd = (zonedata_t *)knot_zone_data(zone); - if (!zd) { - return KNOTD_EINVAL; - } - - /* Lock RCU. */ - rcu_read_lock(); /* Check for contents. */ + rcu_read_lock(); if (!knot_zone_contents(zone)) { /* Bootstrap from XFR master. */ @@ -415,8 +429,8 @@ static int zones_refresh_ev(event_t *e) return KNOTD_EOK; } - log_zone_info("Attempting to bootstrap zone %s from master\n", - zd->conf->name); +// log_zone_info("Attempting to bootstrap zone %s from master\n", +// zd->conf->name); ++zd->xfr_in.scheduled; pthread_mutex_unlock(&zd->xfr_in.lock); @@ -483,6 +497,8 @@ static int zones_refresh_ev(event_t *e) /* Create query. */ int sock = -1; + char strbuf[512] = "Generic error."; + const char *errstr = strbuf; sockaddr_t *master = &zd->xfr_in.master; int ret = xfrin_create_soa_query(zone->name, &xfr_req, &buflen); if (ret == KNOT_EOK) { @@ -496,6 +512,10 @@ static int zones_refresh_ev(event_t *e) if (bind(sock, via->ptr, via->len) < 0) { socket_close(sock); sock = -1; + char r_addr[SOCKADDR_STRLEN]; + sockaddr_tostr(via, r_addr, sizeof(r_addr)); + snprintf(strbuf, sizeof(strbuf), + "Couldn't bind to \'%s\'", r_addr); } } @@ -509,6 +529,7 @@ static int zones_refresh_ev(event_t *e) if (sent == buflen) { ret = KNOTD_EOK; } else { + strerror_r(errno, strbuf, sizeof(strbuf)); socket_close(sock); sock = -1; } @@ -523,6 +544,7 @@ static int zones_refresh_ev(event_t *e) } } else { ret = KNOTD_ERROR; + errstr = "Couldn't create SOA query"; } @@ -544,8 +566,8 @@ static int zones_refresh_ev(event_t *e) ret = xfr_request(zd->server->xfr_h, &req); } if (ret != KNOTD_EOK) { - log_server_warning("Failed to issue SOA query for zone '%s'.\n", - zd->conf->name); + log_server_warning("Failed to issue SOA query for zone '%s' (%s).\n", + zd->conf->name, errstr); } free(qbuf); @@ -564,9 +586,13 @@ static int zones_notify_send(event_t *e) dbg_notify("notify: NOTIFY timer event\n"); notify_ev_t *ev = (notify_ev_t *)e->data; - knot_zone_t *zone = ev->zone; - if (!zone) { + if (ev == NULL) { log_zone_error("NOTIFY invalid event received\n"); + return KNOTD_EINVAL; + } + knot_zone_t *zone = ev->zone; + if (zone == NULL || zone->data == NULL) { + log_zone_error("NOTIFY invalid event data received\n"); evsched_event_free(e->parent, e); free(ev); return KNOTD_EINVAL; @@ -744,17 +770,18 @@ static int zones_set_acl(acl_t **acl, list* acl_list) /* Create new ACL. */ *acl = acl_new(ACL_DENY, 0); - if (!*acl) { + if (*acl == NULL) { return KNOTD_ENOMEM; } /* Load ACL rules. */ + sockaddr_t addr; conf_remote_t *r = 0; WALK_LIST(r, *acl_list) { /* Initialize address. */ /*! Port matching disabled, port = 0. */ - sockaddr_t addr; + sockaddr_init(&addr, -1); conf_iface_t *cfg_if = r->remote; int ret = sockaddr_set(&addr, cfg_if->family, cfg_if->address, 0); @@ -988,7 +1015,7 @@ static inline uint64_t ixfrdb_key_make(uint32_t from, uint32_t to) /*----------------------------------------------------------------------------*/ -static int zones_changesets_from_binary(knot_changesets_t *chgsets) +int zones_changesets_from_binary(knot_changesets_t *chgsets) { assert(chgsets != NULL); assert(chgsets->allocated >= chgsets->count); @@ -1015,14 +1042,14 @@ static int zones_changesets_from_binary(knot_changesets_t *chgsets) * from journal) the SOA serial should already * be set, check it. */ + dbg_xfr_verb("xfr: reading RRSets to REMOVE, first RR is %hu\n", + knot_rrset_type(rrset)); assert(knot_rrset_type(rrset) == KNOT_RRTYPE_SOA); assert(chs->serial_from == knot_rdata_soa_serial(knot_rrset_rdata(rrset))); knot_changeset_store_soa(&chs->soa_from, &chs->serial_from, rrset); - dbg_xfr_verb("xfr: reading RRSets to REMOVE\n"); - /* Read remaining RRSets */ int in_remove_section = 1; while (remaining > 0) { @@ -1105,8 +1132,6 @@ static int zones_load_changesets(const knot_zone_t *zone, return KNOTD_EINVAL; } - dbg_xfr("Loading changesets from serial %u to %u\n", from, to); - /* Fetch zone-specific data. */ zonedata_t *zd = (zonedata_t *)knot_zone_data(zone); if (!zd->ixfr_db) { @@ -1114,6 +1139,11 @@ static int zones_load_changesets(const knot_zone_t *zone, return KNOTD_EINVAL; } + conf_read_lock(); + dbg_xfr("xfr: loading changesets for zone '%s' from serial %u to %u\n", + zd->conf->name, from, to); + conf_read_unlock(); + /* Retain journal for changeset loading. */ journal_t *j = journal_retain(zd->ixfr_db); @@ -1181,7 +1211,7 @@ static int zones_load_changesets(const knot_zone_t *zone, /*! \todo Check consistency. */ } - dbg_xfr_detail("xfr: Journal entries read.\n"); + dbg_xfr_detail("xfr: finished reading journal entries\n"); journal_release(j); /* Unpack binary data. */ @@ -1194,12 +1224,12 @@ static int zones_load_changesets(const knot_zone_t *zone, /* Check for complete history. */ if (to != found_to) { - dbg_xfr_detail("Returning ERANGE\n"); + dbg_xfr_detail("xfr: load changesets finished, ERANGE\n"); return KNOTD_ERANGE; } /* History reconstructed. */ - dbg_xfr_detail("Returning EOK\n"); + dbg_xfr_detail("xfr: load changesets finished, EOK\n"); return KNOTD_EOK; } @@ -1475,11 +1505,9 @@ static int zones_insert_zones(knot_nameserver_t *ns, cfg_if->family, cfg_if->address, cfg_if->port); - if (cfg_if->via) { - sockaddr_set(&zd->xfr_in.via, - cfg_if->via->family, - cfg_if->via->address, - 0); + if (sockaddr_isvalid(&cfg_if->via)) { + sockaddr_copy(&zd->xfr_in.via, + &cfg_if->via); } if (cfg_if->key) { @@ -1488,7 +1516,7 @@ static int zones_insert_zones(knot_nameserver_t *ns, sizeof(knot_key_t)); } - dbg_zones("zones: using %s:%d as XFR master " + dbg_zones("zones: using '%s@%d' as XFR master " "for '%s'\n", cfg_if->address, cfg_if->port, @@ -1690,27 +1718,28 @@ static int zones_check_tsig_query(const knot_zone_t *zone, knot_packet_additional_rrset_count(query) - 1); if (knot_rrset_type(tsig) == KNOT_RRTYPE_TSIG) { dbg_zones_verb("found TSIG in normal query\n"); - } else { - tsig = NULL; /* Invalidate if not TSIG RRTYPE. */ - } + } else { + tsig = NULL; /* Invalidate if not TSIG RRTYPE. */ + } } if (tsig == NULL) { // no TSIG, this is completely valid + /*! \note This function is (should be) called only in case of + normal query, i.e. we do not have to check ACL. + */ *tsig_rcode = 0; return KNOT_EOK; } // if there is some TSIG in the query, find the TSIG associated with // the zone - //knot_key_t *tsig_key_zone = NULL; - dbg_zones_verb("Checking zone and ACL.\n"); int ret = zones_query_check_zone(zone, addr, tsig_key_zone, rcode); - /*! \todo What if there is TSIG, but no key is configured? */ - - if (ret == KNOTD_EOK) { + + /* Accept found OR unknown key results. */ + if (ret == KNOTD_EOK || ret == KNOTD_EACCES) { if (*tsig_key_zone != NULL) { // everything OK, so check TSIG dbg_zones_verb("Verifying TSIG.\n"); @@ -1903,8 +1932,6 @@ int zones_query_check_zone(const knot_zone_t *zone, const sockaddr_t *addr, /* Check xfr-out ACL */ acl_key_t *match = NULL; if (acl_match(zd->xfr_out, addr, &match) == ACL_DENY) { - log_answer_warning("Unauthorized query or request for XFR " - "'%s/OUT'.\n", zd->conf->name); *rcode = KNOT_RCODE_REFUSED; return KNOTD_EACCES; } else { @@ -2244,7 +2271,7 @@ int zones_process_response(knot_nameserver_t *nameserver, char r_addr[SOCKADDR_STRLEN]; int r_port = sockaddr_portnum(from); sockaddr_tostr(from, r_addr, sizeof(r_addr)); - log_zone_info("SOA query of '%s' to %s:%d: Answered, no " + log_zone_info("SOA query of '%s' to '%s@%d': Answered, no " "transfer needed.\n", zd->conf->name, r_addr, r_port); rcu_read_unlock(); @@ -2257,7 +2284,7 @@ int zones_process_response(knot_nameserver_t *nameserver, assert(ret > 0); /* Already transferring. */ - int xfrtype = zones_transfer_to_use(contents); + int xfrtype = zones_transfer_to_use(zd); if (pthread_mutex_trylock(&zd->xfr_in.lock) != 0) { /* Unlock zone contents. */ dbg_zones("zones: SOA response received, but zone is " @@ -2299,9 +2326,12 @@ int zones_process_response(knot_nameserver_t *nameserver, /*----------------------------------------------------------------------------*/ -knot_ns_xfr_type_t zones_transfer_to_use(const knot_zone_contents_t *zone) +knot_ns_xfr_type_t zones_transfer_to_use(zonedata_t *data) { - /*! \todo Implement. */ + if (data == NULL || data->ixfr_db == NULL) { + return XFR_TYPE_AIN; + } + return XFR_TYPE_IIN; } @@ -2565,235 +2595,343 @@ int zones_ns_conf_hook(const struct conf_t *conf, void *data) } /*----------------------------------------------------------------------------*/ +/* Counting size of changeset in serialized form. */ +/*----------------------------------------------------------------------------*/ -static int zones_check_binary_size(uint8_t **data, size_t *allocated, - size_t required) +static inline size_t zones_dname_binary_size(const knot_dname_t *dname) { - if (required <= *allocated) { - return KNOTD_EOK; + if (dname == NULL) { + return 0; } - /* Allocate new memory block. */ - size_t new_count = required; - uint8_t *new_data = malloc(new_count * sizeof(uint8_t)); - if (new_data == NULL) { - return KNOTD_ENOMEM; + size_t size = 10; // 4B ID, 4B size, 2B label count + + // dname size in wire format + size += knot_dname_size(dname); + // label array size + size += knot_dname_label_count(dname); + + return size; +} + +/*----------------------------------------------------------------------------*/ + +static size_t zones_rdata_binary_size(const knot_rdata_t *rdata, + knot_rrtype_descriptor_t *desc) +{ + if (rdata == NULL) { + return 0; } - /* Clear memory block and copy old data. */ - memset(new_data, 0, new_count * sizeof(uint8_t)); - memcpy(new_data, *data, *allocated); + assert(desc != NULL); - /* Switch pointers and free old pointer. */ - free(*data); - *data = new_data; - *allocated = new_count; + size_t size = sizeof(unsigned int); // RDATA item count - return KNOTD_EOK; + for (int i = 0; i < rdata->count; ++i) { + if (desc->wireformat[i] == KNOT_RDATA_WF_COMPRESSED_DNAME + || desc->wireformat[i] == KNOT_RDATA_WF_UNCOMPRESSED_DNAME + || desc->wireformat[i] == KNOT_RDATA_WF_LITERAL_DNAME) { + size += zones_dname_binary_size(rdata->items[i].dname); + size += 2; // flags + } else { + if (rdata->items[i].raw_data != NULL) { + size += rdata->items[i].raw_data[0] + 2; + } + } + } + + return size; } /*----------------------------------------------------------------------------*/ -static int zones_changeset_rrset_to_binary(uint8_t **data, size_t *size, - size_t *allocated, - knot_rrset_t *rrset) +static size_t zones_rrset_binary_size(const knot_rrset_t *rrset) { - assert(data != NULL); - assert(size != NULL); - assert(allocated != NULL); + assert(rrset != NULL); - /* - * In *data, there is the whole changeset in the binary format, - * the actual RRSet will be just appended to it - */ + size_t size = 0; + + size += 13; // 2B type, 2B class, 4B TTL, 4B RDATA count, 1B flags + size += zones_dname_binary_size(rrset->owner); + + knot_rrtype_descriptor_t *desc = knot_rrtype_descriptor_by_type( + knot_rrset_type(rrset)); + assert(desc != NULL); + + const knot_rdata_t *rdata = knot_rrset_rdata(rrset); + while (rdata != NULL) { + size += zones_rdata_binary_size(rdata, desc); + rdata = knot_rrset_rdata_next(rrset, rdata); + } + + return size; +} + +/*----------------------------------------------------------------------------*/ - uint8_t *binary = NULL; - size_t actual_size = 0; - int ret = knot_zdump_rrset_serialize(rrset, &binary, &actual_size); - if (ret != KNOT_EOK || binary == NULL) { +int zones_changeset_binary_size(const knot_changeset_t *chgset, size_t *size) +{ + if (chgset == NULL || size == NULL) { + return KNOTD_EINVAL; + } + + size_t soa_from_size = zones_rrset_binary_size(chgset->soa_from); + size_t soa_to_size = zones_rrset_binary_size(chgset->soa_to); + + size_t remove_size = 0; + for (int i = 0; i < chgset->remove_count; ++i) + { + remove_size += zones_rrset_binary_size(chgset->remove[i]); + } + + size_t add_size = 0; + for (int i = 0; i < chgset->add_count; ++i) + { + add_size += zones_rrset_binary_size(chgset->add[i]); + } + + /*! \todo How is the changeset serialized? Any other parts? */ + *size += soa_from_size + soa_to_size + remove_size + add_size; + + return KNOT_EOK; +} + +/*----------------------------------------------------------------------------*/ +/* Changeset serialization and storing (new) */ +/*----------------------------------------------------------------------------*/ + +static int zones_rrset_write_to_mem(const knot_rrset_t *rr, char **entry, + size_t *remaining) { + size_t written = 0; + int ret = knot_zdump_rrset_serialize(rr, *((uint8_t **)entry), + *remaining, &written); + if (ret == KNOT_EOK) { + assert(written <= *remaining); + *remaining -= written; + *entry += written; + } + + return ret; +} + +static int zones_serialize_and_store_chgset(const knot_changeset_t *chs, + char *entry, size_t max_size) +{ + /* Serialize SOA 'from'. */ + int ret = zones_rrset_write_to_mem(chs->soa_from, &entry, &max_size); + if (ret != KNOT_EOK) { dbg_zones("knot_zdump_rrset_serialize() returned %s\n", knot_strerror(ret)); return KNOTD_ERROR; /*! \todo Other code? */ } - ret = zones_check_binary_size(data, allocated, *size + actual_size); - if (ret != KNOTD_EOK) { - free(binary); - return ret; + /* Serialize RRSets from the 'remove' section. */ + for (int i = 0; i < chs->remove_count; ++i) { + ret = zones_rrset_write_to_mem(chs->remove[i], &entry, &max_size); + if (ret != KNOT_EOK) { + dbg_zones("knot_zdump_rrset_serialize() returned %s\n", + knot_strerror(ret)); + return KNOTD_ERROR; /*! \todo Other code? */ + } + } + + /* Serialize SOA 'to'. */ + ret = zones_rrset_write_to_mem(chs->soa_to, &entry, &max_size); + if (ret != KNOT_EOK) { + dbg_zones("knot_zdump_rrset_serialize() returned %s\n", + knot_strerror(ret)); + return KNOTD_ERROR; /*! \todo Other code? */ + } + + /* Serialize RRSets from the 'add' section. */ + for (int i = 0; i < chs->add_count; ++i) { + ret = zones_rrset_write_to_mem(chs->add[i], &entry, &max_size); + if (ret != KNOT_EOK) { + dbg_zones("knot_zdump_rrset_serialize() returned %s\n", + knot_strerror(ret)); + return KNOTD_ERROR; /*! \todo Other code? */ + } + } - memcpy(*data + *size, binary, actual_size); - *size += actual_size; - free(binary); return KNOTD_EOK; } /*----------------------------------------------------------------------------*/ -int zones_changesets_to_binary(knot_changesets_t *chgsets) +static int zones_store_changeset(const knot_changeset_t *chs, journal_t *j, + knot_zone_t *zone, zonedata_t *zd) { - assert(chgsets != NULL); - assert(chgsets->allocated >= chgsets->count); + assert(chs != NULL); + assert(j != NULL); - /* - * Converts changesets to the binary format stored in chgsets->data - * from the changeset_t structures. - */ - int ret; + dbg_xfr("Saving changeset from %u to %u.\n", + chs->serial_from, chs->serial_to); - for (int i = 0; i < chgsets->count; ++i) { - knot_changeset_t *ch = &chgsets->sets[i]; - assert(ch->data == NULL); - assert(ch->size == 0); + uint64_t k = ixfrdb_key_make(chs->serial_from, chs->serial_to); - /* 1) origin SOA */ - ret = zones_changeset_rrset_to_binary(&ch->data, &ch->size, - &ch->allocated, ch->soa_from); - if (ret != KNOTD_EOK) { - free(ch->data); - ch->data = NULL; - dbg_zones("zones_changeset_rrset_to_binary(): %s\n", - knot_strerror(ret)); - return ret; - } + /* Count the size of the entire changeset in serialized form. */ + size_t entry_size = 0; - int j; - - /* 2) remove RRsets */ - assert(ch->remove_allocated >= ch->remove_count); - for (j = 0; j < ch->remove_count; ++j) { - ret = zones_changeset_rrset_to_binary(&ch->data, - &ch->size, - &ch->allocated, - ch->remove[j]); - if (ret != KNOTD_EOK) { - free(ch->data); - ch->data = NULL; - dbg_zones("zones_changeset_rrset_to_binary(): %s\n", - knot_strerror(ret)); - return ret; - } + int ret = zones_changeset_binary_size(chs, &entry_size); + assert(ret == KNOTD_EOK); + + dbg_xfr_verb("Size in serialized form: %zu\n", entry_size); + + /* Reserve space for the journal entry. */ + char *journal_entry = NULL; + ret = journal_map(j, k, &journal_entry, entry_size); + + /* Sync to zonefile may be needed. */ + while (ret == KNOTD_EAGAIN) { + /* Cancel sync timer. */ + event_t *tmr = zd->ixfr_dbsync; + if (tmr) { + dbg_xfr_verb("xfr: cancelling zonefile " + "SYNC timer of '%s'\n", + zd->conf->name); + evsched_cancel(tmr->parent, tmr); } - /* 3) new SOA */ - ret = zones_changeset_rrset_to_binary(&ch->data, &ch->size, - &ch->allocated, ch->soa_to); - if (ret != KNOTD_EOK) { - free(ch->data); - ch->data = NULL; - dbg_zones("zones_changeset_rrset_to_binary(): %s\n", - knot_strerror(ret)); - return ret; + /* Synchronize. */ + dbg_xfr_verb("xfr: forcing zonefile SYNC " + "of '%s'\n", + zd->conf->name); + ret = zones_zonefile_sync(zone, j); + if (ret != KNOTD_EOK && ret != KNOTD_ERANGE) { + continue; } - /* 4) add RRsets */ - assert(ch->add_allocated >= ch->add_count); - for (j = 0; j < ch->add_count; ++j) { - ret = zones_changeset_rrset_to_binary(&ch->data, - &ch->size, - &ch->allocated, - ch->add[j]); - if (ret != KNOTD_EOK) { - free(ch->data); - ch->data = NULL; - dbg_zones("zones_changeset_rrset_to_binary(): %s\n", - knot_strerror(ret)); - return ret; - } + /* Reschedule sync timer. */ + if (tmr) { + /* Fetch sync timeout. */ + conf_read_lock(); + int timeout = zd->conf->dbsync_timeout; + timeout *= 1000; /* Convert to ms. */ + conf_read_unlock(); + + /* Reschedule. */ + dbg_xfr_verb("xfr: resuming SYNC " + "of '%s'\n", + zd->conf->name); + evsched_schedule(tmr->parent, tmr, + timeout); + } + + /* Attempt to map again. */ + ret = journal_map(j, k, &journal_entry, entry_size); } - return KNOTD_EOK; + if (ret != KNOTD_EOK) { + dbg_xfr("Failed to map space for journal entry: %s.\n", + knotd_strerror(ret)); + return ret; + } + + assert(journal_entry != NULL); + + /* Serialize changeset, saving it bit by bit. */ + ret = zones_serialize_and_store_chgset(chs, journal_entry, entry_size); + + if (ret != KNOTD_EOK) { + dbg_xfr("Failed to serialize and store changeset: %s\n", + knotd_strerror(ret)); + } + + /* Unmap the journal entry. + If successfuly written changeset to journal, validate the entry. */ + ret = journal_unmap(j, k, journal_entry, ret == KNOTD_EOK); + + return ret; } /*----------------------------------------------------------------------------*/ -int zones_store_changesets(knot_ns_xfr_t *xfr) +journal_t *zones_store_changesets_begin(knot_ns_xfr_t *xfr) { if (xfr == NULL || xfr->data == NULL || xfr->zone == NULL) { - return KNOTD_EINVAL; + return NULL; } - - knot_zone_t *zone = xfr->zone; - knot_changesets_t *src = (knot_changesets_t *)xfr->data; /* Fetch zone-specific data. */ + knot_zone_t *zone = xfr->zone; zonedata_t *zd = (zonedata_t *)zone->data; if (!zd->ixfr_db) { - return KNOTD_EINVAL; + return NULL; } - /* Retain journal for changeset loading. */ + /* Begin transaction, will be release on commit/rollback. */ journal_t *j = journal_retain(zd->ixfr_db); + if (journal_trans_begin(j) != KNOTD_EOK) { + journal_release(j); + j = NULL; + } - /* Begin writing to journal. */ - for (unsigned i = 0; i < src->count; ++i) { + return j; +} - /* Make key from serials. */ - knot_changeset_t* chs = src->sets + i; - uint64_t k = ixfrdb_key_make(chs->serial_from, chs->serial_to); +/*----------------------------------------------------------------------------*/ - /* Write entry. */ - int ret = journal_write(j, k, (const char*)chs->data, chs->size); +int zones_store_changesets_commit(journal_t *j) +{ + if (j == NULL) { + return KNOTD_EINVAL; + } + + int ret = journal_trans_commit(j); + journal_release(j); + return ret; +} - /* Check for errors. */ - while (ret != KNOTD_EOK) { +/*----------------------------------------------------------------------------*/ - /* Sync to zonefile may be needed. */ - if (ret == KNOTD_EAGAIN) { +int zones_store_changesets_rollback(journal_t *j) +{ + if (j == NULL) { + return KNOTD_EINVAL; + } + + int ret = journal_trans_rollback(j); + journal_release(j); + return ret; +} - /* Cancel sync timer. */ - event_t *tmr = zd->ixfr_dbsync; - if (tmr) { - dbg_xfr_verb("xfr: cancelling zonefile " - "SYNC timer of '%s'\n", - zd->conf->name); - evsched_cancel(tmr->parent, tmr); - } +/*----------------------------------------------------------------------------*/ - /* Synchronize. */ - dbg_xfr_verb("xfr: forcing zonefile SYNC " - "of '%s'\n", - zd->conf->name); - ret = zones_zonefile_sync(zone, j); - if (ret != KNOTD_EOK && ret != KNOTD_ERANGE) { - continue; - } +int zones_store_changesets(knot_ns_xfr_t *xfr) +{ + if (xfr == NULL || xfr->data == NULL || xfr->zone == NULL) { + return KNOTD_EINVAL; + } - /* Reschedule sync timer. */ - if (tmr) { - /* Fetch sync timeout. */ - conf_read_lock(); - int timeout = zd->conf->dbsync_timeout; - timeout *= 1000; /* Convert to ms. */ - conf_read_unlock(); - - /* Reschedule. */ - dbg_xfr_verb("xfr: resuming SYNC " - "of '%s'\n", - zd->conf->name); - evsched_schedule(tmr->parent, tmr, - timeout); + knot_zone_t *zone = xfr->zone; + knot_changesets_t *src = (knot_changesets_t *)xfr->data; - } + /* Fetch zone-specific data. */ + zonedata_t *zd = (zonedata_t *)zone->data; + if (!zd->ixfr_db) { + return KNOTD_EINVAL; + } - /* Attempt to write again. */ - ret = journal_write(j, k, (const char*)chs->data, - chs->size); - } else { - /* Other errors. */ - journal_release(j); - return KNOTD_ERROR; - } - } + /* Retain journal for changeset writing. */ + journal_t *j = journal_retain(zd->ixfr_db); + + int ret = 0; + + /* Begin writing to journal. */ + for (unsigned i = 0; i < src->count; ++i) { + /* Make key from serials. */ + knot_changeset_t* chs = src->sets + i; - /* Free converted binary data. */ - free(chs->data); - chs->data = 0; - chs->size = 0; + ret = zones_store_changeset(chs, j, zone, zd); + if (ret != KNOTD_EOK) { + journal_release(j); + return ret; + } } - + /* Release journal. */ journal_release(j); @@ -2825,13 +2963,12 @@ int zones_xfr_load_changesets(knot_ns_xfr_t *xfr, uint32_t serial_from, return KNOTD_EOK; } - dbg_zones("Loading changesets...\n"); - + dbg_xfr_verb("xfr: loading changesets\n"); ret = zones_load_changesets(xfr->zone, chgsets, serial_from, serial_to); if (ret != KNOTD_EOK) { - dbg_zones_verb("Loading changesets failed: %s\n", - knotd_strerror(ret)); + dbg_xfr("xfr: failed to load changesets: %s\n", + knotd_strerror(ret)); knot_free_changesets(&chgsets); return ret; } @@ -2934,15 +3071,17 @@ int zones_timers_update(knot_zone_t *zone, conf_zone_t *cfzone, evsched_t *sch) int ret = sockaddr_set(&ev->addr, cfg_if->family, cfg_if->address, cfg_if->port); - conf_iface_t *via = cfg_if->via; - if (ret > 0 && via != NULL) { - ret = sockaddr_set(&ev->saddr, via->family, - via->address, 0); - } - if (ret < 1) { + sockaddr_t *via = &cfg_if->via; + if (ret > 0) { + if (sockaddr_isvalid(via)) { + sockaddr_copy(&ev->saddr, via); + } + } else { free(ev); - dbg_zones("notify: NOTIFY slave %s has invalid " - "address\n", cfg_if->name); + log_server_warning("NOTIFY slave '%s' has invalid " + "address '%s@%d', couldn't create" + "query.\n", cfg_if->name, + cfg_if->address, cfg_if->port); continue; } @@ -2961,7 +3100,7 @@ int zones_timers_update(knot_zone_t *zone, conf_zone_t *cfzone, evsched_t *sch) pthread_mutex_unlock(&zd->lock); log_server_info("Scheduled '%s' NOTIFY query " - "after %d s to %s:%d\n", zd->conf->name, + "after %d s to '%s@%d'.\n", zd->conf->name, tmr_s, cfg_if->address, cfg_if->port); } diff --git a/src/knot/server/zones.h b/src/knot/server/zones.h index 8421f30..08f9df6 100644 --- a/src/knot/server/zones.h +++ b/src/knot/server/zones.h @@ -174,13 +174,12 @@ int zones_process_response(knot_nameserver_t *nameserver, /*! * \brief Decides what type of transfer should be used to update the given zone. - * - * \param nameserver Name server structure that uses the zone. - * \param zone Zone to be updated by the transfer. + *. + * \param data Zone data for associated zone. * * \retval */ -knot_ns_xfr_type_t zones_transfer_to_use(const knot_zone_contents_t *zone); +knot_ns_xfr_type_t zones_transfer_to_use(zonedata_t *data); int zones_save_zone(const knot_ns_xfr_t *xfr); @@ -212,9 +211,40 @@ int zones_ns_conf_hook(const struct conf_t *conf, void *data); * \retval KNOTD_EAGAIN if journal needs to be synced with zonefile first. * * \todo Expects the xfr structure to be initialized in some way. + * \todo Update documentation!!! */ int zones_store_changesets(knot_ns_xfr_t *xfr); +/*! + * \brief Begin changesets storing transaction. + * + * \retval pointer to journal if successful + * \retval NULL on failure. + */ +journal_t *zones_store_changesets_begin(knot_ns_xfr_t *xfr); + +/*! + * \brief Commit stored changesets. + * + * \retval KNOTD_EOK on success. + * \retval KNOTD_EINVAL on invalid parameters. + * \retval KNOTD_ENOENT when no transaction is pending. + */ +int zones_store_changesets_commit(journal_t *j); + +/*! + * \brief Rollback stored changesets. + * + * \retval KNOTD_EOK on success. + * \retval KNOTD_EINVAL on invalid parameters. + * \retval KNOTD_ENOENT when no transaction is pending. + */ +int zones_store_changesets_rollback(journal_t *j); + +/*! \todo Document me. */ +int zones_changesets_from_binary(knot_changesets_t *chgsets); + +/*! \todo Document me. */ int zones_changesets_to_binary(knot_changesets_t *chgsets); /*! diff --git a/src/knot/stat/gatherer.c b/src/knot/stat/gatherer.c index e8048a1..5b8eab6 100644 --- a/src/knot/stat/gatherer.c +++ b/src/knot/stat/gatherer.c @@ -16,9 +16,11 @@ #include <config.h> #include <pthread.h> +#include <stdlib.h> +#include <string.h> #include "knot/stat/stat-common.h" -#include "common/slab/malloc.h" +#include "common/mempattern.h" #include "knot/stat/gatherer.h" gatherer_t *new_gatherer() diff --git a/src/knot/zone/semantic-check.c b/src/knot/zone/semantic-check.c index f900951..fc20c29 100644 --- a/src/knot/zone/semantic-check.c +++ b/src/knot/zone/semantic-check.c @@ -5,6 +5,7 @@ #include "knot/common.h" #include "knot/zone/zone-dump.h" #include "knot/other/error.h" +#include "knot/other/debug.h" #include "libknot/libknot.h" #include "common/base32hex.h" #include "common/crc.h" @@ -15,6 +16,8 @@ static char *error_messages[(-ZC_ERR_ALLOC) + 1] = { [-ZC_ERR_ALLOC] = "Memory allocation error!\n", [-ZC_ERR_MISSING_SOA] = "SOA record missing in zone!\n", + [-ZC_ERR_MISSING_NS_DEL_POINT] = "NS record missing in zone apex or in " + "delegation point!\n", [-ZC_ERR_RRSIG_RDATA_TYPE_COVERED] = "RRSIG: Type covered rdata field is wrong!\n", @@ -63,6 +66,9 @@ static char *error_messages[(-ZC_ERR_ALLOC) + 1] = { "NSEC3: NSEC3 chain is not coherent!\n", [-ZC_ERR_NSEC3_RDATA_BITMAP] = "NSEC3: NSEC3 bitmap error!\n", + [-ZC_ERR_NSEC3_EXTRA_RECORD] = + "NSEC3: NSEC3 node contains extra record. This is valid, however Knot " + "will not serve this record properly.\n", [-ZC_ERR_CNAME_CYCLE] = "CNAME: CNAME cycle!\n", @@ -90,9 +96,9 @@ static char *error_messages[(-ZC_ERR_ALLOC) + 1] = { specified otherwise */ [-ZC_ERR_GLUE_NODE] = - "GLUE: Node with Glue record missing!\n", + "GLUE: Node with glue record missing!\n", [-ZC_ERR_GLUE_RECORD] = - "GLUE: Record with Glue address missing\n", + "GLUE: Record with glue address missing\n", }; static const uint MAX_CNAME_CYCLE_DEPTH = 15; @@ -140,7 +146,11 @@ static void log_error_from_node(err_handler_t *handler, char *name = knot_dname_to_str(knot_node_owner(node)); fprintf(stderr, "Semantic warning in node: %s: ", name); - fprintf(stderr, "%s", error_messages[-error]); + if (error_messages[-error] != NULL) { + fprintf(stderr, "%s", error_messages[-error]); + } else { + fprintf(stderr, "Unknown error (%d).\n", error); + } free(name); } else { fprintf(stderr, "Total number of warnings is: %d for error: %s", @@ -171,6 +181,7 @@ int err_handler_handle_error(err_handler_t *handler, (error < ZC_ERR_GENERIC_GENERAL_ERROR)) { /* The two errors before SOA were handled */ log_error_from_node(handler, node, error); + return KNOT_EOK; } else if ((error < ZC_ERR_RRSIG_GENERAL_ERROR) && ((handler->errors[-error] == 0) || @@ -310,12 +321,19 @@ static int check_cname_cycles_in_zone(knot_zone_contents_t *zone, knot_dname_t *tmp_chopped = knot_dname_left_chop(next_dname_copy); - knot_dname_free(&next_dname_copy); - if (!tmp_chopped) { + if (!tmp_chopped && + !(knot_dname_is_fqdn(next_dname_copy) && + knot_dname_label_count(next_dname_copy) == 0)) { knot_dname_free(&chopped_wc); knot_dname_free(&next_dname_copy); return KNOT_ERROR; + } else if ((knot_dname_is_fqdn(next_dname_copy) && + knot_dname_label_count(next_dname_copy) == 0)) { + knot_dname_free(&next_dname_copy); + /* Root domain, end of search. */ + break; } + knot_dname_free(&next_dname_copy); cut_offs++; @@ -973,7 +991,8 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone, knot_node_t *nod /* Directly discard. */ knot_dname_free(&next_dname); - + + /*!< \todo These comments are not accurate anymore. */ /* This is probably not sufficient, but again, it is covered in * zone load time */ @@ -999,14 +1018,21 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone, knot_node_t *nod type) == NULL) { err_handler_handle_error(handler, node, ZC_ERR_NSEC3_RDATA_BITMAP); -/* char *name = - knot_dname_to_str( - log_zone_error("Node %s does " - "not contain RRSet of type %s " - "but NSEC bitmap says " - "it does!\n", name, - knot_rrtype_to_string(type)); - free(name); */ + } + } + + /* Check that the node only contains NSEC3 and RRSIG. */ + const knot_rrset_t **rrsets = knot_node_rrsets(nsec3_node); + if (rrsets == NULL) { + return KNOT_ENOMEM; + } + + for (int i = 0; i < knot_node_rrset_count(nsec3_node); i++) { + uint16_t type = knot_rrset_type(rrsets[i]); + if (!(type == KNOT_RRTYPE_NSEC3 || + type == KNOT_RRTYPE_RRSIG)) { + err_handler_handle_error(handler, nsec3_node, + ZC_ERR_NSEC3_EXTRA_RECORD); } } @@ -1143,15 +1169,21 @@ static int semantic_checks_plain(knot_zone_contents_t *zone, return KNOT_EOK; } + /*!< \todo Good Lord, move this to ist own function. */ - /* check for glue records at zone cuts */ - if (knot_node_is_deleg_point(node)) { + /* check for glue records at zone cuts and in apex. */ + if (knot_node_is_deleg_point(node) || knot_zone_contents_apex(zone) == + node) { const knot_rrset_t *ns_rrset = knot_node_rrset(node, KNOT_RRTYPE_NS); - assert(ns_rrset); + if (ns_rrset == NULL) { + err_handler_handle_error(handler, node, + ZC_ERR_MISSING_NS_DEL_POINT); + return KNOT_EOK; + } //FIXME this should be an error as well ! (i guess) - const knot_dname_t *ns_dname = + knot_dname_t *ns_dname = knot_rdata_get_item(knot_rrset_rdata (ns_rrset), 0)->dname; @@ -1159,12 +1191,41 @@ static int semantic_checks_plain(knot_zone_contents_t *zone, const knot_node_t *glue_node = knot_zone_contents_find_node(zone, ns_dname); - + if (knot_dname_is_subdomain(ns_dname, knot_node_owner(knot_zone_contents_apex(zone)))) { if (glue_node == NULL) { - err_handler_handle_error(handler, node, + /* Try wildcard. */ + knot_dname_t *wildcard = + knot_dname_new_from_str("*", 1, NULL); + if (wildcard == NULL) { + return KNOT_ENOMEM; + } + + knot_dname_left_chop_no_copy(ns_dname); + + if (knot_dname_cat(wildcard, + ns_dname) == NULL) { + knot_dname_free(&wildcard); + return KNOT_ENOMEM; + } + + const knot_node_t *wildcard_node = + knot_zone_contents_find_node(zone, + wildcard); + if (wildcard_node == NULL) { + err_handler_handle_error(handler, node, ZC_ERR_GLUE_NODE); + } else { + /* Look for A or AAAA. */ + if ((knot_node_rrset(wildcard_node, + KNOT_RRTYPE_A) == NULL) && + (knot_node_rrset(wildcard_node, + KNOT_RRTYPE_AAAA) == NULL)) { + err_handler_handle_error(handler, node, + ZC_ERR_GLUE_RECORD); + } + } } else { if ((knot_node_rrset(glue_node, KNOT_RRTYPE_A) == NULL) && @@ -1276,15 +1337,6 @@ static int semantic_checks_dnssec(knot_zone_contents_t *zone, err_handler_handle_error(handler, node, ZC_ERR_NSEC_RDATA_MULTIPLE); - /* CLEANUP */ -/* char *name = - knot_dname_to_str( - knot_node_owner(node)); - log_zone_error("Node %s contains more " - "than one NSEC " - "record!\n", name); - knot_rrset_dump(nsec_rrset, 0); - free(name); */ } /* @@ -1308,9 +1360,6 @@ static int semantic_checks_dnssec(knot_zone_contents_t *zone, err_handler_handle_error(handler, node, ZC_ERR_NSEC_RDATA_CHAIN); - /* CLEANUP */ -/* log_zone_error("NSEC chain is not " - "coherent!\n"); */ } if (knot_dname_compare(next_domain, @@ -1344,6 +1393,8 @@ static int semantic_checks_dnssec(knot_zone_contents_t *zone, */ static void do_checks_in_tree(knot_node_t *node, void *data) { + dbg_semcheck_verb("semcheck: do_check_in_tree: Checking node: %s\n", + knot_dname_to_str(node->owner)); assert(data != NULL); arg_t *args = (arg_t *)data; diff --git a/src/knot/zone/semantic-check.h b/src/knot/zone/semantic-check.h index 08396c8..17b774f 100644 --- a/src/knot/zone/semantic-check.h +++ b/src/knot/zone/semantic-check.h @@ -36,6 +36,7 @@ enum zonechecks_errors { ZC_ERR_UNKNOWN, ZC_ERR_MISSING_SOA, + ZC_ERR_MISSING_NS_DEL_POINT, ZC_ERR_GENERIC_GENERAL_ERROR, /* isn't there a better name? */ @@ -67,6 +68,7 @@ enum zonechecks_errors { ZC_ERR_NSEC3_RDATA_TTL, ZC_ERR_NSEC3_RDATA_CHAIN, ZC_ERR_NSEC3_RDATA_BITMAP, + ZC_ERR_NSEC3_EXTRA_RECORD, ZC_ERR_NSEC3_GENERAL_ERROR, @@ -101,6 +103,7 @@ struct arg { void *arg5; /* last node */ void *arg6; /* error handler */ void *arg7; /* CRC */ + int error_code; /* Error code. */ }; typedef struct arg arg_t; diff --git a/src/knot/zone/zone-dump.c b/src/knot/zone/zone-dump.c index 6ca969f..64b743c 100644 --- a/src/knot/zone/zone-dump.c +++ b/src/knot/zone/zone-dump.c @@ -55,9 +55,12 @@ static inline int write_to_file_crc(const void *src, size_t size, size_t n, int fd, crc_t *crc) { + if (src == NULL || fd < 0) { + return KNOT_EBADARG; + } ssize_t rc = write(fd, src, size * n); if (rc != size * n) { - fprintf(stderr, "fwrite: invalid write %zu (expected %zu)\n", rc, + fprintf(stderr, "write: invalid write %zu (expected %zu)\n", rc, n); } @@ -67,48 +70,66 @@ static inline int write_to_file_crc(const void *src, size * n); } - /* - * It was meant differtely, caller function does not - * care how many bytes had been written, it just cares about - * success/fail (not that it is checked anyway) (#1684). - */ - return rc == n; - + return rc == size * n; } static inline int write_to_stream(const void *src, - size_t size, size_t n, - uint8_t **stream, - size_t *stream_size) + size_t size, size_t n, + uint8_t *stream, + size_t max_size, + size_t *written_bytes) { - /* Resize the stream */ - void *tmp = realloc(*stream, - (*stream_size + (size * n)) * sizeof(uint8_t)); - if (tmp != NULL) { - *stream = tmp; - memcpy(*stream + *stream_size, src, - size * n); - *stream_size += (size * n) * sizeof(uint8_t); - return KNOT_EOK; - } else { - free(*stream); - *stream = NULL; - return KNOT_ENOMEM; + if (src == NULL || stream == NULL || written_bytes == NULL) { + return KNOT_EBADARG; } - + + /* Check that the stream boundary will not be crossed. */ + if (*written_bytes + (size * n) > max_size) { + /* Buffer overflown. */ + dbg_zdump("zdump: write_to_stream: Cannot write to stream, no " + "space left.\n"); + return KNOT_ERANGE; + } + + /* Do the actual write. */ + memcpy(stream + *written_bytes, src, size * n); + /* Expand size. */ + *written_bytes += (size * n); + return KNOT_EOK; } static int write_wrapper(const void *src, - size_t size, size_t n, int fd, - uint8_t **stream, size_t *stream_size, crc_t *crc) + size_t size, size_t n, int fd, + uint8_t *stream, size_t max_size, + size_t *written_bytes, crc_t *crc) { + if (src == NULL) { + dbg_zdump("zdump: write_wrapper: NULL source.\n"); + return KNOT_EBADARG; + } + + dbg_zdump_detail("zdump: write_wrapper: Writing %d bytes to fd: %d.\n", + size * n, fd); + if (fd < 0) { - assert(stream && stream_size); + assert(stream && written_bytes); assert(crc == NULL); - return write_to_stream(src, size, n, stream, stream_size); + /*!< \todo To comply with calling convention of write_wrapper, + * we have to lose the error. */ + int ret = write_to_stream(src, size, n, stream, max_size, + written_bytes); + if (ret != KNOT_EOK) { + dbg_zdump("zdump: write_wrapper: Could not write to " + "stream. Reason: %s.\n", knot_strerror(ret)); + /* Intentional! */ + return 0; + } else { + /* Intentional! */ + return 1; + } } else { - assert(stream == NULL && stream_size == NULL); + assert(stream == NULL && written_bytes == NULL); return write_to_file_crc(src, size, n, fd, crc); } } @@ -119,18 +140,30 @@ static int write_wrapper(const void *src, * \param dname Dname whose labels are to be dumped. * \param f Output file. */ -static void knot_labels_dump_binary(const knot_dname_t *dname, int fd, - uint8_t **stream, size_t *stream_size, - crc_t *crc) +static int knot_labels_dump_binary(const knot_dname_t *dname, int fd, + uint8_t *stream, size_t max_size, + size_t *written_bytes, crc_t *crc) { - dbg_zdump("label count: %d\n", dname->label_count); + if (dname == NULL) { + dbg_zdump("zdump: dump_labels: NULL dname.\n"); + return KNOT_EBADARG; + } + uint16_t label_count = dname->label_count; - /*!< \todo #1684 check the return value */ - write_wrapper(&label_count, sizeof(label_count), 1, fd, stream, - stream_size, crc); - /*!< \todo #1684 check the return value */ - write_wrapper(dname->labels, sizeof(uint8_t), dname->label_count, fd, - stream, stream_size, crc); + if (!write_wrapper(&label_count, sizeof(label_count), 1, fd, stream, + max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_labels: Could not write label count.\n"); + return KNOT_ERROR; + } + + if (!write_wrapper(dname->labels, sizeof(uint8_t), dname->label_count, + fd, stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_labels: Could not write labels.\n"); + return KNOT_ERROR; + } + + dbg_zdump_verb("zdump: dump_labels: Labels dumped successfully.\n"); + return KNOT_EOK; } /*! @@ -139,33 +172,53 @@ static void knot_labels_dump_binary(const knot_dname_t *dname, int fd, * \param dname Dname to be dumped. * \param f Output file. */ -static void knot_dname_dump_binary(const knot_dname_t *dname, int fd, - uint8_t **stream, size_t *stream_size, - crc_t *crc) +static int knot_dname_dump_binary(const knot_dname_t *dname, int fd, + uint8_t *stream, size_t max_size, + size_t *written_bytes, + crc_t *crc) { + if (dname == NULL) { + dbg_zdump("zdump: dump_dname: NULL dname.\n"); + return KNOT_EBADARG; + } + + /*! \todo too big */ uint32_t dname_size = dname->size; - /*!< \todo #1684 check the return value */ - write_wrapper(&dname_size, sizeof(dname_size), 1, fd, stream, - stream_size, crc); - /*!< \todo #1684 check the return value */ - write_wrapper(dname->name, sizeof(uint8_t), dname->size, fd, - stream, stream_size, crc); - dbg_zdump("dname size: %d\n", dname->size); - knot_labels_dump_binary(dname, fd, stream, stream_size, crc); + if (!write_wrapper(&dname_size, sizeof(dname_size), 1, fd, stream, + max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_dname: Cannot write dname size.\n"); + return KNOT_ERROR; + } + + if (!write_wrapper(dname->name, sizeof(uint8_t), dname->size, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_dname: Cannot write dname name.\n"); + return KNOT_ERROR; + } + + dbg_zdump_verb("zdump: dump_dname: Dname dumped successfully.\n"); + return knot_labels_dump_binary(dname, fd, stream, max_size, + written_bytes, crc); } /*!< \todo #1684 some global variable indicating error! */ -static void dump_dname_with_id(const knot_dname_t *dname, int fd, - uint8_t **stream, size_t *stream_size, - crc_t *crc) +static int dump_dname_with_id(const knot_dname_t *dname, int fd, + uint8_t *stream, size_t max_size, + size_t *written_bytes, crc_t *crc) { + if (dname == NULL) { + dbg_zdump("zdump: dump_dname: NULL dname.\n"); + return KNOT_EBADARG; + } + uint32_t id = dname->id; - /*!< \todo #1684 check the return value */ - write_wrapper(&id, sizeof(id), 1, fd, stream, stream_size, crc); - knot_dname_dump_binary(dname, fd, stream, stream_size, crc); -/* if (!write_wrapper_safe(&dname->id, sizeof(dname->id), 1, f)) { + if (!write_wrapper(&id, sizeof(id), 1, fd, stream, max_size, + written_bytes, crc)) { + dbg_zdump("zdump: dump_dname: Cannot write ID.\n"); return KNOT_ERROR; - } */ + } + return knot_dname_dump_binary(dname, fd, stream, max_size, + written_bytes, crc); } /*! @@ -175,32 +228,39 @@ static void dump_dname_with_id(const knot_dname_t *dname, int fd, * \param type Type of rdata. * \param data Arguments to be propagated. */ -static void knot_rdata_dump_binary(knot_rdata_t *rdata, - uint32_t type, int fd, int use_ids, - uint8_t **stream, size_t *stream_size, - crc_t *crc) +static int knot_rdata_dump_binary(knot_rdata_t *rdata, + uint32_t type, int fd, int use_ids, + uint8_t *stream, size_t max_size, + size_t *written_bytes, + crc_t *crc) { + if (rdata == NULL) { + dbg_zdump("zdump: dump_rdata: NULL rdata.\n"); + return KNOT_EBADARG; + } knot_rrtype_descriptor_t *desc = knot_rrtype_descriptor_by_type(type); assert(desc != NULL); - dbg_zdump("Dumping type: %d\n", type); - if (desc->fixed_items) { assert(desc->length == rdata->count); } - + /* Write rdata count. */ - /*!< \todo #1684 check the return value */ - write_wrapper(&(rdata->count), - sizeof(rdata->count), 1, fd, stream, stream_size, crc); + if (!write_wrapper(&(rdata->count), + sizeof(rdata->count), 1, fd, stream, max_size, + written_bytes, crc)) { + dbg_zdump("zdump: dump_rdata: Could not write RDATA count.\n"); + return KNOT_ERROR; + } for (int i = 0; i < rdata->count; i++) { if (&(rdata->items[i]) == NULL) { - dbg_zdump("Item n. %d is not set!\n", i); + dbg_zdump("zdump: dump_rdata: " + "Item n. %d is not set!\n", i); continue; } - dbg_zdump("Item n: %d\n", i); + dbg_zdump_detail("zdump: dump_rdata: Dumping item nr: %d\n", i); if (desc->wireformat[i] == KNOT_RDATA_WF_COMPRESSED_DNAME || desc->wireformat[i] == KNOT_RDATA_WF_UNCOMPRESSED_DNAME || desc->wireformat[i] == KNOT_RDATA_WF_LITERAL_DNAME ) { @@ -219,60 +279,105 @@ static void knot_rdata_dump_binary(knot_rdata_t *rdata, assert(rdata->items[i].dname->id != 0); uint32_t id = rdata->items[i].dname->id; - /*!< \todo #1684 check the return value */ - write_wrapper(&id, - sizeof(id), 1, fd, stream, stream_size, - crc); + if (!write_wrapper(&id, + sizeof(id), + 1, fd, stream, max_size, + written_bytes, crc)) { + dbg_zdump("zdump: dump_rdata: Cannot " + "write dname ID.\n"); + return KNOT_ERROR; + } } else { -// assert(rdata->items[i].dname->id != 0); - dump_dname_with_id(rdata->items[i].dname, - fd, stream, - stream_size, crc); + int ret = dump_dname_with_id( + rdata->items[i].dname, + fd, stream, + max_size, + written_bytes, + crc); + if (ret != KNOT_EOK) { + dbg_zdump("zdump: dump_rdata: Cannot " + "dump dname.\n"); + return ret; + } } /* Write in the zone bit */ + /*! \todo Does not have to be so complex. + * Create extra variable. */ if (rdata->items[i].dname->node != NULL && !wildcard) { - /*!< \todo #1684 check the return value */ - write_wrapper((uint8_t *)"\1", - sizeof(uint8_t), 1, fd, stream, - stream_size, crc); + if (!write_wrapper((uint8_t *)"\1", + sizeof(uint8_t), 1, fd, + stream, max_size, + written_bytes, crc)) { + dbg_zdump("zdump: dump_rdata: Cannot " + "write zone bit.\n"); + return KNOT_ERROR; + } } else { - /*!< \todo #1684 check the return value */ - write_wrapper((uint8_t *)"\0", sizeof(uint8_t), - 1, fd, stream, stream_size, crc); + if (!write_wrapper((uint8_t *)"\0", + sizeof(uint8_t), + 1, fd, + stream, max_size, + written_bytes, crc)) { + dbg_zdump("zdump: dump_rdata: Cannot " + "write zone bit.\n"); + return KNOT_ERROR; + } } if (use_ids && wildcard) { - /*!< \todo #1684 check the return value */ - write_wrapper((uint8_t *)"\1", - sizeof(uint8_t), 1, fd, stream, - stream_size, crc); + if (!write_wrapper((uint8_t *)"\1", + sizeof(uint8_t), 1, + fd, stream, max_size, + written_bytes, crc)) { + dbg_zdump("zdump: dump_rdata: Cannot " + "write wildcard bit.\n"); + return KNOT_ERROR; + } + uint32_t wildcard_id = wildcard->id; - /*!< \todo #1684 check the return value */ - write_wrapper(&wildcard_id, - sizeof(wildcard_id), 1, fd, stream, - stream_size, crc); + if (!write_wrapper(&wildcard_id, + sizeof(wildcard_id), 1, + fd, stream, max_size, + written_bytes, crc)) { + dbg_zdump("zdump: dump_rdata: Cannot " + "write wildcard ID.\n"); + return KNOT_ERROR; + } } else { - /*!< \todo #1684 check the return value */ - write_wrapper((uint8_t *)"\0", sizeof(uint8_t), - 1, fd, stream, - stream_size, crc); + if (!write_wrapper((uint8_t *)"\0", + sizeof(uint8_t), + 1, fd, stream, + max_size, written_bytes, + crc)) { + dbg_zdump("zdump: dump_rdata: Cannot " + "write wildcard bit.\n"); + return KNOT_ERROR; + } } - } else { - dbg_zdump("Writing raw data. Item nr.: %d\n", + dbg_zdump_detail("zdump: dump_rdata: " + "Writing raw data. Item nr.: %d\n", i); assert(rdata->items[i].raw_data != NULL); - /*!< \todo #1684 check the return value */ - write_wrapper(rdata->items[i].raw_data, - sizeof(uint8_t), - rdata->items[i].raw_data[0] + 2, fd, - stream, stream_size, crc); - - dbg_zdump("Written %d long raw data\n", - rdata->items[i].raw_data[0]); + if (!write_wrapper(rdata->items[i].raw_data, + sizeof(uint8_t), + rdata->items[i].raw_data[0] + 2, fd, + stream, max_size, + written_bytes, crc)) { + dbg_zdump("zdump: dump_rdata: Cannot write raw " + "data.\n"); + return KNOT_ERROR; + } + + dbg_zdump_detail("zdump: dump_rdata: " + "Written %d long raw data.\n", + rdata->items[i].raw_data[0]); } } + + dbg_zdump_verb("zdump: dump_rdata: RDATA dumped successfully.\n"); + return KNOT_EOK; } /*! @@ -280,28 +385,45 @@ static void knot_rdata_dump_binary(knot_rdata_t *rdata, * * \param rrsig RRSIG to be dumped. * \param data Arguments to be propagated. + * + * \todo This whole function is obsolete. Change after 1.0.2 release. */ -static void knot_rrsig_set_dump_binary(knot_rrset_t *rrsig, int fd, - int use_ids, - uint8_t **stream, size_t *stream_size, - crc_t *crc) +static int knot_rrsig_set_dump_binary(knot_rrset_t *rrsig, int fd, + int use_ids, + uint8_t *stream, size_t max_size, + size_t *written_bytes, crc_t *crc) { + if (rrsig == NULL) { + dbg_zdump("zdump: dump_rrsig: NULL RRSIG.\n"); + return KNOT_EBADARG; + } + dbg_zdump_exec_detail( char *name = knot_dname_to_str(knot_rrset_owner(rrsig)); - dbg_zdump("Dumping RRSIG \\w owner: %s\n", - name); + dbg_zdump_detail("zdump: dump_rrsig: Dumping RRSIG \\w owner: %s.\n", + name); free(name); ); assert(rrsig->type == KNOT_RRTYPE_RRSIG); assert(rrsig->rdata); - /*!< \todo #1684 check the return value */ - write_wrapper(&rrsig->type, sizeof(rrsig->type), 1, fd, - stream, stream_size, crc); - write_wrapper(&rrsig->rclass, sizeof(rrsig->rclass), 1, fd, - stream, stream_size, crc); - write_wrapper(&rrsig->ttl, sizeof(rrsig->ttl), 1, fd, - stream, stream_size, crc); - + if (!write_wrapper(&rrsig->type, sizeof(rrsig->type), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_rrsig: Cannot write type.\n"); + return KNOT_ERROR; + } + + if (!write_wrapper(&rrsig->rclass, sizeof(rrsig->rclass), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_rrsig: Cannot write class.\n"); + return KNOT_ERROR; + } + + if (!write_wrapper(&rrsig->ttl, sizeof(rrsig->ttl), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_rrsig: Cannot write TTL.\n"); + return KNOT_ERROR; + } + uint32_t rdata_count = 1; /* Calculate rrset rdata count. */ knot_rdata_t *tmp_rdata = rrsig->rdata; @@ -309,18 +431,30 @@ dbg_zdump_exec_detail( tmp_rdata = tmp_rdata->next; rdata_count++; } + + if (!write_wrapper(&rdata_count, sizeof(rdata_count), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_rrsig: Cannot write rdata count.\n"); + return KNOT_ERROR; + } - write_wrapper(&rdata_count, sizeof(rdata_count), 1, fd, - stream, stream_size, crc); + dbg_zdump_verb("zdump: dump_rrsig: Static data dumped.\n"); tmp_rdata = rrsig->rdata; while (tmp_rdata->next != rrsig->rdata) { - knot_rdata_dump_binary(tmp_rdata, KNOT_RRTYPE_RRSIG, fd, - use_ids, stream, stream_size, crc); + int ret = knot_rdata_dump_binary(tmp_rdata, KNOT_RRTYPE_RRSIG, + fd, + use_ids, stream, max_size, + written_bytes, crc); + if (ret != KNOT_EOK) { + dbg_zdump("zdump: rrsig_to_binary: Could not dump " + "rdata. Reason: %s.\n", knot_strerror(ret)); + return ret; + } tmp_rdata = tmp_rdata->next; } - knot_rdata_dump_binary(tmp_rdata, KNOT_RRTYPE_RRSIG, fd, use_ids, - stream, stream_size, crc); + return knot_rdata_dump_binary(tmp_rdata, KNOT_RRTYPE_RRSIG, fd, use_ids, + stream, max_size, written_bytes, crc); } /*! @@ -329,25 +463,52 @@ dbg_zdump_exec_detail( * \param rrset RRSSet to be dumped. * \param data Arguments to be propagated. */ -static void knot_rrset_dump_binary(const knot_rrset_t *rrset, int fd, - int use_ids, - uint8_t **stream, size_t *stream_size, - crc_t *crc) +static int knot_rrset_dump_binary(const knot_rrset_t *rrset, int fd, + int use_ids, + uint8_t *stream, size_t max_size, + size_t *written_bytes, + crc_t *crc) { - dbg_zdump_detail("zdump: rrset_dump_binary: Dumping rrset to fd=%d\n", - fd); - + if (rrset == NULL) { + dbg_zdump("zdump: dump_rrset: NULL RRSet.\n"); + return KNOT_EBADARG; + } + + dbg_zdump_exec_detail( + char *name = knot_dname_to_str(knot_rrset_owner(rrset)); + dbg_zdump_detail("zdump: dump_rrset: " + "Dumping RRSet \\w owner: %s.\n", + name); + free(name); + ); + if (!use_ids) { - dump_dname_with_id(rrset->owner, fd, stream, stream_size, crc); + /*!< \todo IDs in changeset do no good. Change loading too. */ + int ret = dump_dname_with_id(rrset->owner, + fd, stream, max_size, + written_bytes, crc); + if (ret != KNOT_EOK) { + dbg_zdump("zdump: rrset_dump_binary: Could not dump " + "RRSet's owner.\n"); + return ret; + } } - /*!< \todo #1684 check the return value */ - write_wrapper(&rrset->type, sizeof(rrset->type), 1, fd, - stream, stream_size, crc); - write_wrapper(&rrset->rclass, sizeof(rrset->rclass), 1, fd, - stream, stream_size, crc); - write_wrapper(&rrset->ttl, sizeof(rrset->ttl), 1, fd, - stream, stream_size, crc); + if (!write_wrapper(&rrset->type, sizeof(rrset->type), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_rrset: Cannot write type.\n"); + return KNOT_ERROR; + } + if (!write_wrapper(&rrset->rclass, sizeof(rrset->rclass), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_rrset: Cannot write class.\n"); + return KNOT_ERROR; + } + if (!write_wrapper(&rrset->ttl, sizeof(rrset->ttl), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_rrset: Cannot write TTL.\n"); + return KNOT_ERROR; + } uint32_t rdata_count = 1; uint8_t has_rrsig = rrset->rrsigs != NULL; @@ -359,31 +520,54 @@ static void knot_rrset_dump_binary(const knot_rrset_t *rrset, int fd, rdata_count++; } - write_wrapper(&rdata_count, sizeof(rdata_count), 1, fd, - stream, stream_size, crc); - write_wrapper(&has_rrsig, sizeof(has_rrsig), 1, fd, - stream, stream_size, crc); + if (!write_wrapper(&rdata_count, sizeof(rdata_count), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_rrset: Cannot write rdata count.\n"); + return KNOT_ERROR; + } - dbg_zdump_detail("zdump: rrset_dump_binary: Static data dumped.\n"); + if (!write_wrapper(&has_rrsig, sizeof(has_rrsig), 1, fd, + stream, max_size, written_bytes, crc)) { + return KNOT_ERROR; + } + + dbg_zdump_verb("zdump: rrset_dump_binary: Static data dumped.\n"); tmp_rdata = rrset->rdata; while (tmp_rdata->next != rrset->rdata) { - knot_rdata_dump_binary(tmp_rdata, rrset->type, fd, use_ids, - stream, stream_size, crc); + int ret = knot_rdata_dump_binary(tmp_rdata, rrset->type, + fd, use_ids, + stream, max_size, + written_bytes, crc); + if (ret != KNOT_EOK) { + dbg_zdump("zdump: rrset_to_binary: Could not dump " + "rdata. Reason: %s.\n", knot_strerror(ret)); + return ret; + } tmp_rdata = tmp_rdata->next; } - knot_rdata_dump_binary(tmp_rdata, rrset->type, fd, use_ids, - stream, stream_size, crc); - dbg_zdump_detail("zdump: rrset_dump_binary: Rdata dumped.\n"); + int ret = knot_rdata_dump_binary(tmp_rdata, rrset->type, fd, use_ids, + stream, + max_size, written_bytes, crc); + if (ret != KNOT_EOK) { + dbg_zdump("zdump: rrset_to_binary: Could not dump " + "rdata. Reason: %s.\n", knot_strerror(ret)); + return ret; + } + + dbg_zdump_verb("zdump: rrset_dump_binary: Rdata dumped.\n"); /* This is now obsolete, although I'd rather not use recursion - that * would probably not work */ if (rrset->rrsigs != NULL) { - knot_rrsig_set_dump_binary(rrset->rrsigs, fd, use_ids, - stream, stream_size, crc); + return knot_rrsig_set_dump_binary(rrset->rrsigs, fd, use_ids, + stream, + max_size, written_bytes, crc); + } else { + return KNOT_EOK; } } @@ -393,12 +577,15 @@ static void knot_rrset_dump_binary(const knot_rrset_t *rrset, int fd, * \param node Node to dumped. * \param data Arguments to be propagated. */ -static void knot_node_dump_binary(knot_node_t *node, int fd, - uint8_t **stream, size_t *stream_size, - crc_t *crc) +static int knot_node_dump_binary(knot_node_t *node, int fd, + uint8_t *stream, + size_t max_size, + size_t *written_bytes, + crc_t *crc) { if (node == NULL) { - return; + dbg_zdump("zdump: dump_node: NULL node.\n"); + return KNOT_EBADARG; } /* first write dname */ @@ -407,61 +594,93 @@ static void knot_node_dump_binary(knot_node_t *node, int fd, /* Write owner ID. */ dbg_zdump_exec_detail( char *name = knot_dname_to_str(knot_node_owner(node)); - dbg_zdump("Dumping node owned by %s\n", - name); + dbg_zdump_detail("zdump: dump_node: Dumping node owned by %s\n", + name); free(name); ); assert(node->owner->id != 0); uint32_t owner_id = node->owner->id; - /*!< \todo #1684 check the return value */ - write_wrapper(&owner_id, sizeof(owner_id), 1, fd, stream, stream_size, - crc); + if (!write_wrapper(&owner_id, sizeof(owner_id), 1, fd, stream, + max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_node: Cannot write ID.\n"); + return KNOT_ERROR; + } + /*!< \todo Fix after release. */ if (knot_node_parent(node) != NULL) { uint32_t parent_id = knot_dname_id( knot_node_owner(knot_node_parent(node))); - write_wrapper(&parent_id, sizeof(parent_id), 1, fd, - stream, stream_size, crc); + if (!write_wrapper(&parent_id, sizeof(parent_id), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_node: Cannot write parent " + "ID.\n"); + return KNOT_ERROR; + } } else { uint32_t parent_id = 0; - write_wrapper(&parent_id, sizeof(parent_id), 1, fd, - stream, stream_size, crc); + if (!write_wrapper(&parent_id, sizeof(parent_id), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_node: Cannot write parent " + "ID.\n"); + return KNOT_ERROR; + } } - write_wrapper(&(node->flags), sizeof(node->flags), 1, fd, - stream, stream_size, crc); - - dbg_zdump("Written flags: %u\n", node->flags); + if (!write_wrapper(&(node->flags), sizeof(node->flags), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_node: Cannot write node flags.\n"); + return KNOT_ERROR; + } if (knot_node_nsec3_node(node) != NULL) { uint32_t nsec3_id = knot_node_owner(knot_node_nsec3_node(node))->id; - write_wrapper(&nsec3_id, sizeof(nsec3_id), 1, fd, - stream, stream_size, crc); - dbg_zdump("Written nsec3 node id: %u\n", - knot_node_owner(knot_node_nsec3_node(node))->id); + if (!write_wrapper(&nsec3_id, sizeof(nsec3_id), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_node: Cannot write NSEC3 ID.\n"); + return KNOT_ERROR; + } + + dbg_zdump_detail("Written nsec3 node id: %u\n", + knot_node_owner( + knot_node_nsec3_node(node))->id); } else { uint32_t nsec3_id = 0; - write_wrapper(&nsec3_id, sizeof(nsec3_id), 1, fd, - stream, stream_size, crc); + if (!write_wrapper(&nsec3_id, sizeof(nsec3_id), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_node: Cannot write NSEC3 ID.\n"); + return KNOT_ERROR; + } } /* Now we need (or do we?) count of rrsets to be read * but that number is yet unknown */ uint16_t rrset_count = node->rrset_count; - write_wrapper(&rrset_count, sizeof(rrset_count), 1, fd, - stream, stream_size, crc); + if (!write_wrapper(&rrset_count, sizeof(rrset_count), 1, fd, + stream, max_size, written_bytes, crc)) { + dbg_zdump("zdump: dump_node: Cannot write RRSet count.\n"); + return KNOT_ERROR; + } const knot_rrset_t **node_rrsets = knot_node_rrsets(node); for (int i = 0; i < rrset_count; i++) { - knot_rrset_dump_binary(node_rrsets[i], fd, 1, - stream, stream_size, crc); + int ret = knot_rrset_dump_binary(node_rrsets[i], fd, 1, + stream, max_size, + written_bytes, crc); + if (ret != KNOT_EOK) { + dbg_zdump("zdump: dump_node: Could not dump RRSet. " + "Reason: %s.\n", knot_strerror(ret)); + return ret; + } } free(node_rrsets); + + dbg_zdump_verb("zdump: dump_node: Node dumped successfully.\n"); + return KNOT_EOK; } int zone_is_secure(knot_zone_contents_t *zone) @@ -483,17 +702,24 @@ static void dump_dname_from_tree(knot_dname_t *dname, void *data) { arg_t *arg = (arg_t *)data; + if (arg->error_code != KNOT_EOK) { + dbg_zdump("zdump: dump_dname_from_tree: " + "Error occured previously.\n"); + return; + } + int *fd_pointer = (int *)arg->arg1; int fd = -1; if (fd_pointer != NULL) { fd = *fd_pointer; } else { dbg_zdump("zdump: dump_dname_from_tree: Bad fd.\n"); + arg->error_code = KNOT_EBADARG; return; } crc_t *crc = (crc_t*)arg->arg2; - dump_dname_with_id(dname, fd, NULL, NULL, crc); + arg->error_code = dump_dname_with_id(dname, fd, NULL, 0, NULL, crc); } static int knot_dump_dname_table(const knot_dname_table_t *dname_table, @@ -502,16 +728,21 @@ static int knot_dump_dname_table(const knot_dname_table_t *dname_table, arg_t arg; arg.arg1 = &fd; arg.arg2 = crc; + arg.error_code = KNOT_EOK; /* Go through the tree and dump each dname along with its ID. */ knot_dname_table_tree_inorder_apply(dname_table, dump_dname_from_tree, &arg); - return KNOT_EOK; + return arg.error_code; } static void save_node_from_tree(knot_node_t *node, void *data) { arg_t *arg = (arg_t *)data; + if (arg == NULL) { + return; + } + /* Increment node count */ (*((uint32_t *)(arg->arg1)))++; /* Save the first node only */ @@ -524,13 +755,25 @@ static void save_node_from_tree(knot_node_t *node, void *data) static void dump_node_to_file(knot_node_t *node, void *data) { arg_t *arg = (arg_t *)data; + if (arg == NULL) { + return; + } + + if (arg->error_code != KNOT_EOK) { + dbg_zdump("zdump: dump_node_to_file: " + "Error occured previously.\n"); + return; + } + int *fd_pointer = (int *)arg->arg1; int fd = -1; if (fd_pointer != NULL) { fd = *fd_pointer; } - knot_node_dump_binary(node, fd, NULL, NULL, (crc_t *)arg->arg7); + arg->error_code = + knot_node_dump_binary(node, + fd, NULL, 0, NULL, (crc_t *)arg->arg7); } char *knot_zdump_crc_file(const char* filename) @@ -553,6 +796,7 @@ int knot_zdump_binary(knot_zone_contents_t *zone, int fd, crc_t *crc) { if (fd < 0 || sfilename == NULL) { + dbg_zdump("zdump: Bad arguments.\n"); return KNOT_EBADARG; } @@ -562,8 +806,9 @@ int knot_zdump_binary(knot_zone_contents_t *zone, int fd, arguments.arg1 = &node_count; arguments.arg2 = NULL; - /* Count number of normal nodes. */ - knot_zone_contents_tree_apply_inorder(zone, save_node_from_tree, &arguments); + /* Count number of normal nodes. This cannot fail. */ + knot_zone_contents_tree_apply_inorder(zone, save_node_from_tree, + &arguments); /* arg1 is now count of normal nodes */ uint32_t normal_node_count = *((uint32_t *)arguments.arg1); @@ -571,8 +816,9 @@ int knot_zdump_binary(knot_zone_contents_t *zone, int fd, arguments.arg1 = &node_count; arguments.arg2 = NULL; - /* Count number of NSEC3 nodes. */ - knot_zone_contents_nsec3_apply_inorder(zone, save_node_from_tree, &arguments); + /* Count number of NSEC3 nodes. This cannot fail. */ + knot_zone_contents_nsec3_apply_inorder(zone, + save_node_from_tree, &arguments); uint32_t nsec3_node_count = *((uint32_t *)arguments.arg1); /* arg2 is the first NSEC3 node - used in sem checks. */ /* arg3 is the last NSEC3 node - used in sem checks. */ @@ -616,74 +862,112 @@ int knot_zdump_binary(knot_zone_contents_t *zone, int fd, /* Start writing header - magic bytes. */ static const uint8_t MAGIC[MAGIC_LENGTH] = MAGIC_BYTES; - write_wrapper(&MAGIC, sizeof(uint8_t), MAGIC_LENGTH, fd, NULL, NULL, - crc); + if (!write_wrapper(&MAGIC, sizeof(uint8_t), MAGIC_LENGTH, + fd, NULL, 0, NULL, crc)) { + dbg_zdump("zdump: Cannot write magic bytes.\n"); + return KNOT_ERROR; + } /* Write source file length. */ uint32_t sflen = strlen(sfilename) + 1; - write_wrapper(&sflen, sizeof(uint32_t), 1, fd, NULL, NULL, crc); + if (!write_wrapper(&sflen, sizeof(uint32_t), 1, fd, + NULL, 0, NULL, crc)) { + dbg_zdump("zdump: Cannot write source file length.\n"); + return KNOT_ERROR; + } /* Write source file. */ - write_wrapper(sfilename, sflen, 1, fd, NULL, NULL, crc); + if (!write_wrapper(sfilename, sflen, 1, fd, NULL, 0, NULL, crc)) { + dbg_zdump("zdump: Cannot write source file name.\n"); + return KNOT_ERROR; + } /* Notice: End of header, */ /* Start writing compiled data. */ - write_wrapper(&normal_node_count, sizeof(normal_node_count), 1, fd, - NULL, NULL, crc); - write_wrapper(&nsec3_node_count, sizeof(nsec3_node_count), 1, fd, - NULL, NULL, crc); + if (!write_wrapper(&normal_node_count, sizeof(normal_node_count), 1, fd, + NULL, 0, NULL, crc)) { + dbg_zdump("zdump: Cannot write node count.\n"); + return KNOT_ERROR; + } + + if (!write_wrapper(&nsec3_node_count, sizeof(nsec3_node_count), 1, fd, + NULL, 0, NULL, crc)) { + dbg_zdump("zdump: Cannot write NSEC3 node count.\n"); + return KNOT_ERROR; + } uint32_t auth_node_count = zone->node_count; - write_wrapper(&auth_node_count, - sizeof(auth_node_count), 1, fd, NULL, NULL, crc); + if (!write_wrapper(&auth_node_count, + sizeof(auth_node_count), + 1, fd, NULL, 0, NULL, crc)) { + dbg_zdump("zdump: Cannot write authoritative node count.\n"); + return KNOT_ERROR; + } /* Write total number of dnames */ assert(zone->dname_table); uint32_t total_dnames = zone->dname_table->id_counter; - write_wrapper(&total_dnames, - sizeof(total_dnames), 1, fd, NULL, NULL, crc); + if (!write_wrapper(&total_dnames, + sizeof(total_dnames), 1, fd, NULL, 0, NULL, crc)) { + dbg_zdump("zdump: Cannot write dname count.\n"); + return KNOT_ERROR; + } /* Write dname table. */ if (knot_dump_dname_table(zone->dname_table, fd, crc) != KNOT_EOK) { + dbg_zdump("zdump: Cannot write dname table.\n"); return KNOT_ERROR; } arguments.arg1 = &fd; arguments.arg3 = zone; arguments.arg7 = crc; + + arguments.error_code = KNOT_EOK; /*!< \todo #1685 Stop traversal upon error. */ knot_zone_contents_tree_apply_inorder(zone, dump_node_to_file, (void *)&arguments); - + + if (arguments.error_code != KNOT_EOK) { + dbg_zdump("zdump: Dump of normal tree failed. Reason: %s.\n", + knot_strerror(arguments.error_code)); + return arguments.error_code; + } + + arguments.error_code = KNOT_EOK; knot_zone_contents_nsec3_apply_inorder(zone, dump_node_to_file, (void *)&arguments); + + if (arguments.error_code != KNOT_EOK) { + dbg_zdump("zdump: Dump of NSEC3 tree failed. Reason: %s.\n", + knot_strerror(arguments.error_code)); + return arguments.error_code; + } + *crc = crc_finalize(*crc); return KNOT_EOK; } -int knot_zdump_rrset_serialize(const knot_rrset_t *rrset, uint8_t **stream, - size_t *size) +int knot_zdump_rrset_serialize(const knot_rrset_t *rrset, uint8_t *stream, + size_t max_size, size_t *written_bytes) { - if (stream == NULL || *stream != NULL || rrset == NULL || - size == NULL) { + if (stream == NULL || rrset == NULL || + written_bytes == NULL) { dbg_zdump("zdump: rrset_serialize: Bad arguments.\n"); return KNOT_EBADARG; } - - *size = 0; - arg_t arguments; - memset(&arguments, 0, sizeof(arg_t)); + *written_bytes = 0; + /* This fd will signal functions to use streams. */ int fd = -1; - knot_rrset_dump_binary(rrset, fd, 0, stream, size, NULL); - - return KNOT_EOK; + return knot_rrset_dump_binary(rrset, fd, 0, stream, max_size, + written_bytes, NULL); } int knot_zdump_dump(knot_zone_contents_t *zone, int fd, const char *sfilename, diff --git a/src/knot/zone/zone-dump.h b/src/knot/zone/zone-dump.h index 975b8e8..46e760e 100644 --- a/src/knot/zone/zone-dump.h +++ b/src/knot/zone/zone-dump.h @@ -62,29 +62,15 @@ int knot_zdump_binary(knot_zone_contents_t *zone, int fd, * * \param rrset RRSet to be serialized. * \param stream Stream containing serialized RRSet. - * \param size Length of created stream. + * \param max_size Maximum size of stream. + * \param bytes_written Actually written data. * * \retval KNOT_EOK on success. * \retval KNOT_EBADARG if wrong arguments are supplied. * \retval KNOT_ENOMEM on memory error. */ -int knot_zdump_rrset_serialize(const knot_rrset_t *rrset, uint8_t **stream, - size_t *size); - -/*! - * \brief Serializes RRSet into binary stream. Expects NULL pointer, memory - * is handled inside function. - * - * \param rrset RRSet to be serialized. - * \param stream Stream containing serialized RRSet. - * \param size Length of created stream. - * - * \retval KNOT_EOK on success. - * \retval KNOT_EBADARG if wrong arguments are supplied. - * \retval KNOT_ENOMEM on memory error. - */ -int knot_zdump_rrset_serialize(const knot_rrset_t *rrset, uint8_t **stream, - size_t *size); +int knot_zdump_rrset_serialize(const knot_rrset_t *rrset, uint8_t *stream, + size_t max_size, size_t *bytes_written); /*! * \brief Checks if zone uses DNSSEC and/or NSEC3 diff --git a/src/knot/zone/zone-load.c b/src/knot/zone/zone-load.c index 69ea58f..cee138f 100644 --- a/src/knot/zone/zone-load.c +++ b/src/knot/zone/zone-load.c @@ -40,26 +40,14 @@ * \param y Second time_t value to be compared. * * \retval 0 when times are the some. - * \retval 1 when y < x. - * \retval -1 when x > y. + * \retval 1 when x > y. + * \retval -1 when x < y. */ static int timet_cmp(time_t x, time_t y) { - /* Calculate difference in the scale of seconds. */ - long diff = x - y; - - /* X and Y are equal. */ - if (diff == 0) { - return 0; - } - - /* X is newer. */ - if (diff > 0) { - return 1; - } - - /* Y is newer. */ - return -1; + if (x > y) return 1; + if (x < y) return -1; + return 0; } /*! @@ -160,6 +148,9 @@ static void load_rdata_purge(knot_rdata_t *rdata, static knot_dname_t *read_dname_with_id(FILE *f) { + if (f == NULL) { + dbg_zload("zload: read_dname_id: NULL file.\n"); + } knot_dname_t *ret = knot_dname_new(); CHECK_ALLOC_LOG(ret, NULL); @@ -167,16 +158,18 @@ static knot_dname_t *read_dname_with_id(FILE *f) uint32_t dname_id = 0; if (!fread_wrapper(&dname_id, sizeof(dname_id), 1, f)) { knot_dname_release(ret); + dbg_zload("zload: read_dname_id: Cannot read dname ID.\n"); return NULL; } ret->id = dname_id; - dbg_zload("loaded: dname id: %u\n", dname_id); + dbg_zload_detail("zload: read_dname_id: dname id: %u\n", dname_id); /* Read size of dname. */ uint32_t dname_size = 0; if (!fread_wrapper(&dname_size, sizeof(dname_size), 1, f)) { knot_dname_release(ret); + dbg_zload("zload: read_dname_id: Cannot read dname size.\n"); return NULL; } ret->size = dname_size; @@ -194,6 +187,7 @@ static knot_dname_t *read_dname_with_id(FILE *f) if (!fread_wrapper(ret->name, sizeof(uint8_t), ret->size, f)) { knot_dname_release(ret); + dbg_zload("zload: read_dname_id: Cannot read dname name.\n"); return NULL; } @@ -201,6 +195,8 @@ static knot_dname_t *read_dname_with_id(FILE *f) uint16_t label_count = 0; if (!fread_wrapper(&label_count, sizeof(label_count), 1, f)) { knot_dname_release(ret); + dbg_zload("zload: read_dname_id: Cannot read " + "dname label count.\n"); return NULL; } @@ -216,11 +212,16 @@ static knot_dname_t *read_dname_with_id(FILE *f) if (!fread_wrapper(ret->labels, sizeof(uint8_t), ret->label_count, f)) { free(ret->name); free(ret); + dbg_zload("zload: read_dname_id: Cannot read dname labels.\n"); return NULL; } - dbg_zload("loaded: %s (id: %d)\n", knot_dname_to_str(ret), +dbg_zload_exec_detail( + char *name = knot_dname_to_str(ret); + dbg_zload_detail("zload: Loaded dname: %s (id: %d).\n", name, ret->id); + free(name); +); return ret; } @@ -239,6 +240,7 @@ static knot_rdata_t *knot_load_rdata(uint16_t type, FILE *f, { knot_rdata_t *rdata = knot_rdata_new(); if (rdata == NULL) { + dbg_zload("zload: load_rdata: Cannot create new rdata.\n"); return NULL; } @@ -246,13 +248,13 @@ static knot_rdata_t *knot_load_rdata(uint16_t type, FILE *f, knot_rrtype_descriptor_by_type(type); assert(desc != NULL); - - /* First, should read rdata count. */ + /* First we should read rdata count. */ uint32_t rdata_count = 0; if(!fread_wrapper(&rdata_count, sizeof(rdata_count), 1, f)) { knot_rdata_free(&rdata); + dbg_zload("zload: load_rdata: Cannot read rdata count.\n"); return NULL; } @@ -263,11 +265,11 @@ static knot_rdata_t *knot_load_rdata(uint16_t type, FILE *f, assert(desc->length == rdata_count); } - uint16_t raw_data_length; + uint16_t raw_data_length = 0; - dbg_zload("Reading %d items\n", rdata_count); - - dbg_zload("current type: %s\n", knot_rrtype_to_string(type)); + dbg_zload_detail("zload: load_rdata: Reading %d items\n", rdata_count); + dbg_zload_detail("zload: load_rdata: Current type: %s\n", + knot_rrtype_to_string(type)); for (int i = 0; i < rdata_count; i++) { if (desc->wireformat[i] == KNOT_RDATA_WF_COMPRESSED_DNAME || @@ -283,8 +285,12 @@ static knot_rdata_t *knot_load_rdata(uint16_t type, FILE *f, uint8_t in_the_zone = 0; if (use_ids) { - if(!fread_wrapper(&dname_id, sizeof(dname_id), 1, f)) { - load_rdata_purge(rdata, items, i, desc, type); + if(!fread_wrapper(&dname_id, sizeof(dname_id), + 1, f)) { + load_rdata_purge(rdata, + items, i, desc, type); + dbg_zload("zload: load_rdata: " + "Cannot read dname ID.\n"); return NULL; } @@ -298,12 +304,16 @@ static knot_rdata_t *knot_load_rdata(uint16_t type, FILE *f, if(!fread_wrapper(&in_the_zone, sizeof(in_the_zone), 1, f)) { load_rdata_purge(rdata, items, i, desc, type); + dbg_zload("zload: load_rdata: " + "Cannot read zone bit.\n"); return NULL; } if(!fread_wrapper(&has_wildcard, sizeof(uint8_t), 1, f)) { load_rdata_purge(rdata, items, i, desc, type); + dbg_zload("zload: load_rdata: " + "Cannot read wildcard bit.\n"); return NULL; } @@ -312,11 +322,14 @@ static knot_rdata_t *knot_load_rdata(uint16_t type, FILE *f, 1, f)) { load_rdata_purge(rdata, items, i, desc, type); + dbg_zload("zload: load_rdata: " + "Cannot read wc ID.\n"); return NULL; } items[i].dname->node = - id_array[dname_id]->node; - } else if (use_ids && !in_the_zone) { /* destroy the node */ + id_array[dname_id]->node; + } else if (use_ids && !in_the_zone) { + /* destroy the node */ if (id_array[dname_id]->node != NULL) { knot_node_free(&id_array[dname_id]-> node, 0); @@ -328,37 +341,51 @@ static knot_rdata_t *knot_load_rdata(uint16_t type, FILE *f, if (!fread_wrapper(&raw_data_length, sizeof(raw_data_length), 1, f)) { load_rdata_purge(rdata, items, i, desc, type); + dbg_zload("zload: load_rdata: Cannot read " + "raw data length.\n"); return NULL; } /*!< \todo this is not proper fix, see #1678 */ items[i].raw_data = (uint16_t *) malloc(sizeof(uint8_t) * (raw_data_length + 2)); + if (items[i].raw_data == NULL) { + ERR_ALLOC_FAILED; + load_rdata_purge(rdata, items, i + 1, desc, + type); + return NULL; + } items[i].raw_data[0] = raw_data_length; - if (!fread_wrapper(items[i].raw_data + 1, sizeof(uint8_t), + if (!fread_wrapper(items[i].raw_data + 1, + sizeof(uint8_t), raw_data_length, f)) { - load_rdata_purge(rdata, items, i + 1, desc, type); + load_rdata_purge(rdata, items, i + 1, desc, + type); + dbg_zload("zload: load_rdata: Cannot read " + "raw data.\n"); return NULL; } - dbg_zload("read raw_data len %d\n", raw_data_length); + dbg_zload_detail("zload: load_rdata: Read raw_data " + "length=%d.\n", + raw_data_length); } } /* Each item has refcount already incremented for saving in rdata. */ if (knot_rdata_set_items(rdata, items, rdata_count) != 0) { - fprintf(stderr, "zoneload: Could not set items " + fprintf(stderr, "zload: read_rdata: Could not set items " "when loading rdata.\n"); + knot_rdata_deep_free(&rdata, type, 0); + return NULL; } free(items); - - dbg_zload("knot_load_rdata: all %d items read\n", - desc->length); - assert(rdata->count == rdata_count); - - rdata->count = rdata_count; + + dbg_zload_detail("zload: read_rdata: All %d items read " + "successfully.\n", + desc->length); return rdata; } @@ -373,54 +400,77 @@ static knot_rdata_t *knot_load_rdata(uint16_t type, FILE *f, static knot_rrset_t *knot_load_rrsig(FILE *f, knot_dname_t **id_array, int use_ids) { - knot_rrset_t *rrsig; + if (f == NULL || id_array == NULL) { + dbg_zload("zload: load_rrsig: Bad arguments.\n"); + return NULL; + } + + knot_rrset_t *rrsig = NULL; - uint16_t rrset_type; - uint16_t rrset_class; - uint32_t rrset_ttl; + uint16_t rrset_type = 0; + uint16_t rrset_class = 0; + uint32_t rrset_ttl = 0; - uint32_t rdata_count; + uint32_t rdata_count = 0; if (!fread_wrapper(&rrset_type, sizeof(rrset_type), 1, f)) { + dbg_zload("zload: load_rrsig: Cannot read type.\n"); return NULL; } if (rrset_type != KNOT_RRTYPE_RRSIG) { - fprintf(stderr, "!! Error: rrsig has wrong type\n"); + dbg_zload("zload: load_rrsig: RRSIG has wrong type," + " probably data corruption.\n"); return NULL; } - dbg_zload("rrset type: %d\n", rrset_type); + dbg_zload_detail("zload: load_rrsig: RRSIG type: %d\n", rrset_type); if (!fread_wrapper(&rrset_class, sizeof(rrset_class), 1, f)) { + dbg_zload("zload: load_rrsig: Cannot read class.\n"); return NULL; } - dbg_zload("rrset class %d\n", rrset_class); + dbg_zload_detail("zload: load_rrsig: Class=%d\n", rrset_class); if (!fread_wrapper(&rrset_ttl, sizeof(rrset_ttl), 1, f)) { + dbg_zload("zload: load_rrsig: Cannot read TTL.\n"); return NULL; } - dbg_zload("rrset ttl %d\n", rrset_ttl); + dbg_zload_detail("zload: load_rrsig: TTL=%d\n", rrset_ttl); if (!fread_wrapper(&rdata_count, sizeof(rdata_count), 1, f)) { + dbg_zload("zload: load_rrsig: Cannot read rdata count.\n"); return NULL; } rrsig = knot_rrset_new(NULL, rrset_type, rrset_class, rrset_ttl); + if (rrsig == NULL) { + dbg_zload("zload: load_rrsig: Cannot create new RRSIG.\n"); + return NULL; + } - knot_rdata_t *tmp_rdata; + knot_rdata_t *tmp_rdata = NULL; - dbg_zload("loading %d rdata entries\n", rdata_count); + dbg_zload_detail("zload: load_rrsig: Loading %d rdata entries.\n", + rdata_count); for (int i = 0; i < rdata_count; i++) { tmp_rdata = knot_load_rdata(KNOT_RRTYPE_RRSIG, f, id_array, use_ids); if (tmp_rdata) { - knot_rrset_add_rdata(rrsig, tmp_rdata); + int ret = knot_rrset_add_rdata(rrsig, tmp_rdata); + if (ret != KNOT_EOK) { + dbg_zload("zload: load_rrsig: Cannot " + "add RDATA\n."); + knot_rrset_deep_free(&rrsig, 0, 1, 1); + return NULL; + } } else { + dbg_zload("zload: load_rrsig: Cannot load rdata.\n"); knot_rrset_deep_free(&rrsig, 0, 1, 1); return NULL; } } + dbg_zload_detail("zload: load_rrsig: RRSIG loaded successfully.\n"); return rrsig; } @@ -446,55 +496,63 @@ static knot_rrset_t *knot_load_rrset(FILE *f, knot_dname_t **id_array, knot_dname_t *owner = NULL; if (!use_ids) { - dbg_zload("Loading owner of new RRSet from wire.\n"); + dbg_zload_detail("zload: load_rrset: " + "Loading owner of new RRSet from wire.\n"); owner = read_dname_with_id(f); + if (owner == NULL) { + dbg_zload("zload: load_rrset: Cannot load owner.\n"); + return NULL; + } } if (!fread_wrapper(&rrset_type, sizeof(rrset_type), 1, f)) { + dbg_zload("zload: load_rrset: Cannot load RRSet type.\n"); if (!use_ids) { knot_dname_free(&owner); } return NULL; } - dbg_zload("Zone load: rrset load: type: %u\n", rrset_type); + + dbg_zload_detail("zload: load_rrset: Type=%u\n", rrset_type); if (!fread_wrapper(&rrset_class, sizeof(rrset_class), 1, f)) { + dbg_zload("zload: load_rrset: Cannot load RRSet class.\n"); if (!use_ids) { knot_dname_free(&owner); } return NULL; } - dbg_zload("Zone load: rrset class: type: %u\n", rrset_class); + dbg_zload_detail("zload: load_rrset: Class=%u\n", rrset_class); if (!fread_wrapper(&rrset_ttl, sizeof(rrset_ttl), 1, f)) { + dbg_zload("zload: load_rrset: Cannot load RRSet TTL.\n"); if (!use_ids) { knot_dname_free(&owner); } return NULL; } - dbg_zload("Zone load: rrset ttl: type: %u\n", rrset_ttl); + dbg_zload_detail("zload: load_rrset: TTL=%u\n", rrset_ttl); if (!fread_wrapper(&rdata_count, sizeof(rdata_count), 1, f)) { if (!use_ids) { knot_dname_free(&owner); } return NULL; } - dbg_zload("Zone load: rrset load: rdata count: %u\n", rdata_count); + dbg_zload_detail("zload: load_rrset: rdata count=%u\n", rdata_count); if (!fread_wrapper(&rrsig_count, sizeof(rrsig_count), 1, f)) { if (!use_ids) { knot_dname_free(&owner); } return NULL; } - dbg_zload("Zone load: rrset load: type: %u\n", rrset_type); + dbg_zload_detail("zload: load_rrset: RRSIG count=%u\n", rrsig_count); dbg_zload_exec_detail( char *name = knot_dname_to_str(owner); - dbg_zload("Loading RRSet owned by: %s\n", + dbg_zload_detail("zload: load_rrset: Loading RRSet owned by: %s.\n", name); free(name); ); rrset = knot_rrset_new(owner, rrset_type, rrset_class, rrset_ttl); - if (rrset == NULL) { dbg_zload("zload: load_rrset: Could not create rrset."); knot_dname_free(&owner); @@ -507,7 +565,7 @@ dbg_zload_exec_detail( owner = NULL; } - dbg_zload("RRSet type: %d\n", rrset->type); + dbg_zload_detail("zload: load_rrset: RRSet type=%d\n", rrset->type); knot_rdata_t *tmp_rdata = NULL; @@ -515,7 +573,13 @@ dbg_zload_exec_detail( tmp_rdata = knot_load_rdata(rrset->type, f, id_array, use_ids); if (tmp_rdata) { - knot_rrset_add_rdata(rrset, tmp_rdata); + int ret = knot_rrset_add_rdata(rrset, tmp_rdata); + if (ret != KNOT_EOK) { + dbg_zload("zload: load_rrset: Cannot add " + "RDATA.\n"); + knot_rrset_deep_free(&rrset, 0, 1, 1); + return NULL; + } } else { knot_rrset_deep_free(&rrset, 0, 1, 1); return NULL; @@ -524,9 +588,15 @@ dbg_zload_exec_detail( knot_rrset_t *tmp_rrsig = NULL; - dbg_zload("Reading: %d RRSIGs\n", rrsig_count); + dbg_zload_detail("zload: load_rrset: Reading: %d RRSIGs.\n", + rrsig_count); if (rrsig_count) { tmp_rrsig = knot_load_rrsig(f, id_array, use_ids); + if (tmp_rrsig == NULL) { + dbg_zload("zload: load_rrset: Cannot load RRSIG.\n"); + knot_rrset_deep_free(&rrset, 0, 1, 1); + return NULL; + } if (!use_ids) { knot_rrset_set_owner(tmp_rrsig, rrset->owner); } @@ -534,8 +604,8 @@ dbg_zload_exec_detail( knot_rrset_set_rrsigs(rrset, tmp_rrsig); - dbg_zload("Finished loading RRSet %p\n", rrset); - + dbg_zload_detail("zload: load_rrset: Finished loading RRSet %p.\n", + rrset); return rrset; } @@ -548,6 +618,10 @@ dbg_zload_exec_detail( */ static knot_node_t *knot_load_node(FILE *f, knot_dname_t **id_array) { + if (f == NULL || id_array == NULL) { + dbg_zload("zload: load_node: Wrong parameters.\n"); + return NULL; + } uint8_t flags = 0; knot_node_t *node = NULL; uint32_t parent_id = 0; @@ -557,45 +631,51 @@ static knot_node_t *knot_load_node(FILE *f, knot_dname_t **id_array) /* At the beginning of node - just dname_id !!!.*/ if (!fread_wrapper(&dname_id, sizeof(dname_id), 1, f)) { + dbg_zload("zload: load_node: Cannot read owner ID.\n"); return NULL; } if (!fread_wrapper(&parent_id, sizeof(parent_id), 1, f)) { + dbg_zload("zload: load_node: Cannot read owner ID.\n"); return NULL; } if (!fread_wrapper(&flags, sizeof(flags), 1, f)) { + dbg_zload("zload: load_node: Cannot read node flags.\n"); return NULL; } if (!fread_wrapper(&nsec3_node_id, sizeof(nsec3_node_id), 1, f)) { + dbg_zload("zload: load_node: Cannot read NSEC3 node.\n"); return NULL; } if (!fread_wrapper(&rrset_count, sizeof(rrset_count), 1, f)) { + dbg_zload("zload: load_node: Cannot read rrset count.\n"); return NULL; } knot_dname_t *owner = id_array[dname_id]; - dbg_zload("Node owner id: %d\n", dname_id); - dbg_zload("Node owned by: %s\n", knot_dname_to_str(owner)); - dbg_zload("Number of RRSets in a node: %d\n", rrset_count); + dbg_zload_detail("zload: load_node: Node owner id: %d.\n", dname_id); +dbg_zload_exec_detail( + char *name = knot_dname_to_str(owner); + dbg_zload_detail("zload: load_node: Node owned by: %s.\n"); + free(name); +); + dbg_zload_detail("zload: load_node: Number of RRSets in a node: %d.\n", + rrset_count); node = owner->node; if (node == NULL) { - fprintf(stderr, "zone: Could not create node.\n"); + dbg_zload("zload: load_node: NULL node, cannot proceed.\n"); return NULL; } /* XXX can it be 0, ever? I think not. */ if (nsec3_node_id != 0) { knot_node_set_nsec3_node(node, id_array[nsec3_node_id]->node); - /* CLEANUP */ -// node->nsec3_node = id_array[nsec3_node_id]->node; } else { knot_node_set_nsec3_node(node, NULL); - /* CLEANUP */ -// node->nsec3_node = NULL; } /* Retain new owner while releasing replaced owner. */ @@ -611,7 +691,7 @@ static knot_node_t *knot_load_node(FILE *f, knot_dname_t **id_array) knot_node_set_parent(node, NULL); } - knot_rrset_t *tmp_rrset; + knot_rrset_t *tmp_rrset = NULL; for (int i = 0; i < rrset_count; i++) { if ((tmp_rrset = knot_load_rrset(f, id_array, 1)) == NULL) { @@ -619,7 +699,7 @@ static knot_node_t *knot_load_node(FILE *f, knot_dname_t **id_array) /*!< \todo #1686 * Refactor freeing, might not be enough. */ - fprintf(stderr, "zone: Could not load rrset.\n"); + dbg_zload("zload: load_node: Cannot load RRSet.\n"); return NULL; } /* Retain new owner while releasing replaced owner. */ @@ -628,12 +708,13 @@ static knot_node_t *knot_load_node(FILE *f, knot_dname_t **id_array) knot_rrset_set_owner(tmp_rrset->rrsigs, node->owner); } if (knot_node_add_rrset(node, tmp_rrset, 0) < 0) { - fprintf(stderr, "zone: Could not add rrset.\n"); + dbg_zload("zload: load_node: Cannot add RRSet " + "to node.\n"); return NULL; } } assert(node != NULL); - dbg_zload("Node loaded: %p\n", node); + dbg_zload_detail("zload: load_node: Node loaded: %p\n", node); return node; } @@ -647,6 +728,10 @@ static knot_node_t *knot_load_node(FILE *f, knot_dname_t **id_array) static void find_and_set_wildcard_child(knot_zone_contents_t *zone, knot_node_t *node, int nsec3) { + if (zone == NULL || node == NULL) { + dbg_zload("zload: set_wc: Bad arguments.\n"); + return; + } knot_dname_t *chopped = knot_dname_left_chop(node->owner); knot_node_t *wildcard_parent; if (!nsec3) { @@ -708,7 +793,10 @@ static unsigned long calculate_crc(FILE *f) unsigned char *chunk = malloc(sizeof(unsigned char) * chunk_size); CHECK_ALLOC_LOG(chunk, 0); while ((file_size - read_bytes) > chunk_size) { - if (!fread_wrapper(chunk, sizeof(unsigned char), chunk_size, f)) { + if (!fread_wrapper(chunk, + sizeof(unsigned char), chunk_size, f)) { + dbg_zload("zload: calculate_crc: Failed to read " + "data chunk.\n"); free(chunk); return 0; } @@ -720,6 +808,8 @@ static unsigned long calculate_crc(FILE *f) /* Read the rest of the file */ if (!fread_wrapper(chunk, sizeof(unsigned char), file_size - read_bytes, f)) { + dbg_zload("zload: calculate_crc: Failed to read " + "data remainder.\n"); free(chunk); return 0; } @@ -737,6 +827,7 @@ int knot_zload_open(zloader_t **dst, const char *filename) char crc_buf[65]; if (!dst || !filename) { + dbg_zload("zload: open: Bad arguments.\n"); return KNOT_EBADARG; } @@ -749,7 +840,7 @@ int knot_zload_open(zloader_t **dst, const char *filename) if (unlikely(!f)) { int reason = errno; dbg_zload("knot_zload_open: failed to open '%s'\n", - filename); + filename); switch (reason) { case EACCES: return KNOT_EACCES; break; case ENOENT: return KNOT_ENOENT; break; @@ -765,9 +856,11 @@ int knot_zload_open(zloader_t **dst, const char *filename) /* Read CRC from filename.crc file */ char *crc_path = - malloc(sizeof(char) * (strlen(filename) + 4 /* strlen(".crc") */ + 1)); + malloc(sizeof(char) * + (strlen(filename) + 4 /* strlen(".crc") */ + 1)); if (unlikely(!crc_path)) { fclose(f); + ERR_ALLOC_FAILED; return KNOT_ENOMEM; } memcpy(crc_path, filename, strlen(filename)); @@ -891,43 +984,12 @@ static void cleanup_id_array(knot_dname_t **id_array, free(id_array); } -//static knot_dname_table_t *create_dname_table(FILE *f, uint max_id) -//{ -// if (f == NULL ) { -// return NULL; -// } - -// if (!fread_wrapper(&max_id, sizeof(max_id), 1, f)) { -// return NULL; -// } - -// knot_dname_table_t *dname_table = knot_dname_table_new(); -// if (dname_table == NULL) { -// return NULL; -// } - -// /* Create nodes containing dnames. */ -// for (uint i = 1; i < max_id; i++) { -// knot_dname_t *loaded_dname = read_dname_with_id(f); -// if (loaded_dname == NULL) { -// knot_dname_table_deep_free(&dname_table); -// return NULL; -// } -// if (knot_dname_table_add_dname(dname_table, -// loaded_dname) != KNOT_EOK) { - -// } -// } - -// return dname_table; -//} - static knot_dname_table_t *create_dname_table_from_array( knot_dname_t **array, uint max_id) { if (array == NULL) { /* should I set errno or what ... ? */ - dbg_zload("No array passed\n"); + dbg_zload("zload: create_dname_table: No array passed.\n"); return NULL; } @@ -941,19 +1003,28 @@ static knot_dname_table_t *create_dname_table_from_array( assert(array[i]); if (knot_dname_table_add_dname(ret, array[i]) != KNOT_EOK) { - dbg_zload("Could not add: %s\n", - knot_dname_to_str(array[i])); +dbg_zload_exec_detail( + char *name = knot_dname_to_str(array[i]); + dbg_zload_detail("zload: create_dname_table: " + "Could not add dname: %s.\n", + name); + free(name); +); + dbg_zload("zload: create_dname_table: " + "Could not add dname.\n"); knot_dname_table_deep_free(&ret); return NULL; } } + dbg_zload("zload: create_dname_table: Table loaded.\n"); return ret; } static knot_dname_t **create_dname_array(FILE *f, uint max_id) { if (f == NULL) { + dbg_zload("zload: create_dname_array: Wrong arguments.\n"); return NULL; } @@ -964,23 +1035,24 @@ static knot_dname_t **create_dname_array(FILE *f, uint max_id) return NULL; } - memset(array, 0, sizeof(knot_dname_t *) * (max_id + 1)); + memset(array, 0, sizeof(knot_dname_t *) * (max_id + 1)); for (uint i = 0; i < max_id - 1; i++) { knot_dname_t *read_dname = read_dname_with_id(f); if (read_dname == NULL) { + dbg_zload("zload: create_dname_array: " + "Cannot read dname.\n" ); cleanup_id_array(array, 0, i); return NULL; } if (read_dname->id < max_id) { - /* Create new node from dname. */ read_dname->node = knot_node_new(read_dname, NULL, 0); - if (read_dname->node == NULL) { - ERR_ALLOC_FAILED; - + dbg_zload("zload: create_dname_array: " + "Cannot create new node " + "from dname.\n"); /* Release read dname. */ knot_dname_release(read_dname); cleanup_id_array(array, 0, i); @@ -991,21 +1063,24 @@ static knot_dname_t **create_dname_array(FILE *f, uint max_id) array[read_dname->id] = read_dname; } else { /* Release read dname. */ + dbg_zload("zload: create_dname_array: " + "dname id is out of range.\n"); knot_dname_release(read_dname); cleanup_id_array(array, 0, i); return NULL; } } - + + dbg_zload("zload: create_dname_array: Array created.\n"); return array; } knot_zone_t *knot_zload_load(zloader_t *loader) { - dbg_zload("Loading zone, loader: %p\n", loader); + dbg_zload("zload: load: Loading zone, loader: %p.\n", loader); if (!loader) { - dbg_zload("NULL loader!\n"); + dbg_zload("zload: load: NULL loader!\n"); return NULL; } @@ -1020,22 +1095,24 @@ knot_zone_t *knot_zload_load(zloader_t *loader) uint32_t auth_node_count; if (!fread_wrapper(&node_count, sizeof(node_count), 1, f)) { - dbg_zload("wrong read!\n"); + dbg_zload("zload: load: Cannot read node count!\n"); return NULL; } if (!fread_wrapper(&nsec3_node_count, sizeof(nsec3_node_count), 1, f)) { - dbg_zload("wrong read!\n"); + dbg_zload("zload: load: Cannot read NSEC3 node count!\n"); return NULL; } if (!fread_wrapper(&auth_node_count, sizeof(auth_node_count), 1, f)) { - dbg_zload("wrong read!\n"); + dbg_zload("zload: load: Cannot read authoritative " + "node count!\n"); return NULL; } - dbg_zload("authoritative nodes: %u\n", auth_node_count); - - dbg_zload("loading %u nodes\n", node_count); + + dbg_zload_verb("zload: load: Authoritative nodes: %u.\n", + auth_node_count); + dbg_zload_verb("zload: load: :oading %u nodes.\n", node_count); uint32_t total_dnames = 0; /* First, read number of dnames in dname table. */ @@ -1043,18 +1120,19 @@ knot_zone_t *knot_zload_load(zloader_t *loader) return NULL; } - dbg_zload("total dname count: %d\n", total_dnames); + dbg_zload_verb("zload: load: Total dname count: %d.\n", total_dnames); /* Create id array. */ knot_dname_t **id_array = create_dname_array(f, total_dnames); if (id_array == NULL) { + dbg_zload("zload: load: Cannot create ID array.\n"); return NULL; } knot_dname_table_t *dname_table = create_dname_table_from_array(id_array, total_dnames); if (dname_table == NULL) { - ERR_ALLOC_FAILED; + dbg_zload("zload: load: Cannot create ID array.\n"); cleanup_id_array(id_array, 1, total_dnames); free(dname_table); return NULL; @@ -1071,13 +1149,14 @@ knot_zone_t *knot_zload_load(zloader_t *loader) return NULL; } - dbg_zload("Apex node loaded: %p\n", apex); + dbg_zload_verb("zload: load: Apex node loaded: %p.\n", apex); knot_zone_t *zone = knot_zone_new(apex, auth_node_count, 0); if (zone == NULL) { cleanup_id_array(id_array, 1, node_count + nsec3_node_count + 1); - dbg_zload("Failed to create new zone from apex!\n"); + dbg_zload("zload: load: Failed to create new " + "zone from apex!\n"); knot_node_free(&apex, 0); free(dname_table); return NULL; @@ -1090,19 +1169,21 @@ knot_zone_t *knot_zload_load(zloader_t *loader) contents->dname_table = dname_table; knot_node_set_previous(apex, NULL); - knot_node_t *last_node = 0; - last_node = apex; for (uint i = 1; i < node_count; i++) { tmp_node = knot_load_node(f, id_array); - if (tmp_node != NULL) { if (knot_zone_contents_add_node(contents, tmp_node, 0, 0, 0) != 0) { - fprintf(stderr, "!! cannot add node\n"); - continue; + cleanup_id_array(id_array, 1, + node_count + + nsec3_node_count + 1); + knot_zone_deep_free(&zone, 0); + dbg_zload("zload: load: Failed to add node " + "to zone.\n"); + return NULL; } if (knot_dname_is_wildcard(tmp_node->owner)) { find_and_set_wildcard_child(contents, @@ -1118,8 +1199,12 @@ knot_zone_t *knot_zload_load(zloader_t *loader) } } else { - fprintf(stderr, "zone: Node error (in %s).\n", + dbg_zload("zload: load: Node error (in %s).\n", loader->filename); + knot_zone_deep_free(&zone, 0); + cleanup_id_array(id_array, node_count + 1, + nsec3_node_count + 1); + return NULL; } } @@ -1128,7 +1213,8 @@ knot_zone_t *knot_zload_load(zloader_t *loader) knot_node_set_previous(knot_zone_contents_get_apex(contents), last_node); - dbg_zload("loading %u nsec3 nodes\n", nsec3_node_count); + dbg_zload_detail("zload: load: Loading %u nsec3 nodes\n", + nsec3_node_count); knot_node_t *nsec3_first = NULL; @@ -1137,10 +1223,12 @@ knot_zone_t *knot_zload_load(zloader_t *loader) assert(nsec3_first != NULL); - if (knot_zone_contents_add_nsec3_node(contents, nsec3_first, 0, 0, 0) + if (knot_zone_contents_add_nsec3_node(contents, nsec3_first, + 0, 0, 0) != 0) { - fprintf(stderr, "!! cannot add first nsec3 node, " - "exiting.\n"); + dbg_zload(stderr, "zload: load: " + "cannot add first nsec3 node, " + "exiting.\n"); knot_zone_deep_free(&zone, 0); cleanup_id_array(id_array, node_count + 1, nsec3_node_count + 1); @@ -1157,8 +1245,12 @@ knot_zone_t *knot_zload_load(zloader_t *loader) if (tmp_node != NULL) { if (knot_zone_contents_add_nsec3_node(contents, tmp_node, 0, 0, 0) != 0) { - fprintf(stderr, "!! cannot add nsec3 node\n"); - continue; + dbg_zload("zload: load: Cannot add " + "NSEC3 node.\n"); + knot_zone_deep_free(&zone, 0); + cleanup_id_array(id_array, node_count + 1, + nsec3_node_count + 1); + return NULL; } knot_node_set_previous(tmp_node, last_node); @@ -1182,8 +1274,7 @@ knot_zone_t *knot_zload_load(zloader_t *loader) } free(id_array); - dbg_zload("zone loaded, returning: %p\n", zone); - + dbg_zload("zload: load: Zone loaded, returning: %p,\n", zone); return zone; } @@ -1231,6 +1322,7 @@ int knot_zload_rrset_deserialize(knot_rrset_t **rrset, uint8_t *stream, size_t *size) { if (stream == NULL || size == 0) { + dbg_zload("zload: rrset_deserialize: Bad arguments.\n"); return KNOT_EBADARG; } @@ -1240,8 +1332,8 @@ int knot_zload_rrset_deserialize(knot_rrset_t **rrset, knot_zload_stream_remaining = knot_zload_stream_size = *size; knot_rrset_t *ret = knot_load_rrset(NULL, NULL, 0); - if (ret == NULL) { + dbg_zload("zload: rrset_deserialize: Cannot load RRSet.\n"); knot_zload_stream = NULL; knot_zload_stream_remaining = 0; knot_zload_stream_size = 0; @@ -1254,7 +1346,9 @@ int knot_zload_rrset_deserialize(knot_rrset_t **rrset, knot_zload_stream = NULL; knot_zload_stream_remaining = 0; knot_zload_stream_size = 0; - + + dbg_zload_detail("zload: rrset_deserialize: RRSet deserialized " + "successfully.\n"); return KNOT_EOK; } diff --git a/src/libknot/dname.c b/src/libknot/dname.c index 0ab3d11..7a6ea5a 100644 --- a/src/libknot/dname.c +++ b/src/libknot/dname.c @@ -163,8 +163,7 @@ static int knot_dname_str_to_wire(const char *name, uint size, return -1; } - dbg_dname("Allocated space for wire format of dname: %p\n", - wire); + dbg_dname("Allocated space for wire format of dname: %p\n", wire); if (root) { *wire = '\0'; @@ -399,13 +398,22 @@ knot_dname_t *knot_dname_new_from_str(const char *name, uint size, return NULL; } - knot_dname_str_to_wire(name, size, dname); - dbg_dname("Created dname with size: %d\n", dname->size); - dbg_dname("Label offsets: "); + /*! \todo The function should return error codes. */ + int ret = knot_dname_str_to_wire(name, size, dname); + if (ret != 0) { + dbg_dname("Failed to create domain name from string.\n"); + knot_dname_free(&dname); + return NULL; + } + +dbg_dname_exec_verb( + dbg_dname_verb("Created dname with size: %d\n", dname->size); + dbg_dname_verb("Label offsets: "); for (int i = 0; i < dname->label_count; ++i) { - dbg_dname("%d, ", dname->labels[i]); + dbg_dname_verb("%d, ", dname->labels[i]); } - dbg_dname("\n"); + dbg_dname_verb("\n"); +); if (dname->size <= 0) { dbg_dname("Could not parse domain name " @@ -467,6 +475,7 @@ knot_dname_t *knot_dname_new_from_wire(const uint8_t *name, uint size, dname->size = size; if (knot_dname_find_labels(dname, 1) != 0) { + dbg_dname("Could not find labels in dname (new from wire).\n"); knot_dname_free(&dname); return NULL; } @@ -567,6 +576,7 @@ knot_dname_t *knot_dname_parse_from_wire(const uint8_t *wire, memcpy(dname->name, name, i + 1); dname->size = i + 1; + /*! \todo Why l + 1 ?? */ dname->labels = (uint8_t *)malloc((l + 1) * sizeof(uint8_t)); if (dname->labels == NULL) { ERR_ALLOC_FAILED; @@ -603,8 +613,35 @@ int knot_dname_from_wire(const uint8_t *name, uint size, knot_dname_t *knot_dname_deep_copy(const knot_dname_t *dname) { - return knot_dname_new_from_wire(dname->name, dname->size, - dname->node); + //return knot_dname_new_from_wire(dname->name, dname->size, dname->node); + /* dname_new_from_wire() does not accept non-FQDN dnames, so we + * do the copy by hand. It's faster anyway */ + + knot_dname_t *copy = knot_dname_new(); + CHECK_ALLOC(copy, NULL); + + copy->labels = (uint8_t *)(malloc(dname->label_count)); + + if (copy->labels == NULL) { + knot_dname_free(©); + return NULL; + } + + copy->name = (uint8_t *)(malloc(dname->size)); + if (copy->name == NULL) { + knot_dname_free(©); + return NULL; + } + + memcpy(copy->labels, dname->labels, dname->label_count); + copy->label_count = dname->label_count; + + memcpy(copy->name, dname->name, dname->size); + copy->size = dname->size; + + copy->node = dname->node; + + return copy; } /*----------------------------------------------------------------------------*/ diff --git a/src/libknot/dname.h b/src/libknot/dname.h index 5a182ae..473bca7 100644 --- a/src/libknot/dname.h +++ b/src/libknot/dname.h @@ -116,6 +116,9 @@ knot_dname_t *knot_dname_new_from_str(const char *name, unsigned int size, * e.g. to knot_dname_to_str() may result in crash. Decide whether it * is OK to retain this and check the data in other functions before * calling this one, or if it should verify the given data. + * + * \warning Actually, right now this function does not accept non-FQDN dnames. + * For some reason there is a check for this. */ knot_dname_t *knot_dname_new_from_wire(const uint8_t *name, unsigned int size, diff --git a/src/libknot/hash/cuckoo-hash-table.c b/src/libknot/hash/cuckoo-hash-table.c index 831aef8..50a7a0f 100644 --- a/src/libknot/hash/cuckoo-hash-table.c +++ b/src/libknot/hash/cuckoo-hash-table.c @@ -821,17 +821,19 @@ void ck_destroy_table(ck_hash_table_t **table, void (*dtor_value)(void *value), while (item != NULL) { // disconnect the item (*table)->stash = item->next; - /*! \todo Investigate this. */ - assert(item->item != NULL); - if (dtor_value) { - dtor_value(item->item->value); - } - if (delete_key) { - free((void *)item->item->key); + /*! \todo Check item semantics. (#1688) */ + if (item->item != NULL) { + if (dtor_value) { + dtor_value(item->item->value); + } + if (delete_key) { + free((void *)item->item->key); + } + + free((void *)item->item); } - free((void *)item->item); free(item); item = (*table)->stash; } diff --git a/src/libknot/nameserver/name-server.c b/src/libknot/nameserver/name-server.c index dea16ec..e1ccdd4 100644 --- a/src/libknot/nameserver/name-server.c +++ b/src/libknot/nameserver/name-server.c @@ -646,6 +646,8 @@ static int ns_put_authority_soa(const knot_zone_contents_t *zone, knot_rrset_set_ttl(soa_copy, min); soa_rrset = soa_copy; + /* Need to add it as temporary, so it get's freed. */ + knot_packet_add_tmp_rrset(resp, soa_copy); } assert(soa_rrset != NULL); diff --git a/src/libknot/nameserver/name-server.h b/src/libknot/nameserver/name-server.h index 1ae309c..42fa0f2 100644 --- a/src/libknot/nameserver/name-server.h +++ b/src/libknot/nameserver/name-server.h @@ -87,6 +87,7 @@ typedef struct knot_ns_xfr { knot_rcode_t rcode; xfr_callback_t send; int session; + int session_closed; /*! * XFR-out: Output buffer. diff --git a/src/libknot/updates/xfr-in.c b/src/libknot/updates/xfr-in.c index 75d7fd7..4874ccd 100644 --- a/src/libknot/updates/xfr-in.c +++ b/src/libknot/updates/xfr-in.c @@ -1374,13 +1374,20 @@ static int xfrin_changes_check_rdata(knot_rdata_t ***rdatas, uint **types, static void xfrin_changes_add_rdata(knot_rdata_t **rdatas, uint *types, int *count, knot_rdata_t *rdata, uint type) { - dbg_xfrin_detail("Adding RDATA to new RDATA list: %p\n", rdata); + dbg_xfrin_detail("Adding RDATA to RDATA list: %p\n", rdata); + + if (rdata == NULL) { + return; + } dbg_xfrin_exec_detail( // try to find the first RDATA in the given list for (int i = 0; i < *count; ++i) { knot_rdata_t *r = rdatas[i]; - while (r->next != rdatas[i]) { + if (r == NULL) { + continue; + } + while (r != NULL && r->next != rdatas[i]) { if (r == rdata) { dbg_xfrin_detail("Found same RDATA: %p\n", rdata); knot_rdata_dump(rdata, type, 0); @@ -1454,6 +1461,7 @@ static knot_rdata_t *xfrin_remove_rdata(knot_rrset_t *from, static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy, knot_changes_t *changes) { + dbg_xfrin("Copying old RRSet: %p\n", old); // create new RRSet by copying the old one // int ret = knot_rrset_shallow_copy(old, copy); int ret = knot_rrset_deep_copy(old, copy); @@ -1486,6 +1494,7 @@ static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy, changes->new_rrsets[changes->new_rrsets_count++] = *copy; + dbg_xfrin_verb("Adding RDATA from the RRSet copy to new RDATA list.\n"); xfrin_changes_add_rdata(changes->new_rdata, changes->new_rdata_types, &changes->new_rdata_count, knot_rrset_get_rdata(*copy), @@ -1495,6 +1504,8 @@ static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy, assert(old->rrsigs != NULL); changes->new_rrsets[changes->new_rrsets_count++] = (*copy)->rrsigs; + dbg_xfrin_verb("Adding RDATA from RRSIG of the RRSet copy to " + "new RDATA list.\n"); xfrin_changes_add_rdata(changes->new_rdata, changes->new_rdata_types, &changes->new_rdata_count, @@ -1523,6 +1534,7 @@ static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy, changes->old_rrsets[changes->old_rrsets_count++] = old; + dbg_xfrin_verb("Adding RDATA from old RRSet to old RDATA list.\n"); xfrin_changes_add_rdata(changes->old_rdata, changes->old_rdata_types, &changes->old_rdata_count, old->rdata, knot_rrset_type(old)); @@ -1531,6 +1543,8 @@ static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy, assert(old->rrsigs != NULL); changes->old_rrsets[changes->old_rrsets_count++] = old->rrsigs; + dbg_xfrin_verb("Adding RDATA from RRSIG of the old RRSet to " + "old RDATA list.\n"); xfrin_changes_add_rdata(changes->old_rdata, changes->old_rdata_types, &changes->old_rdata_count, @@ -1546,8 +1560,18 @@ static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy, static int xfrin_copy_rrset(knot_node_t *node, knot_rr_type_t type, knot_rrset_t **rrset, knot_changes_t *changes) { +dbg_xfrin_exec_verb( + char *name = knot_dname_to_str(knot_node_owner(node)); + dbg_xfrin_verb("Removing RRSet of type %s from node %s (%p)\n", + knot_rrtype_to_string(type), name, node); + free(name); +); knot_rrset_t *old = knot_node_remove_rrset(node, type); + dbg_xfrin_verb("Removed RRSet: %p\n", old); + dbg_xfrin_detail("Other RRSet of the same type in the node: %p\n", + knot_node_rrset(node, type)); + if (old == NULL) { dbg_xfrin("RRSet not found for RR to be removed.\n"); return 1; @@ -1558,7 +1582,7 @@ static int xfrin_copy_rrset(knot_node_t *node, knot_rr_type_t type, return ret; } - dbg_xfrin_detail("Copied old rrset %p to new %p.\n", old, *rrset); + dbg_xfrin_verb("Copied old rrset %p to new %p.\n", old, *rrset); // replace the RRSet in the node copy by the new one ret = knot_node_add_rrset(node, *rrset, 0); @@ -1601,6 +1625,7 @@ static int xfrin_apply_remove_rrsigs(knot_changes_t *changes, knot_rrset_rdata(remove)); // copy the rrset + dbg_xfrin_verb("Copying RRSet that carries the RRSIGs.\n"); ret = xfrin_copy_rrset(node, type, rrset, changes); if (ret != KNOT_EOK) { dbg_xfrin("Failed to copy rrset from changeset.\n"); @@ -1615,10 +1640,12 @@ static int xfrin_apply_remove_rrsigs(knot_changes_t *changes, // this RRSet should be the already copied RRSet so we may // update it right away /*! \todo Does this case even occur? */ + dbg_xfrin_verb("Using RRSet from previous iteration.\n"); } // get the old rrsigs knot_rrset_t *old = knot_rrset_get_rrsigs(*rrset); + dbg_xfrin_verb("Old RRSIGs from RRSet: %p\n", old); if (old == NULL) { return 1; } @@ -1630,8 +1657,10 @@ static int xfrin_apply_remove_rrsigs(knot_changes_t *changes, if (ret != KNOT_EOK) { return ret; } + dbg_xfrin_verb("Copied RRSIGs: %p\n", rrsigs); } else { rrsigs = old; + dbg_xfrin_verb("Using old RRSIGs: %p\n", rrsigs); } // set the RRSIGs to the new RRSet copy @@ -1935,14 +1964,22 @@ static int xfrin_apply_add_normal(knot_changes_t *changes, dbg_xfrin("applying rrset:\n"); knot_rrset_dump(add, 0); - if (!*rrset - || knot_dname_compare(knot_rrset_owner(*rrset), - knot_node_owner(node)) != 0 - || knot_rrset_type(*rrset) - != knot_rrset_type(add)) { - dbg_xfrin("Removing rrset!\n"); - *rrset = knot_node_remove_rrset(node, knot_rrset_type(add)); - } + /*! \note Reusing RRSet from previous function caused it not to be + * removed from the node. + * Maybe modification of the code would allow reusing the RRSet + * as in apply_add_rrsigs() - the RRSet should not be copied + * in such case. + */ +// if (!*rrset +// || knot_dname_compare(knot_rrset_owner(*rrset), +// knot_node_owner(node)) != 0 +// || knot_rrset_type(*rrset) +// != knot_rrset_type(add)) { +// dbg_xfrin("Removing rrset!\n"); +// *rrset = knot_node_remove_rrset(node, knot_rrset_type(add)); +// } + + *rrset = knot_node_remove_rrset(node, knot_rrset_type(add)); dbg_xfrin("Removed RRSet: \n"); knot_rrset_dump(*rrset, 1); @@ -1992,6 +2029,8 @@ dbg_xfrin_exec( return ret; } + dbg_xfrin("Copied RRSet: %p\n", *rrset); + // dbg_xfrin("After copy: Found RRSet with owner %s, type %s\n", // knot_dname_to_str((*rrset)->owner), // knot_rrtype_to_string(knot_rrset_type(*rrset))); @@ -2007,11 +2046,13 @@ dbg_xfrin_exec( * * TODO: add the 'add' rrset to list of old RRSets? */ - dbg_xfrin("Merging RRSets with owners: %s %s types: %d %d\n", - (*rrset)->owner->name, add->owner->name, (*rrset)->type, - add->type); + dbg_xfrin("Merging RRSets with owners: %s, %s types: %s, %s\n", + (*rrset)->owner->name, add->owner->name, + knot_rrtype_to_string((*rrset)->type), + knot_rrtype_to_string(add->type)); dbg_xfrin_detail("RDATA in RRSet1: %p, RDATA in RRSet2: %p\n", (*rrset)->rdata, add->rdata); + ret = knot_rrset_merge((void **)rrset, (void **)&add); if (ret != KNOT_EOK) { dbg_xfrin("Failed to merge changeset RRSet to copy.\n"); @@ -2021,6 +2062,11 @@ dbg_xfrin_exec( knot_rrset_dump(*rrset, 1); ret = knot_node_add_rrset(node, *rrset, 0); + if (ret < 0) { + dbg_xfrin("Failed to add merged RRSet to the node.\n"); + return ret; + } + // return 2 so that the add RRSet is removed from // the changeset (and thus not deleted) // and put to list of new RRSets (is this ok?) @@ -2058,6 +2104,9 @@ dbg_xfrin_exec( int copied = 0; + /*! \note Here the check is OK, because if we aready have the RRSet, + * it's a copied one, so it is OK to modify it right away. + */ if (!*rrset || knot_dname_compare(knot_rrset_owner(*rrset), knot_node_owner(node)) != 0 @@ -2081,7 +2130,6 @@ dbg_xfrin_exec( if (*rrset == NULL) { dbg_xfrin("RRSet to be added not found in zone.\n"); - dbg_xfrin("Creating new RRSet for RRSIG.\n"); // create a new RRSet to add the RRSIGs into *rrset = knot_rrset_new(knot_node_get_owner(node), type, knot_rrset_class(add), @@ -2090,6 +2138,7 @@ dbg_xfrin_exec( dbg_xfrin("Failed to create new RRSet for RRSIGs.\n"); return KNOT_ENOMEM; } + dbg_xfrin("Created new RRSet for RRSIG: %p.\n", *rrset); // add the RRset to the list of new RRsets ret = xfrin_changes_check_rrsets( @@ -2448,6 +2497,17 @@ static int xfrin_apply_remove2(knot_zone_contents_t *contents, int is_nsec3 = 0; for (int i = 0; i < chset->remove_count; ++i) { +dbg_xfrin_exec_verb( + char *name = knot_dname_to_str( + knot_rrset_owner(chset->remove[i])); + dbg_xfrin_verb("Removing RRSet: %s, type %s\n", name, + knot_rrtype_to_string( + knot_rrset_type(chset->remove[i]))); + free(name); +); +dbg_xfrin_exec_detail( + knot_rrset_dump(chset->remove[i], 0); +); is_nsec3 = 0; @@ -2524,8 +2584,17 @@ static int xfrin_apply_add2(knot_zone_contents_t *contents, int is_nsec3 = 0; for (int i = 0; i < chset->add_count; ++i) { - dbg_xfrin_detail("Adding RRSet:\n"); +dbg_xfrin_exec_verb( + char *name = knot_dname_to_str( + knot_rrset_owner(chset->add[i])); + dbg_xfrin_verb("Adding RRSet: %s, type: %s\n", name, + knot_rrtype_to_string( + knot_rrset_type(chset->add[i]))); + free(name); +); +dbg_xfrin_exec_detail( knot_rrset_dump(chset->add[i], 0); +); is_nsec3 = 0; @@ -2647,6 +2716,7 @@ static int xfrin_apply_replace_soa2(knot_zone_contents_t *contents, knot_changes_t *changes, knot_changeset_t *chset) { + dbg_xfrin("Replacing SOA record.\n"); knot_node_t *node = knot_zone_contents_get_apex(contents); assert(node != NULL); @@ -2658,6 +2728,7 @@ static int xfrin_apply_replace_soa2(knot_zone_contents_t *contents, contents->apex = node; // remove the SOA RRSet from the apex + dbg_xfrin_verb("Removing SOA.\n"); knot_rrset_t *rrset = knot_node_remove_rrset(node, KNOT_RRTYPE_SOA); assert(rrset != NULL); @@ -2704,6 +2775,7 @@ static int xfrin_apply_replace_soa2(knot_zone_contents_t *contents, changes->old_rrsets[changes->old_rrsets_count++] = rrset; /*! \todo Maybe check if the SOA does not have more RDATA? */ + dbg_xfrin_verb("Adding RDATA from old SOA to the list of old RDATA.\n"); xfrin_changes_add_rdata(changes->old_rdata, changes->old_rdata_types, &changes->old_rdata_count, rrset->rdata, KNOT_RRTYPE_SOA); @@ -2725,6 +2797,7 @@ static int xfrin_apply_replace_soa2(knot_zone_contents_t *contents, changes->new_rrsets[changes->new_rrsets_count++] = chset->soa_to; + dbg_xfrin_verb("Adding RDATA from new SOA to the list of new RDATA.\n"); xfrin_changes_add_rdata(changes->new_rdata, changes->new_rdata_types, &changes->new_rdata_count, @@ -2750,6 +2823,9 @@ static int xfrin_apply_changeset2(knot_zone_contents_t *contents, * SOA in the zone apex. */ + dbg_xfrin("APPLYING CHANGESET: from serial %u to serial %u\n", + chset->serial_from, chset->serial_to); + // check if serial matches /*! \todo Only if SOA is present? */ const knot_rrset_t *soa = knot_node_rrset(contents->apex, diff --git a/src/libknot/util/debug.h b/src/libknot/util/debug.h index e02f988..b6aba6e 100644 --- a/src/libknot/util/debug.h +++ b/src/libknot/util/debug.h @@ -33,6 +33,7 @@ #include <stdio.h> #include "config.h" /* autoconf generated */ +#include "common/log.h" /* * Debug macros @@ -132,8 +133,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_ns(msg...) fprintf(stderr, msg) -#define dbg_ns_hex(data, len) hex_print((data), (len)) +#define dbg_ns(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_ns_hex(data, len) hex_log(LOG_SERVER, (data), (len)) #define dbg_ns_exec(cmds) do { cmds } while (0) #else #define dbg_ns(msg...) @@ -143,8 +144,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_ns_verb(msg...) fprintf(stderr, msg) -#define dbg_ns_hex_verb(data, len) hex_print((data), (len)) +#define dbg_ns_verb(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_ns_hex_verb(data, len) hex_log(LOG_SERVER, (data), (len)) #define dbg_ns_exec_verb(cmds) do { cmds } while (0) #else #define dbg_ns_verb(msg...) @@ -154,8 +155,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_ns_detail(msg...) fprintf(stderr, msg) -#define dbg_ns_hex_detail(data, len) hex_print((data), (len)) +#define dbg_ns_detail(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_ns_hex_detail(data, len) hex_log(LOG_SERVER, (data), (len)) #define dbg_ns_exec_detail(cmds) do { cmds } while (0) #else #define dbg_ns_detail(msg...) @@ -182,8 +183,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_dname(msg...) fprintf(stderr, msg) -#define dbg_dname_hex(data, len) hex_print((data), (len)) +#define dbg_dname(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_dname_hex(data, len) hex_log(LOG_ZONE, (data), (len)) #define dbg_dname_exec(cmds) do { cmds } while (0) #else #define dbg_dname(msg...) @@ -193,8 +194,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_dname_verb(msg...) fprintf(stderr, msg) -#define dbg_dname_hex_verb(data, len) hex_print((data), (len)) +#define dbg_dname_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_dname_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len)) #define dbg_dname_exec_verb(cmds) do { cmds } while (0) #else #define dbg_dname_verb(msg...) @@ -204,8 +205,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_dname_detail(msg...) fprintf(stderr, msg) -#define dbg_dname_hex_detail(data, len) hex_print((data), (len)) +#define dbg_dname_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_dname_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len)) #define dbg_dname_exec_detail(cmds) do { cmds } while (0) #else #define dbg_dname_detail(msg...) @@ -232,8 +233,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_node(msg...) fprintf(stderr, msg) -#define dbg_node_hex(data, len) hex_print((data), (len)) +#define dbg_node(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_node_hex(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_node(msg...) #define dbg_node_hex(data, len) @@ -241,8 +242,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_node_verb(msg...) fprintf(stderr, msg) -#define dbg_node_hex_verb(data, len) hex_print((data), (len)) +#define dbg_node_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_node_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_node_verb(msg...) #define dbg_node_hex_verb(data, len) @@ -250,8 +251,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_node_detail(msg...) fprintf(stderr, msg) -#define dbg_node_hex_detail(data, len) hex_print((data), (len)) +#define dbg_node_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_node_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_node_detail(msg...) #define dbg_node_hex_detail(data, len) @@ -273,8 +274,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_zone(msg...) fprintf(stderr, msg) -#define dbg_zone_hex(data, len) hex_print((data), (len)) +#define dbg_zone(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_zone_hex(data, len) hex_log(LOG_ZONE, (data), (len)) #define dbg_zone_exec(cmds) do { cmds } while (0) #else #define dbg_zone(msg...) @@ -284,8 +285,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_zone_verb(msg...) fprintf(stderr, msg) -#define dbg_zone_hex_verb(data, len) hex_print((data), (len)) +#define dbg_zone_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_zone_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len)) #define dbg_zone_exec_verb(cmds) do { cmds } while (0) #else #define dbg_zone_verb(msg...) @@ -295,8 +296,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_zone_detail(msg...) fprintf(stderr, msg) -#define dbg_zone_hex_detail(data, len) hex_print((data), (len)) +#define dbg_zone_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_zone_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len)) #define dbg_zone_exec_detail(cmds) do { cmds } while (0) #else #define dbg_zone_detail(msg...) @@ -323,8 +324,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_zonedb(msg...) fprintf(stderr, msg) -#define dbg_zonedb_hex(data, len) hex_print((data), (len)) +#define dbg_zonedb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_zonedb_hex(data, len) hex_log(LOG_ZONE, (data), (len)) #define dbg_zonedb_exec(cmds) do { cmds } while (0) #else #define dbg_zonedb(msg...) @@ -334,8 +335,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_zonedb_verb(msg...) fprintf(stderr, msg) -#define dbg_zonedb_hex_verb(data, len) hex_print((data), (len)) +#define dbg_zonedb_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_zonedb_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len)) #define dbg_zonedb_exec_verb(cmds) do { cmds } while (0) #else #define dbg_zonedb_verb(msg...) @@ -345,8 +346,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_zonedb_detail(msg...) fprintf(stderr, msg) -#define dbg_zonedb_hex_detail(data, len) hex_print((data), (len)) +#define dbg_zonedb_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_zonedb_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len)) #define dbg_zonedb_exec_detail(cmds) do { cmds } while (0) #else #define dbg_zonedb_detail(msg...) @@ -373,8 +374,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_response(msg...) fprintf(stderr, msg) -#define dbg_response_hex(data, len) hex_print((data), (len)) +#define dbg_response(msg...) log_msg(LOG_ANSWER, LOG_DEBUG, msg) +#define dbg_response_hex(data, len) hex_log(LOG_ANSWER, (data), (len)) #define dbg_response_exec(cmds) do { cmds } while (0) #else #define dbg_response(msg...) @@ -384,8 +385,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_response_verb(msg...) fprintf(stderr, msg) -#define dbg_response_hex_verb(data, len) hex_print((data), (len)) +#define dbg_response_verb(msg...) log_msg(LOG_ANSWER, LOG_DEBUG, msg) +#define dbg_response_hex_verb(data, len) hex_log(LOG_ANSWER, (data), (len)) #define dbg_response_exec_verb(cmds) do { cmds } while (0) #else #define dbg_response_verb(msg...) @@ -395,8 +396,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_response_detail(msg...) fprintf(stderr, msg) -#define dbg_response_hex_detail(data, len) hex_print((data), (len)) +#define dbg_response_detail(msg...) log_msg(LOG_ANSWER, LOG_DEBUG, msg) +#define dbg_response_hex_detail(data, len) hex_log(LOG_ANSWER, (data), (len)) #define dbg_response_exec_detail(cmds) do { cmds } while (0) #else #define dbg_response_detail(msg...) @@ -423,8 +424,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_packet(msg...) fprintf(stderr, msg) -#define dbg_packet_hex(data, len) hex_print((data), (len)) +#define dbg_packet(msg...) log_msg(LOG_ANSWER, LOG_DEBUG, msg) +#define dbg_packet_hex(data, len) hex_log(LOG_ANSWER, (data), (len)) #define dbg_packet_exec(cmds) do { cmds } while (0) #else #define dbg_packet(msg...) @@ -434,8 +435,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_packet_verb(msg...) fprintf(stderr, msg) -#define dbg_packet_hex_verb(data, len) hex_print((data), (len)) +#define dbg_packet_verb(msg...) log_msg(LOG_ANSWER, LOG_DEBUG, msg) +#define dbg_packet_hex_verb(data, len) hex_log(LOG_ANSWER, (data), (len)) #define dbg_packet_exec_verb(cmds) do { cmds } while (0) #else #define dbg_packet_verb(msg...) @@ -445,8 +446,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_packet_detail(msg...) fprintf(stderr, msg) -#define dbg_packet_hex_detail(data, len) hex_print((data), (len)) +#define dbg_packet_detail(msg...) log_msg(LOG_ANSWER, LOG_DEBUG, msg) +#define dbg_packet_hex_detail(data, len) hex_log(LOG_ANSWER, (data), (len)) #define dbg_packet_exec_detail(cmds) do { cmds } while (0) #else #define dbg_packet_detail(msg...) @@ -473,8 +474,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_edns(msg...) fprintf(stderr, msg) -#define dbg_edns_hex(data, len) hex_print((data), (len)) +#define dbg_edns(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_edns_hex(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_edns(msg...) #define dbg_edns_hex(data, len) @@ -482,8 +483,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_edns_verb(msg...) fprintf(stderr, msg) -#define dbg_edns_hex_verb(data, len) hex_print((data), (len)) +#define dbg_edns_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_edns_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_edns_verb(msg...) #define dbg_edns_hex_verb(data, len) @@ -491,8 +492,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_edns_detail(msg...) fprintf(stderr, msg) -#define dbg_edns_hex_detail(data, len) hex_print((data), (len)) +#define dbg_edns_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_edns_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_edns_detail(msg...) #define dbg_edns_hex_detail(data, len) @@ -514,8 +515,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_nsec3(msg...) fprintf(stderr, msg) -#define dbg_nsec3_hex(data, len) hex_print((data), (len)) +#define dbg_nsec3(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_nsec3_hex(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_nsec3(msg...) #define dbg_nsec3_hex(data, len) @@ -523,8 +524,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_nsec3_verb(msg...) fprintf(stderr, msg) -#define dbg_nsec3_hex_verb(data, len) hex_print((data), (len)) +#define dbg_nsec3_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_nsec3_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_nsec3_verb(msg...) #define dbg_nsec3_hex_verb(data, len) @@ -532,8 +533,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_nsec3_detail(msg...) fprintf(stderr, msg) -#define dbg_nsec3_hex_detail(data, len) hex_print((data), (len)) +#define dbg_nsec3_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_nsec3_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_nsec3_detail(msg...) #define dbg_nsec3_hex_detail(data, len) @@ -555,8 +556,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_ck(msg...) fprintf(stderr, msg) -#define dbg_ck_hex(data, len) hex_print((data), (len)) +#define dbg_ck(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_ck_hex(data, len) hex_log(LOG_SERVER, (data), (len)) #define dbg_ck_exec(cmds) do { cmds } while (0) #else #define dbg_ck(msg...) @@ -566,8 +567,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_ck_verb(msg...) fprintf(stderr, msg) -#define dbg_ck_hex_verb(data, len) hex_print((data), (len)) +#define dbg_ck_verb(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_ck_hex_verb(data, len) hex_log(LOG_SERVER, (data), (len)) #define dbg_ck_exec_verb(cmds) do { cmds } while (0) #else #define dbg_ck_verb(msg...) @@ -577,8 +578,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_ck_detail(msg...) fprintf(stderr, msg) -#define dbg_ck_hex_detail(data, len) hex_print((data), (len)) +#define dbg_ck_detail(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_ck_hex_detail(data, len) hex_log(LOG_SERVER, (data), (len)) #define dbg_ck_exec_detail(cmds) do { cmds } while (0) #else #define dbg_ck_detail(msg...) @@ -605,9 +606,9 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_ck_hash(msg...) fprintf(stderr, msg) -#define dbg_ck_rehash(msg...) fprintf(stderr, msg) -#define dbg_ck_hash_hex(data, len) hex_print((data), (len)) +#define dbg_ck_hash(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_ck_rehash(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_ck_hash_hex(data, len) hex_log(LOG_SERVER, (data), (len)) #else #define dbg_ck_hash(msg...) #define dbg_ck_rehash(msg...) @@ -616,8 +617,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_ck_hash_verb(msg...) fprintf(stderr, msg) -#define dbg_ck_hash_hex_verb(data, len) hex_print((data), (len)) +#define dbg_ck_hash_verb(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_ck_hash_hex_verb(data, len) hex_log(LOG_SERVER, (data), (len)) #else #define dbg_ck_hash_verb(msg...) #define dbg_ck_hash_hex_verb(data, len) @@ -625,8 +626,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_ck_hash_detail(msg...) fprintf(stderr, msg) -#define dbg_ck_hash_hex_detail(data, len) hex_print((data), (len)) +#define dbg_ck_hash_detail(msg...) log_msg(LOG_SERVER, LOG_DEBUG, msg) +#define dbg_ck_hash_hex_detail(data, len) hex_log(LOG_SERVER, (data), (len)) #else #define dbg_ck_hash_detail(msg...) #define dbg_ck_hash_hex_detail(data, len) @@ -649,8 +650,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_xfrin(msg...) fprintf(stderr, msg) -#define dbg_xfrin_hex(data, len) hex_print((data), (len)) +#define dbg_xfrin(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_xfrin_hex(data, len) hex_log(LOG_ZONE, (data), (len)) #define dbg_xfrin_exec(cmds) do { cmds } while (0) #else #define dbg_xfrin(msg...) @@ -660,8 +661,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_xfrin_verb(msg...) fprintf(stderr, msg) -#define dbg_xfrin_hex_verb(data, len) hex_print((data), (len)) +#define dbg_xfrin_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_xfrin_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len)) #define dbg_xfrin_exec_verb(cmds) do { cmds } while (0) #else #define dbg_xfrin_verb(msg...) @@ -671,8 +672,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_xfrin_detail(msg...) fprintf(stderr, msg) -#define dbg_xfrin_hex_detail(data, len) hex_print((data), (len)) +#define dbg_xfrin_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_xfrin_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len)) #define dbg_xfrin_exec_detail(cmds) do { cmds } while (0) #else #define dbg_xfrin_detail(msg...) @@ -699,8 +700,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_ddns(msg...) fprintf(stderr, msg) -#define dbg_ddns_hex(data, len) hex_print((data), (len)) +#define dbg_ddns(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_ddns_hex(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_ddns(msg...) #define dbg_ddns_hex(data, len) @@ -708,8 +709,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_ddns_verb(msg...) fprintf(stderr, msg) -#define dbg_ddns_hex_verb(data, len) hex_print((data), (len)) +#define dbg_ddns_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_ddns_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_ddns_verb(msg...) #define dbg_ddns_hex_verb(data, len) @@ -717,8 +718,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_ddns_detail(msg...) fprintf(stderr, msg) -#define dbg_ddns_hex_detail(data, len) hex_print((data), (len)) +#define dbg_ddns_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_ddns_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_ddns_detail(msg...) #define dbg_ddns_hex_detail(data, len) @@ -738,8 +739,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_tsig(msg...) fprintf(stderr, msg) -#define dbg_tsig_hex(data, len) hex_print((const char*)(data), (len)) +#define dbg_tsig(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_tsig_hex(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_tsig(msg...) #define dbg_tsig_hex(data, len) @@ -747,8 +748,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_tsig_verb(msg...) fprintf(stderr, msg) -#define dbg_tsig_hex_verb(data, len) hex_print((const char*)(data), (len)) +#define dbg_tsig_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_tsig_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_tsig_verb(msg...) #define dbg_tsig_hex_verb(data, len) @@ -756,8 +757,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_tsig_detail(msg...) fprintf(stderr, msg) -#define dbg_tsig_hex_detail(data, len) hex_print((const char*)(data), (len)) +#define dbg_tsig_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_tsig_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_tsig_detail(msg...) #define dbg_tsig_hex_detail(data, len) @@ -777,8 +778,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Brief messages. */ #ifdef DEBUG_ENABLE_BRIEF -#define dbg_rrset(msg...) fprintf(stderr, msg) -#define dbg_rrset_hex(data, len) hex_print((data), (len)) +#define dbg_rrset(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_rrset_hex(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_rrset(msg...) #define dbg_rrset_hex(data, len) @@ -786,8 +787,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Verbose messages. */ #ifdef DEBUG_ENABLE_VERBOSE -#define dbg_rrset_verb(msg...) fprintf(stderr, msg) -#define dbg_rrset_hex_verb(data, len) hex_print((data), (len)) +#define dbg_rrset_verb(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_rrset_hex_verb(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_rrset_verb(msg...) #define dbg_rrset_hex_verb(data, len) @@ -795,8 +796,8 @@ void knot_zone_contents_dump(knot_zone_contents_t *zone, char loaded_zone); /* Detail messages. */ #ifdef DEBUG_ENABLE_DETAILS -#define dbg_rrset_detail(msg...) fprintf(stderr, msg) -#define dbg_rrset_hex_detail(data, len) hex_print((data), (len)) +#define dbg_rrset_detail(msg...) log_msg(LOG_ZONE, LOG_DEBUG, msg) +#define dbg_rrset_hex_detail(data, len) hex_log(LOG_ZONE, (data), (len)) #else #define dbg_rrset_detail(msg...) #define dbg_rrset_hex_detail(data, len) diff --git a/src/tests/common/acl_tests.c b/src/tests/common/acl_tests.c index ea7b653..c1884cd 100644 --- a/src/tests/common/acl_tests.c +++ b/src/tests/common/acl_tests.c @@ -34,7 +34,7 @@ unit_api acl_tests_api = { static int acl_tests_count(int argc, char *argv[]) { - return 18; + return 20; } static int acl_tests_run(int argc, char *argv[]) @@ -146,6 +146,17 @@ static int acl_tests_run(int argc, char *argv[]) ret = acl_match(acl, &test_pf4, &rval); ok(rval->val == sval, "acl: search for preferred node"); + // 19. Scenario after truncating + ok(acl_truncate(acl) == ACL_ACCEPT, "acl: truncate"); + sockaddr_set(&test_pf6, AF_INET6, "2001:a1b0:e11e:50d1::3:300", 0); + acl_create(acl, &test_pf6, ACL_ACCEPT, 0, 0); + sockaddr_set(&test_pf4, AF_INET, "231.17.67.223", 0); + acl_create(acl, &test_pf4, ACL_ACCEPT, 0, 0); + sockaddr_set(&test_pf4, AF_INET, "82.87.48.136", 0); + acl_create(acl, &test_pf4, ACL_ACCEPT, 0, 0); + sockaddr_set(&match_pf4, AF_INET, "82.87.48.136", 12345); + ret = acl_match(acl, &match_pf4, 0); + ok(ret == ACL_ACCEPT, "acl: scenario after truncating"); acl_delete(&acl); // Return diff --git a/src/tests/files/sample_conf b/src/tests/files/sample_conf index 6cd9e50..b15fce5 100644 --- a/src/tests/files/sample_conf +++ b/src/tests/files/sample_conf @@ -8,7 +8,7 @@ system { identity "I have no mouth and must scream"; version "Infinitesimal"; - storage "/var/run/knot/"; + storage "."; } keys { diff --git a/src/tests/knot/dthreads_tests.c b/src/tests/knot/dthreads_tests.c index d95fbed..982329b 100644 --- a/src/tests/knot/dthreads_tests.c +++ b/src/tests/knot/dthreads_tests.c @@ -372,7 +372,6 @@ static int dt_tests_run(int argc, char *argv[]) ret += dt_join(0); // -1 ret += dt_repurpose(0, 0, 0); // -1 ret += dt_resize(0, 0); // -1 - ret += dt_setprio(0, 0); // -1 ret += dt_signalize(0, SIGALRM); // -1 ret += dt_start(0); // -1 ret += dt_start_id(0); // -1 diff --git a/src/tests/knot/journal_tests.c b/src/tests/knot/journal_tests.c index 420300e..7c8125e 100644 --- a/src/tests/knot/journal_tests.c +++ b/src/tests/knot/journal_tests.c @@ -34,7 +34,7 @@ unit_api journal_tests_api = { /* * Unit implementation. */ -static const int JOURNAL_TEST_COUNT = 12; +static const int JOURNAL_TEST_COUNT = 20; /*! \brief Generate random string with given length. */ static int randstr(char* dst, size_t len) @@ -164,13 +164,13 @@ static int journal_tests_run(int argc, char *argv[]) memcpy(chk_buf, tmpbuf, sizeof(chk_buf)); } } - ok(ret == 0, "journal: sustained looped writes"); + ok(j && ret == 0, "journal: sustained looped writes"); /* Test 11: Check data integrity. */ memset(tmpbuf, 0, sizeof(tmpbuf)); journal_read(j, chk_key, 0, tmpbuf); ret = strncmp(chk_buf, tmpbuf, sizeof(chk_buf)); - ok(ret == 0, "journal: read data integrity check"); + ok(j && ret == 0, "journal: read data integrity check"); /* Test 12: Reopen log and re-read value. */ memset(tmpbuf, 0, sizeof(tmpbuf)); @@ -178,7 +178,89 @@ static int journal_tests_run(int argc, char *argv[]) j = journal_open(jfilename, fsize, 0, 0); journal_read(j, chk_key, 0, tmpbuf); ret = strncmp(chk_buf, tmpbuf, sizeof(chk_buf)); - ok(ret == 0, "journal: read data integrity check after close/open"); + ok(j && ret == 0, "journal: read data integrity check after close/open"); + + /* Test 13: Map journal entry. */ + char *mptr = NULL; + memset(chk_buf, 0xde, sizeof(chk_buf)); + ret = journal_map(j, 0x12345, &mptr, sizeof(chk_buf)); + ok(j && mptr && ret == 0, "journal: mapped journal entry"); + skip(ret != 0, 2); + + /* Test 14: Write to mmaped entry and unmap. */ + memcpy(mptr, chk_buf, sizeof(chk_buf)); + ret = journal_unmap(j, 0x12345, mptr, 1); + ok(j && mptr && ret == 0, "journal: written to mapped entry and finished"); + + /* Test 15: Compare mmaped entry. */ + memset(tmpbuf, 0, sizeof(tmpbuf)); + journal_read(j, 0x12345, NULL, tmpbuf); + ret = strncmp(chk_buf, tmpbuf, sizeof(chk_buf)); + ok(j && ret == 0, "journal: mapped entry data integrity check"); + endskip; + + /* Test 17: Make a transaction. */ + uint64_t tskey = 0x75750000; + ret = journal_trans_begin(j); + ok(j && ret == 0, "journal: TRANS begin"); + for (int i = 0; i < 16; ++i) { + memset(tmpbuf, i, sizeof(tmpbuf)); + journal_write(j, tskey + i, tmpbuf, sizeof(tmpbuf)); + } + + /* Test 18: Check if uncommited node exists. */ + ret = journal_read(j, tskey + rand() % 16, NULL, chk_buf); + ok(j && ret != 0, "journal: check for uncommited node"); + + /* Test 19: Commit transaction. */ + ret = journal_trans_commit(j); + int read_ret = journal_read(j, tskey + rand() % 16, NULL, chk_buf); + ok(j && ret == 0 && read_ret == 0, "journal: transaction commit"); + + /* Test 20: Rollback transaction. */ + tskey = 0x6B6B0000; + journal_trans_begin(j); + for (int i = 0; i < 16; ++i) { + memset(tmpbuf, i, sizeof(tmpbuf)); + journal_write(j, tskey + i, tmpbuf, sizeof(tmpbuf)); + } + ret = journal_trans_rollback(j); + read_ret = journal_read(j, tskey + rand() % 16, NULL, chk_buf); + ok(j && ret == 0 && read_ret != 0, "journal: transaction rollback"); + + /* Test 16: Write random data. */ + ret = 0; + for (int i = 0; i < 512; ++i) { + int key = i; + randstr(tmpbuf, sizeof(tmpbuf)); + ret = journal_map(j, key, &mptr, sizeof(tmpbuf)); + if (ret != KNOTD_EOK) { + diag("journal_map failed: %s", knotd_strerror(ret)); + break; + } + memcpy(mptr, tmpbuf, sizeof(tmpbuf)); + if ((ret = journal_unmap(j, key, mptr, 1)) != KNOTD_EOK) { + diag("journal_unmap failed: %s", knotd_strerror(ret)); + break; + } + + /* Store some key on the end. */ + memset(chk_buf, 0, sizeof(chk_buf)); + ret = journal_read(j, key, 0, chk_buf); + if (ret != 0) { + diag("journal_map integrity check failed %s", + knotd_strerror(ret)); + break; + } + ret = strncmp(chk_buf, tmpbuf, sizeof(chk_buf)); + if (ret != 0) { + diag("journal_map integrity check failed"); + break; + } + } + + /* Test 16: Check data integrity. */ + ok(j && ret == 0, "journal: sustained mmap r/w"); /* Close journal. */ journal_close(j); diff --git a/src/tests/libknot/libknot/dname_tests.c b/src/tests/libknot/libknot/dname_tests.c index 22f6fbc..35ac230 100644 --- a/src/tests/libknot/libknot/dname_tests.c +++ b/src/tests/libknot/libknot/dname_tests.c @@ -39,7 +39,7 @@ unit_api dname_tests_api = { // C will not accept const int in other const definition enum { TEST_DOMAINS_OK = 8 }; -enum { TEST_DOMAINS_BAD = 4 }; +enum { TEST_DOMAINS_BAD = 5 }; enum { TEST_DOMAINS_NON_FQDN = 6 }; @@ -92,7 +92,8 @@ static const struct test_domain { NULL, "\2ex\3com", 0, "", 0 }, { "ex.com.", NULL, 0, "", 0 }, { "ex.com.\5", "\3ex\3com\0\5", 10, "", 0 }, - { "example.com", "\3example\3com", 12, "\x0\x8", 2 } + { "example.com", "\3example\3com", 12, "\x0\x8", 2 }, + { "example..", "\7example\0\0", 12, "\x0\x8", 2 } }; static int test_dname_create() @@ -194,7 +195,9 @@ static int test_dname_create_from_str_non_fqdn() knot_dname_t *dname = NULL; for (int i = 0; i < TEST_DOMAINS_NON_FQDN; ++i) { - //note("testing domain: %s", test_domains_non_fqdn[i].str); +// note("testing domain: %s, size: %zu", +// test_domains_non_fqdn[i].str, +// strlen(test_domains_non_fqdn[i].str)); dname = knot_dname_new_from_str(test_domains_non_fqdn[i].str, strlen(test_domains_non_fqdn[i].str), NULL); errors += check_domain_name(dname, test_domains_non_fqdn, i, 0); @@ -490,7 +493,7 @@ static int test_dname_is_subdomain() for (int i = 0; i < TEST_DOMAINS_NON_FQDN; ++i) { dnames_non_fqdn[i] = knot_dname_new_from_str( test_domains_non_fqdn[i].str, - test_domains_non_fqdn[i].size, NULL); + strlen(test_domains_non_fqdn[i].str), NULL); assert(dnames_non_fqdn[i] != NULL); } @@ -606,6 +609,60 @@ static int test_dname_is_subdomain() return (errors == 0); } +static int test_dname_deep_copy() { + int errors = 0; + + knot_dname_t *dnames_fqdn[TEST_DOMAINS_OK]; + knot_dname_t *dnames_non_fqdn[TEST_DOMAINS_NON_FQDN]; + knot_dname_t *dnames_fqdn_copy[TEST_DOMAINS_OK]; + knot_dname_t *dnames_non_fqdn_copy[TEST_DOMAINS_NON_FQDN]; + + for (int i = 0; i < TEST_DOMAINS_OK; ++i) { + dnames_fqdn[i] = knot_dname_new_from_wire( + (const uint8_t *)test_domains_ok[i].wire, + test_domains_ok[i].size, NODE_ADDRESS); + assert(dnames_fqdn[i] != NULL); + } + + for (int i = 0; i < TEST_DOMAINS_NON_FQDN; ++i) { + dnames_non_fqdn[i] = knot_dname_new_from_str( + test_domains_non_fqdn[i].str, + strlen(test_domains_non_fqdn[i].str), + NODE_ADDRESS); +// note("Created name: %.*s\n", dnames_non_fqdn[i]->size, +// dnames_non_fqdn[i]->name); + assert(dnames_non_fqdn[i] != NULL); + } + + /* + * Create copies of the domain names. + */ + for (int i = 0; i < TEST_DOMAINS_OK; ++i) { +// note("Testing %d. FQDN domain.\n", i); + dnames_fqdn_copy[i] = knot_dname_deep_copy(dnames_fqdn[i]); + assert(dnames_fqdn_copy[i] != NULL); + errors += check_domain_name(dnames_fqdn_copy[i], + test_domains_ok, i, 1); + knot_dname_free(&dnames_fqdn_copy[i]); + knot_dname_free(&dnames_fqdn[i]); + } + + for (int i = 0; i < TEST_DOMAINS_NON_FQDN; ++i) { +// note("Testing %d. non-FQDN domain: ", i); +// note("%.*s\n", dnames_non_fqdn[i]->size, +// dnames_non_fqdn[i]->name); + dnames_non_fqdn_copy[i] = + knot_dname_deep_copy(dnames_non_fqdn[i]); + assert(dnames_non_fqdn_copy[i] != NULL); + errors += check_domain_name(dnames_non_fqdn_copy[i], + test_domains_non_fqdn, i, 1); + knot_dname_free(&dnames_non_fqdn_copy[i]); + knot_dname_free(&dnames_non_fqdn[i]); + } + + return (errors == 0); +} + static int check_wires(const uint8_t *wire1, uint size1, uint8_t *wire2, uint size2) { @@ -652,7 +709,7 @@ static int test_dname_name(knot_dname_t **dnames_fqdn, for (int i = 0; i < TEST_DOMAINS_NON_FQDN; i++) { const uint8_t *tmp_name; tmp_name = knot_dname_name(dnames_non_fqdn[i]); - if (!check_wires(tmp_name, dnames_non_fqdn[i]->size - 1, + if (!check_wires(tmp_name, dnames_non_fqdn[i]->size, (uint8_t *)test_domains_non_fqdn[i].wire, test_domains_non_fqdn[i].size)) { diag("Got bad name value from structure: " @@ -757,10 +814,13 @@ static int test_dname_getters(uint type) } for (int i = 0; i < TEST_DOMAINS_NON_FQDN; i++) { - printf("Creating dname: %s size: %d\n", test_domains_non_fqdn[i].wire, test_domains_non_fqdn[i].size); +// note("Creating dname: %s size: %d\n", +// test_domains_non_fqdn[i].wire, +// test_domains_non_fqdn[i].size); dnames_non_fqdn[i] = knot_dname_new_from_str( test_domains_non_fqdn[i].str, - test_domains_non_fqdn[i].size, NODE_ADDRESS); + strlen(test_domains_non_fqdn[i].str), + NODE_ADDRESS); assert(dnames_non_fqdn[i] != NULL); } @@ -792,7 +852,7 @@ static int test_dname_getters(uint type) return (errors == 0); } -static const int KNOT_DNAME_TEST_COUNT = 15; +static const int KNOT_DNAME_TEST_COUNT = 16; /*! This helper routine should report number of * scheduled tests for given parameters. @@ -834,15 +894,11 @@ static int knot_dname_tests_run(int argc, char *argv[]) res_final *= res_wire; res_final *= res_str_non_fqdn; - todo(); res = test_dname_getters(0); ok(res, "dname: name"); - endtodo; - todo(); res = test_dname_getters(1); ok(res, "dname: size"); - endtodo; res = test_dname_getters(2); ok(res, "dname: node"); @@ -871,6 +927,9 @@ static int knot_dname_tests_run(int argc, char *argv[]) ok((res = test_dname_is_subdomain()), "dname: is subdomain"); res_final *= res; + ok((res = test_dname_deep_copy()), "dname: deep copy"); + res_final *= res; + endskip; /* create failed */ return res_final; diff --git a/src/tests/libknot/libknot/packet_tests.c b/src/tests/libknot/libknot/packet_tests.c index 185504f..916328d 100644 --- a/src/tests/libknot/libknot/packet_tests.c +++ b/src/tests/libknot/libknot/packet_tests.c @@ -168,10 +168,8 @@ static int test_packet_parse_rest() knot_packet_new(KNOT_PACKET_PREALLOC_NONE); assert(packet); - todo(); lives_ok({res = knot_packet_parse_rest(packet);}, - "packet: parser rest empty packet"); - endtodo; + "packet: parser rest empty packet"); knot_packet_free(&packet); diff --git a/src/tests/unittests_main.c b/src/tests/unittests_main.c index 2d57ed2..1ec336a 100644 --- a/src/tests/unittests_main.c +++ b/src/tests/unittests_main.c @@ -36,6 +36,8 @@ int main(int argc, char *argv[]) // Open log log_init(); log_levels_set(LOGT_SYSLOG, LOG_ANY, 0); + log_levels_set(LOGT_STDERR, LOG_ANY, 0); + log_levels_set(LOGT_STDOUT, LOG_ANY, LOG_MASK(LOG_DEBUG)); // Build test set unit_api *tests[] = { diff --git a/src/tests/xfr_tests.c b/src/tests/xfr_tests.c index 9ea19fe..5017109 100644 --- a/src/tests/xfr_tests.c +++ b/src/tests/xfr_tests.c @@ -16,11 +16,9 @@ /* * This test is basically a copy of the whole server, with following exceptions: - * - conf file path is hardcoded, because it is generated by script - * invoking this binary. * - signal handler now handles one more signal - * SIGCONT is used to signal this - * binary that an integrity check should be done + * SIGUSR1 is used to signal this + * binary that an integrity check should be done */ #include <time.h> @@ -69,7 +67,7 @@ void interrupt_handle(int s) } // Start zone integrity check - if (s == SIGCONT) { + if (s == SIGUSR1) { sig_integrity_check = 1; return; } @@ -85,7 +83,8 @@ void help(int argc, char **argv) " -d, --daemonize Run server as a daemon.\n" " -v, --verbose Verbose mode - additional runtime information.\n" " -V, --version Print version of the server.\n" - " -h, --help Print help and usage.\n"); + " -h, --help Print help and usage.\n" + "Send SIGUSR1 to trigger integrity check.\n"); } int main(int argc, char **argv) @@ -272,7 +271,7 @@ int main(int argc, char **argv) sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); sigaction(SIGHUP, &sa, NULL); - sigaction(SIGCONT, &sa, NULL); + sigaction(SIGUSR1, &sa, NULL); sa.sa_flags = 0; pthread_sigmask(SIG_BLOCK, &sa.sa_mask, NULL); diff --git a/src/zcompile/parser-descriptor.c b/src/zcompile/parser-descriptor.c index 41e7f2d..152781c 100644 --- a/src/zcompile/parser-descriptor.c +++ b/src/zcompile/parser-descriptor.c @@ -61,7 +61,7 @@ /* FIXME: Generate .y and .l to zoneparser/ */ #include "zparser.h" -enum desclen { PARSER_RRTYPE_DESCRIPTORS_LENGTH = 32770 }; // used to be 101 +enum desclen { PARSER_RRTYPE_DESCRIPTORS_LENGTH = 65536 }; // used to be 101 /* Taken from RFC 1035, section 3.2.4. */ static knot_lookup_table_t dns_rrclasses[] = { @@ -364,12 +364,13 @@ static parser_rrtype_descriptor_t /* 32769 */ [32769] = { PARSER_RRTYPE_DLV, T_DLV, "DLV", 4, { PARSER_RDATA_WF_SHORT, PARSER_RDATA_WF_BYTE, - PARSER_RDATA_WF_BYTE, PARSER_RDATA_WF_BINARY } }, + PARSER_RDATA_WF_BYTE, PARSER_RDATA_WF_BINARY }}, + [32770 ... 65535] = { PARSER_RRTYPE_TYPEXXX, T_UTYPE, NULL, 1, { PARSER_RDATA_WF_BINARY }} }; parser_rrtype_descriptor_t *parser_rrtype_descriptor_by_type(uint16_t type) { - if (type <= PARSER_RRTYPE_DLV) { + if (type <= 65535) { return &knot_rrtype_descriptors[type]; } return &knot_rrtype_descriptors[0]; diff --git a/src/zcompile/parser-util.c b/src/zcompile/parser-util.c index dde5411..c225872 100644 --- a/src/zcompile/parser-util.c +++ b/src/zcompile/parser-util.c @@ -62,7 +62,7 @@ #include "common/base32hex.h" #include "zcompile/parser-util.h" #include "zcompile/zcompile.h" -#include "libknot/util/descriptor.h" +#include "parser-descriptor.h" #include "libknot/util/utils.h" #include "zcompile/zcompile-error.h" @@ -812,6 +812,7 @@ uint32_t strtoserial(const char *nptr, const char **endptr) inline void write_uint32(void *dst, uint32_t data) { +/*!< \todo Check what this means and delete if obsolete. */ #ifdef ALLOW_UNALIGNED_ACCESSES *(uint32_t *) dst = htonl(data); #else @@ -925,7 +926,6 @@ time_t mktime_from_utc(const struct tm *tm) } /*!< Following functions are conversions from text to wire. */ - //#define DEBUG_UNKNOWN_RDATA #ifdef DEBUG_UNKNOWN_RDATA @@ -994,6 +994,8 @@ static inline int rdata_atom_is_domain(uint16_t type, size_t index) && (descriptor->wireformat[index] == KNOT_RDATA_WF_COMPRESSED_DNAME || descriptor->wireformat[index] == + KNOT_RDATA_WF_LITERAL_DNAME || + descriptor->wireformat[index] == KNOT_RDATA_WF_UNCOMPRESSED_DNAME)); } @@ -1013,6 +1015,8 @@ static inline uint8_t rdata_atom_wireformat_type(uint16_t type, size_t index) return descriptor->wireformat[index]; } +typedef int (*printf_t)(const char *fmt, ...); + /*! * \brief Converts rdata wireformat to rdata items. * @@ -1028,10 +1032,12 @@ static ssize_t rdata_wireformat_to_rdata_atoms(const uint16_t *wireformat, const uint16_t data_size, knot_rdata_item_t **items) { - dbg_rdata("read length: %d\n", data_size); - uint16_t const *end = (uint16_t *)((uint8_t *)wireformat + (data_size)); + /*!< \todo This is so ugly, it makes me wanna puke. */ + uint16_t const *end = + (uint16_t *)((uint8_t *)wireformat + (data_size)); dbg_rdata("set end pointer: %p which means length: %d\n", end, (uint8_t *)end - (uint8_t *)wireformat); + dbg_rdata("Parsing following wf: "); size_t i; knot_rdata_item_t *temp_rdatas = malloc(sizeof(*temp_rdatas) * MAXRDATALEN); @@ -1050,69 +1056,78 @@ static ssize_t rdata_wireformat_to_rdata_atoms(const uint16_t *wireformat, descriptor->length, data_size); for (i = 0; i < descriptor->length; ++i) { + dbg_rdata("this particular item is type %d.\n", + rdata_atom_wireformat_type(rrtype, i)); int is_domain = 0; int is_wirestore = 0; size_t length = 0; length = 0; - int required = descriptor->length; + bool required = descriptor->fixed_items; switch (rdata_atom_wireformat_type(rrtype, i)) { case KNOT_RDATA_WF_COMPRESSED_DNAME: case KNOT_RDATA_WF_UNCOMPRESSED_DNAME: + dbg_rdata("Parsed item is a dname.\n"); is_domain = 1; break; case KNOT_RDATA_WF_LITERAL_DNAME: + dbg_rdata("Parsed item is a literal dname.\n"); is_domain = 1; is_wirestore = 1; break; case KNOT_RDATA_WF_BYTE: + dbg_rdata("Parsed item is a byte.\n"); length = sizeof(uint8_t); break; case KNOT_RDATA_WF_SHORT: + dbg_rdata("Parsed item is a short.\n"); length = sizeof(uint16_t); break; case KNOT_RDATA_WF_LONG: + dbg_rdata("Parsed item is a long.\n"); length = sizeof(uint32_t); break; + case KNOT_RDATA_WF_APL: + dbg_rdata("APL data.\n"); + case KNOT_RDATA_WF_TEXT_SINGLE: case KNOT_RDATA_WF_TEXT: + dbg_rdata("TEXT rdata.\n"); case KNOT_RDATA_WF_BINARYWITHLENGTH: + dbg_rdata("BINARYWITHLENGTH rdata.\n"); /* Length is stored in the first byte. */ - length = 1; - if ((uint8_t *)wireformat + length <= (uint8_t *)end) { - // length += wireformat[length - 1]; - length += *((uint8_t *)wireformat); - dbg_rdata("%d: set new length: %d\n", i, - length); - } - /*if (buffer_position(packet) + length <= end) { - length += buffer_current(packet)[length - 1]; - }*/ + length = data_size; break; case KNOT_RDATA_WF_A: + dbg_rdata("Parsed item is an IPv4 address.\n"); length = sizeof(in_addr_t); break; case KNOT_RDATA_WF_AAAA: + dbg_rdata("Parsed item is an IPv6 address.\n"); length = IP6ADDRLEN; break; case KNOT_RDATA_WF_BINARY: /* Remaining RDATA is binary. */ - dbg_rdata("%d: guessing length from pointers: %p %p\n", + dbg_rdata("BINARY: item %d: guessing length from pointers: %p %p. ", i, wireformat, end); length = (uint8_t *)end - (uint8_t *)wireformat; -// length = end - buffer_position(packet); - break; - case KNOT_RDATA_WF_APL: - length = (sizeof(uint16_t) /* address family */ - + sizeof(uint8_t) /* prefix */ - + sizeof(uint8_t)); /* length */ - if ((uint8_t *)wireformat + length <= (uint8_t *)end) { - /* Mask out negation bit. */ - length += (wireformat[length - 1] - & APL_LENGTH_MASK); - } + dbg_rdata("Result: %d.\n", + length); break; +// case KNOT_RDATA_WF_APL: +// length = (sizeof(uint16_t) /* address family */ +// + sizeof(uint8_t) /* prefix */ +// + sizeof(uint8_t)); /* length */ +// if ((uint8_t *)wireformat + length <= (uint8_t *)end) { +// /* Mask out negation bit. */ +// dbg_rdata("APL: length was %d. ", length); +// length += (wireformat[data_size - 1] +// & APL_LENGTH_MASK); +// dbg_rdata("APL: after masking: %d.\n", length); +// } +// break; case KNOT_RDATA_WF_IPSECGATEWAY: + dbg_rdata("Parsed item is an IPSECGATEWAY address.\n"); switch (rdata_atom_data(temp_rdatas[1])[0]) { /* gateway type */ default: @@ -1130,19 +1145,34 @@ static ssize_t rdata_wireformat_to_rdata_atoms(const uint16_t *wireformat, is_wirestore = 1; break; } + break; } if (is_domain) { - knot_dname_t *dname; + knot_dname_t *dname = NULL; + /* + * Since we don't know how many dnames there are + * in the whole wireformat we have to search for next + * '\0'. + */ + for (length = 0; + (length < ((uint8_t *)end - (uint8_t *)wireformat)) + && (((uint8_t *)wireformat)[length] != '\0'); + length++) { + ; + } + length++; + dbg_rdata("item %d: length derived from position of " + "0: %d\n", i, length); if (!required && (wireformat == end)) { break; } - dname = knot_dname_new_from_str((char *)wireformat, - length, - NULL); + dname = knot_dname_new_from_wire((uint8_t *)wireformat, + length, + NULL); if (dname == NULL) { dbg_rdata("malformed dname!\n"); @@ -1150,8 +1180,9 @@ static ssize_t rdata_wireformat_to_rdata_atoms(const uint16_t *wireformat, free(temp_rdatas); return KNOTDZCOMPILE_EBRDATA; } - dbg_rdata("%d: created dname: %s\n", i, - knot_dname_to_str(dname)); + + dbg_rdata("item %d: created dname: %s, length: %d\n", i, + knot_dname_to_str(dname), length); if (is_wirestore) { /*temp_rdatas[i].raw_data = @@ -1180,7 +1211,8 @@ static ssize_t rdata_wireformat_to_rdata_atoms(const uint16_t *wireformat, } } else { - dbg_rdata("%d :length: %d %d %p %p\n", i, length, + /*!< \todo This calculated length makes no sense! */ + dbg_rdata("item %d :length: %d calculated: %d (%p %p)\n", i, length, end - wireformat, wireformat, end); if ((uint8_t *)wireformat + length > (uint8_t *)end) { @@ -1188,7 +1220,8 @@ static ssize_t rdata_wireformat_to_rdata_atoms(const uint16_t *wireformat, /* Truncated RDATA. */ /*! \todo rdata purge */ free(temp_rdatas); - dbg_rdata("truncated rdata\n"); + dbg_rdata("truncated rdata, end pointer is exceeded by %d octets.\n", + (wireformat + length) - end); return KNOTDZCOMPILE_EBRDATA; } else { break; @@ -1224,15 +1257,13 @@ static ssize_t rdata_wireformat_to_rdata_atoms(const uint16_t *wireformat, dbg_rdata("wire: %p\n", wireformat); dbg_rdata("remaining now: %d\n", end - wireformat); - } dbg_rdata("%p %p\n", wireformat, (uint8_t *)wireformat); if (wireformat < end) { /* Trailing garbage. */ - dbg_rdata("w: %p e: %p %d\n", wireformat, end, end - wireformat); -// region_destroy(temp_region); + dbg_rdata("Garbage: w: %p e: %p %d\n", wireformat, end, end - wireformat); free(temp_rdatas); return KNOTDZCOMPILE_EBRDATA; } @@ -1240,6 +1271,8 @@ static ssize_t rdata_wireformat_to_rdata_atoms(const uint16_t *wireformat, *items = temp_rdatas; /* *rdatas = (rdata_atom_type *) region_alloc_init( region, temp_rdatas, i * sizeof(rdata_atom_type)); */ + dbg_rdata("wf_to_rdata_atoms: Succesfully converted %d items.\n", + i); return (ssize_t)i; } @@ -2062,8 +2095,9 @@ uint16_t * zparser_conv_loc(char *str) zc_error_prev_line("space expected after seconds"); return NULL; } - - if (sscanf(start, "%16lf", &d) != 1) { + + d = strtod(start, &start); + if (errno != 0) { zc_error_prev_line("error parsing seconds"); } @@ -2160,9 +2194,10 @@ uint16_t * zparser_conv_loc(char *str) if (!isspace((int)*str) && *str != '\0') { ++str; } - - if (sscanf(start, "%16lf", &d) != 1) { - zc_error_prev_line("error parsing altitude"); + + d = strtod(start, &start); + if (errno != 0) { + zc_error_prev_line("error parsing altitued"); } alt = (uint32_t)(10000000.0 + d * 100 + 0.5); @@ -2342,18 +2377,12 @@ void zadd_rdata_txt_wireformat(uint16_t *data, int first) return; } dbg_zp("Adding text!\n"); -// hex_print(data + 1, data[0]); knot_rdata_item_t *rd; /* First STR in str_seq, allocate 65K in first unused rdata * else find last used rdata */ if (first) { rd = &parser->temporary_items[parser->rdata_count]; -// if ((rd->data = (uint8_t *) region_alloc(parser->rr_region, -// sizeof(uint8_t) + 65535 * sizeof(uint8_t))) == NULL) { -// zc_error_prev_line("Could not allocate memory for TXT RR"); -// return; -// } rd->raw_data = alloc_rdata(65535 * sizeof(uint8_t)); if (rd->raw_data == NULL) { parser->error_occurred = KNOTDZCOMPILE_ENOMEM; @@ -2361,7 +2390,6 @@ void zadd_rdata_txt_wireformat(uint16_t *data, int first) parser->rdata_count++; rd->raw_data[0] = 0; } else { -// assert(0); rd = &parser->temporary_items[parser->rdata_count-1]; } @@ -2392,8 +2420,8 @@ void zadd_rdata_domain(knot_dname_t *dname) void parse_unknown_rdata(uint16_t type, uint16_t *wireformat) { - dbg_rdata("parsing unknown rdata for type: %d\n", type); -// buffer_type packet; + dbg_rdata("parsing unknown rdata for type: %s (%d)\n", + knot_rrtype_to_string(type), type); uint16_t size; ssize_t rdata_count; ssize_t i; @@ -2405,14 +2433,13 @@ void parse_unknown_rdata(uint16_t type, uint16_t *wireformat) return; } -// buffer_create_from(&packet, wireformat + 1, *wireformat); rdata_count = rdata_wireformat_to_rdata_atoms(wireformat + 1, type, size, &items); -// dbg_rdata("got %d items\n", rdata_count); - dbg_rdata("wf to items returned error: %s (%d)\n", - error_to_str(knot_zcompile_error_msgs, rdata_count), - rdata_count); + dbg_rdata("got %d items\n", rdata_count); if (rdata_count < 0) { + dbg_rdata("wf to items returned error: %s (%d)\n", + error_to_str(knot_zcompile_error_msgs, rdata_count), + rdata_count); zc_error_prev_line("bad unknown RDATA\n"); /*!< \todo leaks */ return; @@ -2429,6 +2456,8 @@ void parse_unknown_rdata(uint16_t type, uint16_t *wireformat) free(items); /* Free wireformat */ free(wireformat); + + dbg_rdata("parse_unknown_rdata: Successfuly parsed unknown rdata.\n"); } void set_bitnsec(uint8_t bits[NSEC_WINDOW_COUNT][NSEC_WINDOW_BITS_SIZE], diff --git a/src/zcompile/zcompile.c b/src/zcompile/zcompile.c index d84feb7..263d0d7 100644 --- a/src/zcompile/zcompile.c +++ b/src/zcompile/zcompile.c @@ -36,6 +36,8 @@ #include <sys/stat.h> #include "common/base32hex.h" +#include "common/log.h" +#include "knot/other/debug.h" #include "zcompile/zcompile.h" #include "zcompile/parser-util.h" #include "zcompile/zcompile-error.h" @@ -54,12 +56,6 @@ static long int totalrrs = 0; extern FILE *zp_get_in(void *scanner); -#ifdef KNOT_COMPILER_DEBUG -#define dbg_zp(msg...) fprintf(stderr, msg) -#else -#define dbg_zp(msg...) -#endif - /*! * \brief Adds RRSet to list. * @@ -86,6 +82,8 @@ static int rrset_list_add(rrset_list_t **head, knot_rrset_t *rrsig) tmp->data = rrsig; *head = tmp; } + + dbg_zp_verb("zp: rrset_add: Added RRSIG %p to list.\n", rrsig); return KNOTDZCOMPILE_EOK; } @@ -109,6 +107,8 @@ static void rrset_list_delete(rrset_list_t **head) } *head = NULL; + + dbg_zp("zp: list_delete: List deleleted.\n"); } static int find_rrset_for_rrsig_in_zone(knot_zone_contents_t *zone, @@ -127,10 +127,11 @@ static int find_rrset_for_rrsig_in_zone(knot_zone_contents_t *zone, rrsig->owner); } - dbg_zp("Found this node for RRSIG: %p\n", - tmp_node); + dbg_zp_verb("zp: find_rr_for_sig: Found this node for RRSIG: %p.\n", + tmp_node); if (tmp_node == NULL) { + dbg_zp("zp: find_rr_for_sig: There is no node for this RR.\n"); return KNOTDZCOMPILE_EINVAL; } @@ -139,23 +140,37 @@ static int find_rrset_for_rrsig_in_zone(knot_zone_contents_t *zone, knot_rdata_rrsig_type_covered( rrsig->rdata)); - dbg_zp("Found this rrset for RRSIG: %p\n", - tmp_rrset); + dbg_zp_verb("zp: find_rr_for_sig: Found this RRSet for RRSIG: %p.\n", + tmp_rrset); if (tmp_rrset == NULL) { + dbg_zp("zp: find_rr_for_sig: There is no RRSet " + "for this RRSIG.\n"); return KNOTDZCOMPILE_EINVAL; } if (tmp_rrset->rrsigs != NULL) { - knot_zone_contents_add_rrsigs(zone, rrsig, &tmp_rrset, &tmp_node, + int ret = knot_zone_contents_add_rrsigs(zone, rrsig, + &tmp_rrset, &tmp_node, KNOT_RRSET_DUPL_MERGE, 1); + if (ret != KNOT_EOK) { + dbg_zp("zp: find_rr_for_sig: Cannot add RRSIG.\n"); + return ret; + } knot_rrset_free(&rrsig); } else { - knot_zone_contents_add_rrsigs(zone, rrsig, &tmp_rrset, &tmp_node, + int ret = knot_zone_contents_add_rrsigs(zone, rrsig, + &tmp_rrset, &tmp_node, KNOT_RRSET_DUPL_SKIP, 1); + if (ret != KNOT_EOK) { + dbg_zp("zp: find_rr_for_sig: Cannot add RRSIG.\n"); + return ret; + } } - + + dbg_zp("zp: find_rr_for_sig: Found node: %p found rrset: %p.\n", + tmo_node, tmp_rrset); return KNOTDZCOMPILE_EOK; } @@ -173,18 +188,25 @@ static int find_rrset_for_rrsig_in_node(knot_zone_contents_t *zone, knot_node_get_rrset(node, rrsig_type_covered(rrsig)); if (tmp_rrset == NULL) { + dbg_zp("zp: find_rr_for_sig_in_node: Node does not contain " + "RRSet of type %s.\n", + knot_rrtype_to_string(rrsig_type_covered(rrsig))); return KNOTDZCOMPILE_EINVAL; } if (tmp_rrset->rrsigs != NULL) { - if (knot_zone_contents_add_rrsigs(zone, rrsig, &tmp_rrset, &node, + if (knot_zone_contents_add_rrsigs(zone, rrsig, + &tmp_rrset, &node, KNOT_RRSET_DUPL_MERGE, 1) < 0) { + dbg_zp("zp: find_rr_for_sig: Cannot add RRSIG.\n"); return KNOTDZCOMPILE_EINVAL; } knot_rrset_free(&rrsig); } else { - if (knot_zone_contents_add_rrsigs(zone, rrsig, &tmp_rrset, &node, + if (knot_zone_contents_add_rrsigs(zone, rrsig, + &tmp_rrset, &node, KNOT_RRSET_DUPL_SKIP, 1) < 0) { + dbg_zp("zp: find_rr_for_sig: Cannot add RRSIG.\n"); return KNOTDZCOMPILE_EINVAL; } } @@ -201,6 +223,8 @@ static knot_node_t *create_node(knot_zone_contents_t *zone, knot_node_t *(*node_get_func)(const knot_zone_contents_t *zone, const knot_dname_t *owner)) { + dbg_zp_verb("zp: create_node: Creating node using RRSet: %p.\n", + current_rrset); knot_node_t *node = knot_node_new(current_rrset->owner, NULL, 0); if (node_add_func(zone, node, 1, 0, 1) != 0) { @@ -215,6 +239,8 @@ static knot_node_t *create_node(knot_zone_contents_t *zone, static void process_rrsigs_in_node(knot_zone_contents_t *zone, knot_node_t *node) { + dbg_zp_verb("zp: process_rrsigs: Processing RRSIGS in node: %p.\n", + node); rrset_list_t *tmp = parser->node_rrsigs; while (tmp != NULL) { if (find_rrset_for_rrsig_in_node(zone, node, @@ -238,18 +264,22 @@ int process_rr(void) knot_rrtype_descriptor_t *descriptor = knot_rrtype_descriptor_by_type(current_rrset->type); - dbg_zp("%s\n", knot_dname_to_str(parser->current_rrset->owner)); - dbg_zp("type: %s\n", knot_rrtype_to_string(parser->current_rrset->type)); - dbg_zp("rdata count: %d\n", parser->current_rrset->rdata->count); -// hex_print(parser->current_rrset->rdata->items[0].raw_data, -// parser->current_rrset->rdata->items[0].raw_data[0]); +dbg_zp_exec_detail( + char *name = knot_dname_to_str(parser->current_rrset->owner); + dbg_zp_detail("zp: process_rr: Processing RR owned by: %s .\n", + name); + free(name); +); + dbg_zp_verb("zp: process_rr: Processing type: %s.\n", + knot_rrtype_to_string(parser->current_rrset->type)); + dbg_zp_verb("zp: process_rr: RDATA count: %d.\n",\ + parser->current_rrset->rdata->count); if (descriptor->fixed_items) { assert(current_rrset->rdata->count == descriptor->length); } assert(current_rrset->rdata->count > 0); - assert(knot_dname_is_fqdn(current_rrset->owner)); int (*node_add_func)(knot_zone_contents_t *, knot_node_t *, int, @@ -312,12 +342,15 @@ int process_rr(void) current_rrset->rclass, current_rrset->ttl); if (tmp_rrsig == NULL) { + dbg_zp("zp: process_rr: Cannot create tmp RRSIG.\n"); return KNOTDZCOMPILE_ENOMEM; } if (knot_rrset_add_rdata(tmp_rrsig, current_rrset->rdata) != KNOT_EOK) { knot_rrset_free(&tmp_rrsig); + dbg_zp("zp: process_rr: Cannot add data to tmp" + " RRSIG.\n"); return KNOTDZCOMPILE_EBRDATA; } @@ -353,18 +386,24 @@ int process_rr(void) current_rrset, node_add_func, node_get_func)) == NULL) { knot_rrset_free(&tmp_rrsig); + dbg_zp("zp: process_rr: Cannot " + "create new node.\n"); return KNOTDZCOMPILE_EBADNODE; } } } if (rrset_list_add(&parser->node_rrsigs, tmp_rrsig) != 0) { + dbg_zp("zp: process_rr: Cannot " + "create new node.\n"); return KNOTDZCOMPILE_ENOMEM; } - + + dbg_zp_verb("zp: process_rr: RRSIG proccesed successfully.\n"); return KNOTDZCOMPILE_EOK; } - + + /*! \todo Move RRSIG and RRSet handling to funtions. */ assert(current_rrset->type != KNOT_RRTYPE_RRSIG); knot_node_t *node = NULL; @@ -395,6 +434,8 @@ int process_rr(void) if ((node = create_node(contents, current_rrset, node_add_func, node_get_func)) == NULL) { + dbg_zp("zp: process_rr: Cannot " + "create new node.\n"); return KNOTDZCOMPILE_EBADNODE; } } @@ -406,11 +447,15 @@ int process_rr(void) current_rrset->rclass, current_rrset->ttl); if (rrset == NULL) { + dbg_zp("zp: process_rr: Cannot " + "create new RRSet.\n"); return KNOTDZCOMPILE_ENOMEM; } if (knot_rrset_add_rdata(rrset, current_rrset->rdata) != 0) { - free(rrset); + knot_rrset_free(&rrset); + dbg_zp("zp: process_rr: Cannot " + "add RDATA to RRSet.\n"); return KNOTDZCOMPILE_EBRDATA; } @@ -418,7 +463,9 @@ int process_rr(void) * any rrset to skip */ if (knot_zone_contents_add_rrset(contents, rrset, &node, KNOT_RRSET_DUPL_SKIP, 1) < 0) { - free(rrset); + knot_rrset_free(&rrset); + dbg_zp("zp: process_rr: Cannot " + "add RDATA to RRSet.\n"); return KNOTDZCOMPILE_EBRDATA; } } else { @@ -426,12 +473,14 @@ int process_rr(void) KNOT_RRTYPE_RRSIG && rrset->ttl != current_rrset->ttl) { zc_error_prev_line( - "TTL does not match the TTL of the RRset"); + "TTL does not match the TTL of the RRSet"); } if (knot_zone_contents_add_rrset(contents, current_rrset, &node, KNOT_RRSET_DUPL_MERGE, 1) < 0) { + dbg_zp("zp: process_rr: Cannot " + "merge RRSets.\n"); return KNOTDZCOMPILE_EBRDATA; } } @@ -441,9 +490,10 @@ int process_rr(void) } parser->last_node = node; - ++totalrrs; - + + dbg_zp_verb("zp: process_rr: RRSet %p processed successfully.\n", + parser->current_rrset); return KNOTDZCOMPILE_EOK; } @@ -454,12 +504,14 @@ static uint find_rrsets_orphans(knot_zone_contents_t *zone, rrset_list_t while (head != NULL) { if (find_rrset_for_rrsig_in_zone(zone, head->data) == 0) { found_rrsets += 1; - dbg_zp("RRSET succesfully found: owner %s type %s\n", + dbg_zp("zp: find_orphans: " + "RRSet succesfully found: owner %s type %s\n", knot_dname_to_str(head->data->owner), knot_rrtype_to_string(head->data->type)); } else { /* we can throw it away now */ - dbg_zp("RRSet not found for RRSIG: %s (%s)\n", + dbg_zp("zp: find_orphans: " + "RRSet not found for RRSIG: %s (%s)\n", knot_dname_to_str(head->data->owner), knot_rrtype_to_string( knot_rdata_rrsig_type_covered(head->data->rdata))); @@ -473,6 +525,10 @@ static uint find_rrsets_orphans(knot_zone_contents_t *zone, rrset_list_t static int zone_open(const char *filename, uint32_t ttl, uint16_t rclass, knot_node_t *origin, void *scanner, knot_dname_t *origin_from_config) { + /*!< \todo #1676 Implement proper locking. */ + zparser_init(filename, ttl, rclass, origin, origin_from_config); + + /* Open the zone file... */ if (strcmp(filename, "-") == 0) { zp_set_in(stdin, scanner); @@ -487,11 +543,7 @@ static int zone_open(const char *filename, uint32_t ttl, uint16_t rclass, return 0; } } - - /*!< \todo #1676 Implement proper locking. */ - - zparser_init(filename, ttl, rclass, origin, origin_from_config); - + return 1; } @@ -503,6 +555,8 @@ int zone_read(const char *name, const char *zonefile, const char *outfile, zonefile); return KNOTDZCOMPILE_EINVAL; } + + dbg_zp("zp: zone_read: Reading zone: %s.\n", zonefile); /* Check that we can write to outfile. */ FILE *f = fopen(outfile, "wb"); @@ -526,9 +580,8 @@ int zone_read(const char *name, const char *zonefile, const char *outfile, } knot_node_t *origin_node = knot_node_new(dname, NULL, 0); - + knot_dname_release(dname); /* Stored in node or should be freed. */ if (origin_node == NULL) { - knot_dname_release(dname); return KNOTDZCOMPILE_ENOMEM; } @@ -554,10 +607,9 @@ int zone_read(const char *name, const char *zonefile, const char *outfile, origin_from_config)) { zc_error_prev_line("Cannot open '%s' (%s).", zonefile, strerror(errno)); - zparser_free(); zp_lex_destroy(scanner); knot_dname_release(origin_from_config); - knot_node_free(&origin_node, 0); +// knot_node_free(&origin_node, 0); return KNOTDZCOMPILE_EZONEINVAL; } @@ -566,7 +618,8 @@ int zone_read(const char *name, const char *zonefile, const char *outfile, FILE *in_file = (FILE *)zp_get_in(scanner); fclose(in_file); zp_lex_destroy(scanner); - knot_node_free(&origin_node, 0); + knot_dname_release(origin_from_config); +// knot_node_free(&origin_node, 0); return KNOTDZCOMPILE_ESYNT; } @@ -579,7 +632,8 @@ int zone_read(const char *name, const char *zonefile, const char *outfile, /*!< \todo #1676 Implement proper locking. */ - dbg_zp("zp complete %p\n", parser->current_zone); + dbg_zp("zp: zone_read: Parse complete for %s.\n", + zonefile); if (parser->last_node && parser->node_rrsigs != NULL) { /* assign rrsigs to last node in the zone*/ @@ -588,15 +642,15 @@ int zone_read(const char *name, const char *zonefile, const char *outfile, rrset_list_delete(&parser->node_rrsigs); } - dbg_zp("zone parsed\n"); + dbg_zp("zp: zone_read: RRSIGs processed.\n"); if (!(parser->current_zone && knot_node_rrset(parser->current_zone->contents->apex, KNOT_RRTYPE_SOA))) { zc_error_prev_line("Zone file does not contain SOA record!\n"); - knot_zone_deep_free(&parser->current_zone, 1); - zparser_free(); - knot_node_free(&origin_node, 0); +// knot_zone_deep_free(&parser->current_zone, 1); + knot_dname_release(origin_from_config); +// knot_node_free(&origin_node, 0); return KNOTDZCOMPILE_EZONEINVAL; } @@ -604,7 +658,7 @@ int zone_read(const char *name, const char *zonefile, const char *outfile, found_orphans = find_rrsets_orphans(contents, parser->rrsig_orphans); - dbg_zp("%u orphans found\n", found_orphans); + dbg_zp("zp: zone_read: %u RRSIG orphans found.\n", found_orphans); rrset_list_delete(&parser->rrsig_orphans); @@ -618,17 +672,17 @@ int zone_read(const char *name, const char *zonefile, const char *outfile, /*! \todo Check return value. */ knot_zone_contents_adjust(contents); - dbg_zp("rdata adjusted\n"); + dbg_zp("zp: zone_read: Zone adjusted.\n"); if (parser->errors != 0) { - fprintf(stderr, - "Parser finished with error, not dumping the zone!\n"); + log_zone_error("Parser finished with %d error(s), " + "not dumping the zone!\n", + parser->errors); } else { int fd = open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG); if (fd < 0) { - fprintf(stderr, - "Could not open destination file for db: %s.\n", - outfile); + log_zone_error("Could not open destination file for db: %s.\n", + outfile); totalerrors++; } else { crc_t crc; @@ -636,22 +690,22 @@ int zone_read(const char *name, const char *zonefile, const char *outfile, semantic_checks, zonefile, &crc); if (ret != KNOT_EOK) { - fprintf(stderr, "Could not dump zone, reason: " - "%s.\n", knot_strerror(ret)); + log_zone_error("Could not dump zone, reason: " + "%s.\n", knot_strerror(ret)); remove(outfile); totalerrors++; } else { /* Write CRC file. */ char *crc_path = knot_zdump_crc_file(outfile); if (crc_path == NULL) { - fprintf(stderr, - "Could not get crc file path.\n"); + log_zone_error( + "Could not get crc file path.\n"); remove(outfile); totalerrors++; } else { FILE *f_crc = fopen(crc_path, "w"); if (f_crc == NULL) { - fprintf(stderr, + log_zone_error( "Could not open crc file \n"); remove(outfile); totalerrors++; @@ -667,12 +721,13 @@ int zone_read(const char *name, const char *zonefile, const char *outfile, } - dbg_zp("zone dumped.\n"); + dbg_zp("zp: zone_read: Zone %s dumped successfully.\n", + zonefile); } fflush(stdout); totalerrors += parser->errors; - zparser_free(); + knot_dname_release(origin_from_config); return totalerrors; } diff --git a/src/zcompile/zcompile_main.c b/src/zcompile/zcompile_main.c index c873af6..4b631ce 100644 --- a/src/zcompile/zcompile_main.c +++ b/src/zcompile/zcompile_main.c @@ -19,6 +19,7 @@ #include <stdlib.h> #include "zcompile/zcompile.h" +#include "common/log.h" #include <config.h> static void help(int argc, char **argv) @@ -81,21 +82,21 @@ int main(int argc, char **argv) origin = argv[optind]; zonefile = argv[optind + 1]; - // Initialize log (no output) - //log_init(0); - //log_levels_set(LOGT_STDOUT, LOG_ANY, LOG_MASK(LOG_DEBUG)); - - printf("Parsing file '%s', origin '%s' ...\n", - zonefile, origin); + // Initialize log (no syslog) + log_init(); + log_levels_set(LOGT_SYSLOG, LOG_ANY, 0); + log_zone_info("Parsing file '%s', origin '%s' ...\n", + zonefile, origin); parser = zparser_create(); if (!parser) { - fprintf(stderr, "Failed to create parser.\n"); + log_server_error("Failed to create parser.\n"); //log_close(); return 1; } int error = zone_read(origin, zonefile, outfile, semantic_checks); + zparser_free(); if (error != 0) { /* FIXME! */ @@ -107,7 +108,7 @@ int main(int argc, char **argv) // } return 1; } else { - printf("Compilation successful.\n"); + log_zone_info("Compilation of '%s' successful.\n", origin); } //log_close(); diff --git a/src/zcompile/zparser.y b/src/zcompile/zparser.y index 59f037d..b353fbe 100644 --- a/src/zcompile/zparser.y +++ b/src/zcompile/zparser.y @@ -54,6 +54,7 @@ #include <assert.h> #include "zcompile/parser-util.h" +#include "common/log.h" #include "libknot/libknot.h" #include "zcompile/zcompile.h" @@ -198,7 +199,7 @@ line: NL assert(parser->current_rrset->rdata == NULL); if (knot_rrset_add_rdata(parser->current_rrset, tmp_rdata) != 0) { - fprintf(stderr, "Could not add rdata!\n"); + log_zone_error("Could not add rdata!\n"); } // tmp_rdata->next = tmp_rdata; // parser->current_rrset->rdata = tmp_rdata; @@ -223,7 +224,7 @@ line: NL if ((ret = process_rr()) != 0) { char *name = knot_dname_to_str(parser->current_rrset->owner); - fprintf(stderr, "Error: could not process RRSet\n" + log_zone_error("Error: could not process RRSet\n" "owner: %s reason: %s\n", name, error_to_str(knot_zcompile_error_msgs, ret)); @@ -258,7 +259,7 @@ line: NL * of the converting function was not able to convert. */ if (parser->error_occurred == KNOTDZCOMPILE_ENOMEM) { /* Ran out of memory in converting functions. */ - fprintf(stderr, "Parser ran out " + log_zone_error("Parser ran out " "of memory, aborting!\n"); knot_rrset_deep_free(&(parser->current_rrset), 0, 0, 0); @@ -691,7 +692,7 @@ str_sp_seq: STR char *result = malloc($1.len + $3.len + 1); if (result == NULL) { ERR_ALLOC_FAILED; - fprintf(stderr, "Parser ran out of memory, aborting!\n"); + log_zone_error("Parser ran out of memory, aborting!\n"); knot_rrset_deep_free(&(parser->current_rrset), 0, 0, 0); knot_zone_deep_free(&(parser->current_zone), @@ -719,7 +720,7 @@ str_dot_seq: STR char *result = malloc($1.len + $3.len + 1); if (result == NULL) { ERR_ALLOC_FAILED; - fprintf(stderr, "Parser ran out of memory, aborting!\n"); + log_zone_error("Parser ran out of memory, aborting!\n"); knot_rrset_deep_free(&(parser->current_rrset), 0, 0, 0); knot_zone_deep_free(&(parser->current_zone), @@ -751,7 +752,7 @@ dotted_str: STR char *result = malloc($1.len + 2); if (result == NULL) { ERR_ALLOC_FAILED; - fprintf(stderr, "Parser ran out of memory, aborting!\n"); + log_zone_error("Parser ran out of memory, aborting!\n"); knot_rrset_deep_free(&(parser->current_rrset), 0, 0, 0); knot_zone_deep_free(&(parser->current_zone), @@ -771,7 +772,7 @@ dotted_str: STR char *result = malloc($1.len + $3.len + 2); if (result == NULL) { ERR_ALLOC_FAILED; - fprintf(stderr, "Parser ran out of memory, aborting!\n"); + log_zone_error("Parser ran out of memory, aborting!\n"); knot_rrset_deep_free(&(parser->current_rrset), 0, 0, 0); knot_zone_deep_free(&(parser->current_zone), @@ -1563,23 +1564,19 @@ zparser_type *zparser_create() result->current_rrset = knot_rrset_new(NULL, 0, 0, 0); if (result->current_rrset == NULL) { - ERR_ALLOC_FAILED; free(result->temporary_items); free(result); return NULL; } result->root_domain = knot_dname_new_from_str(".", 1, NULL); -// printf("THE NEW ROOT: %p\n", result->root_domain); if (result->root_domain == NULL) { - ERR_ALLOC_FAILED; free(result->temporary_items); free(result->current_rrset); free(result); return NULL; } - knot_dname_retain(result->root_domain); return result; } @@ -1610,6 +1607,7 @@ zparser_init(const char *filename, uint32_t ttl, uint16_t rclass, parser->filename = filename; parser->rdata_count = 0; parser->origin_from_config = origin_from_config; + knot_dname_retain(origin_from_config); parser->last_node = origin; // parser->root_domain = NULL; @@ -1630,9 +1628,10 @@ zparser_init(const char *filename, uint32_t ttl, uint16_t rclass, void zparser_free() { -// knot_dname_release(parser->root_domain); + knot_dname_release(parser->root_domain); // knot_dname_release(parser->prev_dname); - knot_dname_free(&parser->origin_from_config); + knot_zone_deep_free(&parser->current_zone, 1); + knot_dname_release(parser->origin_from_config); free(parser->temporary_items); if (parser->current_rrset != NULL) { free(parser->current_rrset); @@ -1649,13 +1648,29 @@ yyerror(void *scanner, const char *message) static void error_va_list(unsigned line, const char *fmt, va_list args) { + char sbuf[4096] = {0}; + size_t buflen = sizeof(sbuf) - 1; + char *buf = sbuf; + int wb = 0; if (parser->filename) { - fprintf(stderr, "%s:%u: ", parser->filename, line); + wb = snprintf(buf, buflen, "%s:%u: ", + parser->filename, line); + if (wb > 0) { + buf += wb; + buflen -= wb; + } } - fprintf(stderr, "error: "); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); - + + wb = vsnprintf(buf, buflen, fmt, args); + if (wb > 0) { + buf += wb; + buflen -= wb; + *buf = '\n'; + *(buf + 1) = '\0'; + } + + log_zone_error("%s", sbuf); + ++parser->errors; parser->error_occurred = 1; } @@ -1685,12 +1700,28 @@ zc_error(const char *fmt, ...) static void warning_va_list(unsigned line, const char *fmt, va_list args) { + char sbuf[4096] = {0}; + size_t buflen = sizeof(sbuf) - 1; + char *buf = sbuf; + int wb = 0; if (parser->filename) { - fprintf(stderr, "%s:%u: ", parser->filename, line); + wb = snprintf(buf, buflen, "%s:%u: ", + parser->filename, line); + if (wb > 0) { + buf += wb; + buflen -= wb; + } } - fprintf(stderr, "warning: "); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); + + wb = vsnprintf(buf, buflen, fmt, args); + if (wb > 0) { + buf += wb; + buflen -= wb; + *buf = '\n'; + *(buf + 1) = '\0'; + } + + log_zone_warning("%s", sbuf); } void |