openipmi-2.0.18/0000755000175000017500000000000011367555460012412 5ustar chuckchuckopenipmi-2.0.18/compile0000755000175000017500000000717310532451263013765 0ustar chuckchuck#! /bin/sh # Wrapper for compilers which do not understand `-c -o'. scriptversion=2005-05-14.22 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand `-c -o'. Remove `-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; esac ofile= cfile= eat= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as `compile cc -o foo foo.c'. # So we strip `-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no `-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` # Create the lock directory. # Note: use `[/.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: openipmi-2.0.18/config.sub0000755000175000017500000010115310756112266014370 0ustar chuckchuck#! /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 # Free Software Foundation, Inc. timestamp='2008-01-16' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 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." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | 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 \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-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. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | 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-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: openipmi-2.0.18/mkinstalldirs0000755000175000017500000000370410447342004015206 0ustar chuckchuck#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" 1>&2 exit 0 ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac case $dirmode in '') if mkdir -p -- . 2>/dev/null; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" fi ;; *) if mkdir -m "$dirmode" -p -- . 2>/dev/null; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" fi ;; esac for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr="" chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp="$pathcomp/" done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # End: # mkinstalldirs ends here openipmi-2.0.18/README0000644000175000017500000003457010445414173013272 0ustar chuckchuck This is the OpenIPMI library, a library that makes simplifies building complex IPMI management software. What is IPMI? ============= IPMI is a specification detailing how to detect and manage sensors in a system. It also specifies some chassis-level thing like power control, reset, FRU (Field Replaceable Unit) information, and watchdogs. However, IPMI has become much more than that. Vendors have added extensions to IPMI for doing many thing, including controlling LEDs, relays, character displays, and managing hot-swapping components. In general, it has become the "standard" way to handle hardware maintenance in a system. IPMI specifies a set of interconnected intelligent Management Controllers (MCs). Each MC is a small CPU that manages a set of sensors and/or output devices. The "main" MC is called the Baseboard Management Controller (BMC); it provides the external interfaces into the system. Each MC may have a set of Sensor Data Records (SDRs). An SDR details information about a sensor. Some SDR records also have information about entities, such as their name, the FRU information, and what other entities they are contained in. Entities are the physical objects in the system (boards, CPUs, fans, power supplies, etc.) A sensor is attached to the entity it monitors; the SDR record tell what entity a sensor monitors. IPMI specifies several external interfaces to the BMC. One set is local interfaces directly to a CPU, a local CPU connections is called a system interface. The other is external interfaces through a LAN, serial port, or modem. The external interfaces allow a system to be managed even when it is turned off, since the BMC is always powered when the system is plugged in. IPMI has a strong bent toward complete "chassis" systems, basically a box with one main board with CPUs; a BMC, and perhaps a few satellite MCs in things like power supplies. It is being rapidly adopted in "shelf" systems, which has a set of slots where you can plug in complete single-board computers. In shelf systems, the BMC becomes a central shelf manager that manages all the boards in the shelf. Although IPMI was not designed for this, it does a pretty good job of extending into this architecture. What is OpenIPMI? ================= Notice that in the description above, OpenIPMI was designed to aid building "complex IPMI management software". That's a carefully chosen description. Most of the OpenIPMI library was designed for building complicated systems that continuously monitor IPMI hardware. It's not for little things that simply want to get some information, do something, and leave (unless that information is elaborate information). OpenIPMI will connect with an IPMI controller, detect any management controllers on the bus, get their SDRs, manage all the entities in the system, manage the event log, and a host of other things. As you might imagine, that is a fairly lengthy process on a complex system. OpenIPMI is also dynamic and event-driven. It will come up and start discovering things in the managed system. As it discovers things, it will report them to the software using it (assuming the software has asked for this reporting). This process of discovery is never done from OpenIPMI's point of view; things can come and go in the system and it will report these changes as it detects them. This can be a little confusing to people who want a static view of their system. OpenIPMI has no static view (though it does have a current view). When you make a connection, it will report when the connection is up; but the system will be "empty". You have to wait for OpenIPMI to report the things it finds. It is possible to use OpenIPMI's low-level connection code if you want to do a direct connection to a BMC (through the LAN or system interface). You can see the code in sample/ipmicmd.c for an example of how to do this. Most of the other pieces of OpenIPMI are not useful by themselves, though, because they are intrinsically tied together. Building and Configuring OpenIPMI ================================= OpenIPMI is built with standard autoconf/automake. You must configure OpenIPMI before you compile it. To do this, change to the main OpenIPMI directory and execute "./configure". The configure script will detect what is available in the system and configure itself accordingly. By default, the configure script will cause OpenIPMI to be installed in the "/usr/local" prefix. This means that the include files go into /usr/local/include/OpenIPMI, the libraries go into /usr/local/lib, the executables go into /usr/local/bin, etc. If you want to change the prefix, use the "--prefix=" option to configure. For instance, to install in /opt/OpenIPMI, you would do: ./configure --prefix=/opt/OpenIPMI Note that OpenIPMI will attempt to detect and use either the NET SNMP or UCD SNMP libraries. Note that if your NET SNMP or UCD SNMP library is in a non-standard location, you will need to use the '--with-ucdsnmp=' option with configure to specify the actual path to your library. You also *must* have the development system for your SNMP library installed. If you don't have the development system installed, just the runtime libraries, OpenIPMI will not detect or use the SNMP libraries. If you do not want to use the SNMP libraries even if they are installed, you can specify '--with-ucdsnmp=no' as a configure option. After you have configured OpenIPMI, type "make" to build it. To install it in the prefix you defined, do "make install". OpenIPMI requires the following packages: * popt * curses, ncurses or termcap OpenIPMI can use, but does not require, the following packages: * netsnmp or ucdsnmp - netsnmp is the preferred SNMP package, but it will use either of these. Without this, the sample programs will not be able to receive SNMP traps, but there is no functional change to the library. * openssl - This is required for IPMI 2.0 RMCP+ encryption and authentication support. See FAQ item 2.22 for details. * glib (along with pkgconfig) - glib 2.0 is preferred, but glib 1.2 will be used if 2.0 is not available. This is simply an OS handler for glib and it not used for anything else in OpenIPMI itself, but is useful for users using glib. Note that OpenIPMI will be able to use both glib 1.2 an glib 2.0 at the same time, but this is difficult and not recommended. * swig 1.3.21 or later - This is required for perl and python language support. Without it, perl, python, and the GUI will not work. * perl - Support for writing scripts in the perl language that use the OpenIPMI library. * python - Support for writing scripts in the python language that use the OpenIPMI library. * Tcl/Tk - There is no Tcl language support (someone may contribute that, though). However, A Tcl OS handler is provided so that Perl and Python may use the Tk widgets. Without this, the GUI will not work. Note that getting Tcl/Tk to work right can be difficult, see below for more details. * Tkinter/Tix - Python GUI libraries. Required for the GUI to work. * gdbm - This is used on *nix for local SDR caching. This is not required, but it *really* speeds up startup. Note you need to install the development packages (generally ending in -dev) of most of these for OpenIPMI to pick it up. You can examine the output of configure to make sure they are properly discovered. Getting Tcl/Tk to work ====================== Tcl is installed in various places, and the configure script probably won't find it. If it doesn't, you must specify the install location for Tcl by adding: --with-tclcflags=flags --with-tcllibs=lib For instance, on my Debian Linux system, I have to specify: ./configure --with-tclcflags="-I /usr/include/tcl8.4" --with-tcllibs=-ltcl8.4 to make it work right. If you don't get this right, you don't get a GUI! Using ipmish ============ ipmish is a command interpreter that lets you execute IPMI operations, get the results, etc. It gives you the full power of OpenIPMI. It can easily be driven with a TCL script or the like. See the man page for more details. The OpenIPMI GUI ================ The GUI is cleverly named openipmigui and provides a GUI interface to most of OpenIPMI. It also has the standard command language (like ipmish) available in a window, so it has all the power of ipmish. To use the GUI, you have to have the following optional packages: * swig 1.3.21 or later * python * Tcl/Tk * Tkinter/Tix The GUI is documented in the openipmigui man page. Using ipmi_ui ============= ipmi_ui is a cheesy little tool that runs on top of the OpenIPMI library. It provides a command line and text-window based view into an IPMI system. A man page is included for it, if you want to know more. Note that ipmi_ui was written primarily for testing. It does things that users generally shouldn't do. You can use it for examples, but it touches things that are considered OpenIPMI internal, so be careful what you use. ipmish and the sample code is a much better example. Perl/Python and OpenIPMI ======================== OpenIPMI has perl and python bindings using swig. The public interface of OpenIPMI is available, but the private interfaces are not (and a few other things like SNMP trap support). It is fully function. I was hoping that swig would generate documentation from the comments, but it turns out that it does not do that. You can look at swig/OpenIPMI.i for the documentation on all the interfaces, and swig/perl/sample and the gui in swig/python/openipmigui.py for a piece of sample code that uses most of the interfaces. The interface is object-oriented, so you have to know how to do OO Perl or Pythong to use this. It is like this because that is the most natural way to use SWIG (and it makes more OO languages like python easier). OpenIPMI and SNMP ================= The OpenIPMI ipmi_ui command has an optional trap handler. It will use incoming traps as an indication that something is waiting in the SEL for it to fetch and immediately start a fetch. You have to have the UCD snmp library (or something compatible) installed for this to work, and you have to start ipmi_ui with the '-snmp' option. You must do this as root, as the SNMP Trap port is 162. You may ask why the trap is not directly used, why does it just trigger an SEL fetch? Well, that's because the IPMI trap does not have enough information to determine the correct sensor (it's missing the channel and LUN) and it does not have enough information to correlate the SEL entries with the trap (It doesn't have the record ID or necessarily the proper timestamp). Also, OpenIPMI does not directly handle the traps. Instead, it has an interface to report a trap when it has been received. OpenIPMI does not want to assume the SNMP library being used; instead it lets the user pick that library. If you want an example of how to use the UCD SNMP or NET SNMP libraries and hook them into OpenIPMI, the ui/basic_ui.c file has an example of this. What Else Comes with OpenIPMI? ============================== It does include the utility "ipmicmd" which lets you do direct IPMI commands to a connection. ipmicmd can connect using the OpenIPMI driver or via IPMI LAN. OpenIPMI also includes a LAN to system interface converter, it can sit on top of an OpenIPMI driver and supply a LAN connection to the BMC. Note that to work the best, the LAN converter needs at least the v22 version of the OpenIPMI driver to support setting retries and timeouts for messages. Other sample code for using OpenIPMI is in the "samples" directory. IPMI Documentation ================== OpenIPMI includes a texinfo document in the "doc" directory. It talks a little about IPMI, must mostly about OpenIPMI. It is required reading for using OpenIPMI. Read it carefully. Unfortunately, the IPMI spec is also currently required reading for using OpenIPMI. Fortunately, you do not need to read the whole spec. If you read the OpenIPMI document first, you can probably get by with reading the following sections in the 1.5 spec: * 1.6 (overview) * 5.2 (for the error completion codes) * 33-36 (talking about sensors and entities) * 37.1 (talking about the main sensor SDR, mostly for learning about sensor capabilities). OpenIPMI should hide the rest from you. The OpenIPMI document is currently just an overview. It should point you in all the right directions, but it does not contain the actual details of most OpenIPMI functions. Those are currently documented in the include files, so you will have to look through the include files for how to use the functions. OpenIPMI Source Structure ========================= Note that parts of OpenIPMI could be used inside other systems. However, the LGPL license may be a restriction. If you are interested in re-licensing parts of OpenIPMI, contact MontaVista software. The source tree here consists of the following directories: +---cmdlang - A command-line interpreter that gives access to the | OpenIPMI library. Includes a user interface named | openipmish that demonstrates how to use it. | +--- doc - The main documentation for OpenIPMI | +---glib - A glib OS handler. | +---include | +---linux - linux-specific include files | \---OpenIPMI - User-visible include files for OpenIPMI | \---internal - Internal include files, only for plugins | +---lanserv - Code to provide a LAN interface to an IPMI device and | to provide an IPMI simulator | +---lib - The man OpenIPMI code. This is where all the logic for the | handling of IPMI messages is. | +---libedit - A readline replacement that provides cmdlang/openipmish | | with command line editing. | \---editline - Include files for libedit | +---man - The man pages for the | +---sample - Sample code and utilities that use the OpenIPMI library. | +---swig - The main interpreter interface. swig is a program that | | takes a general description of a C/C++ interface and | | provides the equivalent interface in various interpreters. | +---perl - Perl-specific code for swig, including sample code and | | tests. | \---python - Python-specific code for swig. | \---openipmigui - A GUI for OpenIPMI, written in Python. | +---tcl - A TCL OS handler | +---ui - A depracated UI for OpenIPMI. | +---unix - A POSIX OS handler, one for threaded and one for | non-threaded applications/ | \---utils - General utility code used by both the OpenIPMI library and by the lanserv code. openipmi-2.0.18/utils/0000755000175000017500000000000011367555456013557 5ustar chuckchuckopenipmi-2.0.18/utils/locked_list.c0000644000175000017500000002351410320111300016160 0ustar chuckchuck/* * locked_list.c * * Code for building a locked list. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #define LOCKED_LIST_ENTRIES_INCREMENT 5 struct locked_list_entry_s { unsigned int destroyed; void *item1, *item2; locked_list_entry_t *next, *prev; locked_list_entry_t *dlist_next; }; struct locked_list_s { unsigned int destroyed; unsigned int cb_count; locked_list_lock_cb lock, unlock; void *lock_cb_data; unsigned int count; locked_list_entry_t head; locked_list_entry_t *destroy_list; }; static void ll_std_lock(void *cb_data) { ipmi_lock_t *lock = cb_data; ipmi_lock(lock); } static void ll_std_unlock(void *cb_data) { ipmi_lock_t *lock = cb_data; ipmi_unlock(lock); } locked_list_t * locked_list_alloc(os_handler_t *os_hnd) { locked_list_t *ll; int rv; ipmi_lock_t *lock; ll = ipmi_mem_alloc(sizeof(*ll)); if (!ll) return NULL; memset(ll, 0, sizeof(*ll)); rv = ipmi_create_lock_os_hnd(os_hnd, &lock); if (rv) { ipmi_mem_free(ll); return NULL; } ll->lock = ll_std_lock; ll->unlock = ll_std_unlock; ll->lock_cb_data = lock; ll->destroyed = 0; ll->cb_count = 0; ll->count = 0; ll->destroy_list = NULL; ll->head.next = &ll->head; ll->head.prev = &ll->head; return ll; } locked_list_t * locked_list_alloc_my_lock(locked_list_lock_cb lock_func, locked_list_lock_cb unlock_func, void *lock_func_cb_data) { locked_list_t *ll; ll = ipmi_mem_alloc(sizeof(*ll)); if (!ll) return NULL; memset(ll, 0, sizeof(*ll)); ll->lock = lock_func; ll->unlock = unlock_func; ll->lock_cb_data = lock_func_cb_data; ll->destroyed = 0; ll->cb_count = 0; ll->count = 0; ll->destroy_list = NULL; ll->head.next = &ll->head; ll->head.prev = &ll->head; return ll; } void locked_list_destroy(locked_list_t *ll) { locked_list_entry_t *entry, *next; entry = ll->head.next; while (entry != &ll->head) { next = entry->next; ipmi_mem_free(entry); entry = next; } if (ll->lock == ll_std_lock) ipmi_destroy_lock(ll->lock_cb_data); ipmi_mem_free(ll); } static locked_list_entry_t * internal_find(locked_list_t *ll, void *item1, void *item2) { locked_list_entry_t *entry; entry = ll->head.next; while (entry != &ll->head) { if ((!entry->destroyed) && (entry->item1 == item1) && (entry->item2 == item2)) { return entry; } entry = entry->next; } return NULL; } int locked_list_add_entry(locked_list_t *ll, void *item1, void *item2, locked_list_entry_t *entry) { int rv = 1; if (!entry) entry = ipmi_mem_alloc(sizeof(*entry)); if (!entry) return 0; ll->lock(ll->lock_cb_data); /* We don't allow duplicates. */ if (internal_find(ll, item1, item2)) { ipmi_mem_free(entry); rv = 2; goto out_unlock; } entry->item1 = item1; entry->item2 = item2; entry->destroyed = 0; entry->next = &ll->head; entry->prev = ll->head.prev; entry->prev->next = entry; entry->next->prev = entry; ll->count++; out_unlock: ll->unlock(ll->lock_cb_data); return rv; } int locked_list_add(locked_list_t *ll, void *item1, void *item2) { return locked_list_add_entry(ll, item1, item2, NULL); } int locked_list_add_entry_nolock(locked_list_t *ll, void *item1, void *item2, locked_list_entry_t *entry) { int rv = 1; if (!entry) entry = ipmi_mem_alloc(sizeof(*entry)); if (!entry) return 0; /* We don't allow duplicates. */ if (internal_find(ll, item1, item2)) { ipmi_mem_free(entry); rv = 2; goto out; } entry->item1 = item1; entry->item2 = item2; entry->destroyed = 0; entry->next = &ll->head; entry->prev = ll->head.prev; entry->prev->next = entry; entry->next->prev = entry; ll->count++; out: return rv; } int locked_list_add_nolock(locked_list_t *ll, void *item1, void *item2) { return locked_list_add_entry_nolock(ll, item1, item2, NULL); } int locked_list_remove_nolock(locked_list_t *ll, void *item1, void *item2) { int rv; locked_list_entry_t *entry; entry = internal_find(ll, item1, item2); if (!entry) { rv = 0; } else { rv = 1; ll->count--; if (ll->cb_count) { /* We are in callbacks, just mark it destroyed and let the last call back exit clear it up. */ entry->destroyed = 1; entry->dlist_next = ll->destroy_list; ll->destroy_list = entry; } else { entry->next->prev = entry->prev; entry->prev->next = entry->next; ipmi_mem_free(entry); } } return rv; } int locked_list_remove(locked_list_t *ll, void *item1, void *item2) { int rv; ll->lock(ll->lock_cb_data); rv = locked_list_remove_nolock(ll, item1, item2); ll->unlock(ll->lock_cb_data); return rv; } void locked_list_iterate_prefunc_nolock(locked_list_t *ll, locked_list_handler_cb prefunc, locked_list_handler_cb handler, void *cb_data) { int rv; locked_list_entry_t *entry; ll->cb_count++; entry = ll->head.next; while (entry != &ll->head) { if (!entry->destroyed) { void *item1, *item2; int process = 1; item1 = entry->item1; item2 = entry->item2; if (prefunc) { rv = prefunc(cb_data, item1, item2); if (rv == LOCKED_LIST_ITER_SKIP) process = 0; else if (rv) break; } if (process && handler) { ll->unlock(ll->lock_cb_data); rv = handler(cb_data, item1, item2); ll->lock(ll->lock_cb_data); if (rv) break; } } entry = entry->next; } ll->cb_count--; /* If no one else is going through the list, clean up the destroyed entries. */ if (ll->cb_count == 0) { while (ll->destroy_list) { entry = ll->destroy_list; ll->destroy_list = entry->dlist_next; entry->next->prev = entry->prev; entry->prev->next = entry->next; ipmi_mem_free(entry); } } } void locked_list_iterate_prefunc(locked_list_t *ll, locked_list_handler_cb prefunc, locked_list_handler_cb handler, void *cb_data) { ll->lock(ll->lock_cb_data); locked_list_iterate_prefunc_nolock(ll, prefunc, handler, cb_data); ll->unlock(ll->lock_cb_data); } void locked_list_iterate(locked_list_t *ll, locked_list_handler_cb handler, void *cb_data) { ll->lock(ll->lock_cb_data); locked_list_iterate_prefunc_nolock(ll, NULL, handler, cb_data); ll->unlock(ll->lock_cb_data); } void locked_list_iterate_nolock(locked_list_t *ll, locked_list_handler_cb handler, void *cb_data) { locked_list_iterate_prefunc_nolock(ll, NULL, handler, cb_data); } unsigned int locked_list_num_entries(locked_list_t *ll) { unsigned int rv; ll->lock(ll->lock_cb_data); rv = ll->count; ll->unlock(ll->lock_cb_data); return rv; } unsigned int locked_list_num_entries_nolock(locked_list_t *ll) { return ll->count; } locked_list_entry_t * locked_list_alloc_entry(void) { return ipmi_mem_alloc(sizeof(locked_list_entry_t)); } void locked_list_free_entry(locked_list_entry_t *entry) { ipmi_mem_free(entry); } void locked_list_lock(locked_list_t *ll) { ll->lock(ll->lock_cb_data); } void locked_list_unlock(locked_list_t *ll) { ll->unlock(ll->lock_cb_data); } openipmi-2.0.18/utils/md5.c0000644000175000017500000003277110167573273014414 0ustar chuckchuck/* md5.c - MD5 Message-Digest Algorithm * Copyright (C) 1995,1996,1998,1999,2001,2002 Free Software Foundation, Inc. * * Modifications for IPMI are Copyright(C) 2002,2003 MontaVista Software. * Corey Minyard * * This file is part of Libgcrypt. * * Libgcrypt is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * Libgcrypt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * According to the definition of MD5 in RFC 1321 from April 1992. * NOTE: This is *not* the same file as the one from glibc. * Written by Ulrich Drepper , 1995. * heavily modified for GnuPG by Werner Koch */ /* Test values: * "" D4 1D 8C D9 8F 00 B2 04 E9 80 09 98 EC F8 42 7E * "a" 0C C1 75 B9 C0 F1 B6 A8 31 C3 99 E2 69 77 26 61 * "abc 90 01 50 98 3C D2 4F B0 D6 96 3F 7D 28 E1 7F 72 * "message digest" F9 6B 69 7D 7C B7 93 8D 52 5A 2F 31 AA F1 61 D0 */ #include #include #include #include #include typedef uint32_t u32; typedef uint8_t byte; #define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) ) typedef struct { u32 A,B,C,D; /* chaining variables */ u32 nblocks; byte buf[64]; int count; } MD5_CONTEXT; static void md5_init( MD5_CONTEXT *ctx ) { ctx->A = 0x67452301; ctx->B = 0xefcdab89; ctx->C = 0x98badcfe; ctx->D = 0x10325476; ctx->nblocks = 0; ctx->count = 0; } static void burn_stack (int bytes) { char buf[128]; memset (buf, 0, sizeof buf); bytes -= sizeof buf; if (bytes > 0) burn_stack (bytes); } /* These are the four functions used in the four steps of the MD5 algorithm and defined in the RFC 1321. The first function is a little bit optimized (as found in Colin Plumbs public domain implementation). */ /* #define FF(b, c, d) ((b & c) | (~b & d)) */ #define FF(b, c, d) (d ^ (b & (c ^ d))) #define FG(b, c, d) FF (d, b, c) #define FH(b, c, d) (b ^ c ^ d) #define FI(b, c, d) (c ^ (b | ~d)) /**************** * transform n*64 bytes */ static void /*transform( MD5_CONTEXT *ctx, const void *buffer, size_t len )*/ transform( MD5_CONTEXT *ctx, byte *data ) { u32 correct_words[16]; register u32 A = ctx->A; register u32 B = ctx->B; register u32 C = ctx->C; register u32 D = ctx->D; u32 *cwp = correct_words; int i; byte *p1; for(i=0, p1=data; i < 16; i++, p1 += 4) correct_words[i] = p1[0] | (p1[1] << 8) | (p1[2] << 16) | (p1[3] << 24); #define OP(a, b, c, d, s, T) \ do \ { \ a += FF (b, c, d) + (*cwp++) + T; \ a = rol(a, s); \ a += b; \ } \ while (0) /* Before we start, one word about the strange constants. They are defined in RFC 1321 as T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 */ /* Round 1. */ OP (A, B, C, D, 7, 0xd76aa478); OP (D, A, B, C, 12, 0xe8c7b756); OP (C, D, A, B, 17, 0x242070db); OP (B, C, D, A, 22, 0xc1bdceee); OP (A, B, C, D, 7, 0xf57c0faf); OP (D, A, B, C, 12, 0x4787c62a); OP (C, D, A, B, 17, 0xa8304613); OP (B, C, D, A, 22, 0xfd469501); OP (A, B, C, D, 7, 0x698098d8); OP (D, A, B, C, 12, 0x8b44f7af); OP (C, D, A, B, 17, 0xffff5bb1); OP (B, C, D, A, 22, 0x895cd7be); OP (A, B, C, D, 7, 0x6b901122); OP (D, A, B, C, 12, 0xfd987193); OP (C, D, A, B, 17, 0xa679438e); OP (B, C, D, A, 22, 0x49b40821); #undef OP #define OP(f, a, b, c, d, k, s, T) \ do \ { \ a += f (b, c, d) + correct_words[k] + T; \ a = rol(a, s); \ a += b; \ } \ while (0) /* Round 2. */ OP (FG, A, B, C, D, 1, 5, 0xf61e2562); OP (FG, D, A, B, C, 6, 9, 0xc040b340); OP (FG, C, D, A, B, 11, 14, 0x265e5a51); OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); OP (FG, A, B, C, D, 5, 5, 0xd62f105d); OP (FG, D, A, B, C, 10, 9, 0x02441453); OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); OP (FG, D, A, B, C, 14, 9, 0xc33707d6); OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); OP (FG, B, C, D, A, 8, 20, 0x455a14ed); OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); OP (FG, C, D, A, B, 7, 14, 0x676f02d9); OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); /* Round 3. */ OP (FH, A, B, C, D, 5, 4, 0xfffa3942); OP (FH, D, A, B, C, 8, 11, 0x8771f681); OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); OP (FH, B, C, D, A, 14, 23, 0xfde5380c); OP (FH, A, B, C, D, 1, 4, 0xa4beea44); OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); OP (FH, B, C, D, A, 6, 23, 0x04881d05); OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); /* Round 4. */ OP (FI, A, B, C, D, 0, 6, 0xf4292244); OP (FI, D, A, B, C, 7, 10, 0x432aff97); OP (FI, C, D, A, B, 14, 15, 0xab9423a7); OP (FI, B, C, D, A, 5, 21, 0xfc93a039); OP (FI, A, B, C, D, 12, 6, 0x655b59c3); OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); OP (FI, C, D, A, B, 10, 15, 0xffeff47d); OP (FI, B, C, D, A, 1, 21, 0x85845dd1); OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); OP (FI, C, D, A, B, 6, 15, 0xa3014314); OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); OP (FI, A, B, C, D, 4, 6, 0xf7537e82); OP (FI, D, A, B, C, 11, 10, 0xbd3af235); OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); OP (FI, B, C, D, A, 9, 21, 0xeb86d391); /* Put checksum in context given as argument. */ ctx->A += A; ctx->B += B; ctx->C += C; ctx->D += D; } /* The routine updates the message-digest context to * account for the presence of each of the characters inBuf[0..inLen-1] * in the message whose digest is being computed. */ static void md5_write( MD5_CONTEXT *hd, byte *inbuf, size_t inlen) { if( hd->count == 64 ) { /* flush the buffer */ transform( hd, hd->buf ); burn_stack (80+6*sizeof(void*)); hd->count = 0; hd->nblocks++; } if( !inbuf ) return; if( hd->count ) { for( ; inlen && hd->count < 64; inlen-- ) hd->buf[hd->count++] = *inbuf++; md5_write( hd, NULL, 0 ); if( !inlen ) return; } burn_stack (80+6*sizeof(void*)); while( inlen >= 64 ) { transform( hd, inbuf ); hd->count = 0; hd->nblocks++; inlen -= 64; inbuf += 64; } for( ; inlen && hd->count < 64; inlen-- ) hd->buf[hd->count++] = *inbuf++; } /* The routine final terminates the message-digest computation and * ends with the desired message digest in mdContext->digest[0...15]. * The handle is prepared for a new MD5 cycle. * Returns 16 bytes representing the digest. */ static void md5_final( MD5_CONTEXT *hd ) { u32 t, msb, lsb; byte *p; md5_write(hd, NULL, 0); /* flush */; t = hd->nblocks; /* multiply by 64 to make a byte count */ lsb = t << 6; msb = t >> 26; /* add the count */ t = lsb; if( (lsb += hd->count) < t ) msb++; /* multiply by 8 to make a bit count */ t = lsb; lsb <<= 3; msb <<= 3; msb |= t >> 29; if( hd->count < 56 ) { /* enough room */ hd->buf[hd->count++] = 0x80; /* pad */ while( hd->count < 56 ) hd->buf[hd->count++] = 0; /* pad */ } else { /* need one extra block */ hd->buf[hd->count++] = 0x80; /* pad character */ while( hd->count < 64 ) hd->buf[hd->count++] = 0; md5_write(hd, NULL, 0); /* flush */; memset(hd->buf, 0, 56 ); /* fill next block with zeroes */ } /* append the 64 bit count */ hd->buf[56] = lsb ; hd->buf[57] = lsb >> 8; hd->buf[58] = lsb >> 16; hd->buf[59] = lsb >> 24; hd->buf[60] = msb ; hd->buf[61] = msb >> 8; hd->buf[62] = msb >> 16; hd->buf[63] = msb >> 24; transform( hd, hd->buf ); burn_stack (80+6*sizeof(void*)); p = hd->buf; #define X(a) do { *p++ = hd->a ; *p++ = hd->a >> 8; \ *p++ = hd->a >> 16; *p++ = hd->a >> 24; } while(0) X(A); X(B); X(C); X(D); #undef X } static byte * md5_read( MD5_CONTEXT *hd ) { return hd->buf; } struct ipmi_authdata_s { void *info; void *(*mem_alloc)(void *info, int size); void (*mem_free)(void *info, void *data); unsigned char data[20]; unsigned int datalen; }; /* External functions for the IPMI authcode algorithms. */ int ipmi_md5_authcode_initl(const unsigned char *password, unsigned int password_len, ipmi_authdata_t *handle, void *info, void *(*mem_alloc)(void *info, int size), void (*mem_free)(void *info, void *data)) { struct ipmi_authdata_s *data; if (password_len > 20) return EINVAL; data = mem_alloc(info, sizeof(*data)); if (!data) return ENOMEM; data->info = info; data->mem_alloc = mem_alloc; data->mem_free = mem_free; memcpy(data->data, password, password_len); data->datalen = password_len; *handle = data; return 0; } int ipmi_md5_authcode_init(unsigned char *password, ipmi_authdata_t *handle, void *info, void *(*mem_alloc)(void *info, int size), void (*mem_free)(void *info, void *data)) { return ipmi_md5_authcode_initl(password, 16, handle, info, mem_alloc, mem_free); } int ipmi_md5_authcode_gen(ipmi_authdata_t handle, ipmi_auth_sg_t data[], void *output) { MD5_CONTEXT ctx; int i; md5_init(&ctx); md5_write(&ctx, handle->data, handle->datalen); for (i=0; data[i].data != NULL; i++) { md5_write(&ctx, data[i].data, data[i].len); } md5_write(&ctx, handle->data, handle->datalen); md5_final(&ctx); memcpy(output, md5_read(&ctx), 16); return 0; } int ipmi_md5_authcode_check(ipmi_authdata_t handle, ipmi_auth_sg_t data[], void *code) { MD5_CONTEXT ctx; int i; md5_init(&ctx); md5_write(&ctx, handle->data, handle->datalen); for (i=0; data[i].data != NULL; i++) { md5_write(&ctx, data[i].data, data[i].len); } md5_write(&ctx, handle->data, handle->datalen); md5_final(&ctx); if (memcmp(code, md5_read(&ctx), 16) != 0) return EINVAL; return 0; } void ipmi_md5_authcode_cleanup(ipmi_authdata_t handle) { memset(handle->data, 0, sizeof(handle->data)); handle->mem_free(handle->info, handle); } /* The stuff below is libgcrypt-specific, and does not apply to IPMI. The stuff above is generic. Nice separation, thank you :-). -Corey Minyard */ #if 0 /**************** * Return some information about the algorithm. We need algo here to * distinguish different flavors of the algorithm. * Returns: A pointer to string describing the algorithm or NULL if * the ALGO is invalid. */ static const char * md5_get_info( int algo, size_t *contextsize, byte **r_asnoid, int *r_asnlen, int *r_mdlen, void (**r_init)( void *c ), void (**r_write)( void *c, byte *buf, size_t nbytes ), void (**r_final)( void *c ), byte *(**r_read)( void *c ) ) { static byte asn[18] = /* Object ID is 1.2.840.113549.2.5 */ { 0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86,0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10 }; if( algo != 1 ) return NULL; *contextsize = sizeof(MD5_CONTEXT); *r_asnoid = asn; *r_asnlen = DIM(asn); *r_mdlen = 16; *(void (**)(MD5_CONTEXT *))r_init = md5_init; *(void (**)(MD5_CONTEXT *, byte*, size_t))r_write = md5_write; *(void (**)(MD5_CONTEXT *))r_final = md5_final; *(byte *(**)(MD5_CONTEXT *))r_read = md5_read; return "MD5"; } #ifndef IS_MODULE static #endif const char * const gnupgext_version = "MD5 ($Revision: 1.4 $)"; static struct { int class; int version; int value; void (*func)(void); } func_table[] = { { 10, 1, 0, (void(*)(void))md5_get_info }, { 11, 1, 1 }, }; #ifndef IS_MODULE static #endif void * gnupgext_enum_func( int what, int *sequence, int *class, int *vers ) { void *ret; int i = *sequence; do { if( i >= DIM(func_table) || i < 0 ) return NULL; *class = func_table[i].class; *vers = func_table[i].version; switch( *class ) { case 11: case 21: case 31: ret = &func_table[i].value; break; default: ret = func_table[i].func; break; } i++; } while( what && what != *class ); *sequence = i; return ret; } #ifndef IS_MODULE void _gcry_md5_constructor(void) { _gcry_register_internal_cipher_extension( gnupgext_version, gnupgext_enum_func ); } #endif #endif /* end of file */ openipmi-2.0.18/utils/md2.c0000644000175000017500000002365510320111300014354 0ustar chuckchuck/* md2.c - MD2 Message-Digest Algorithm * Copyright (C) 2002,2003 MontaVista Software. * Corey Minyard * * This file is part of the IPMI Interface (IPMIIF). * * This is the MD2 algorithm, as defined by RFC1319. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include typedef uint32_t u32; typedef uint8_t byte; typedef struct { byte buf[48]; byte inbuf[16]; byte checksum[16]; int count; byte l; } MD2_CONTEXT; static void md2_init( MD2_CONTEXT *ctx ) { memset(ctx->buf, 0, 16); memset(ctx->checksum, 0, 16); ctx->count = 0; ctx->l = 0; } /* The "Bytes of PI" defined by the algorithm. */ static byte s[256] = { 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, 148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50, 39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165, 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27, 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, 129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, 166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237, 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 }; static void checksum( MD2_CONTEXT *ctx ) { int j; for (j=0; j<16; j++) { ctx->checksum[j] ^= s[ctx->inbuf[j] ^ ctx->l]; ctx->l = ctx->checksum[j]; } } /**************** * transform 16 bytes */ static void transform( MD2_CONTEXT *ctx ) { int j, k; int t; for (j=0; j<16; j++) { ctx->buf[j+16] = ctx->inbuf[j]; ctx->buf[j+32] = ctx->inbuf[j] ^ ctx->buf[j]; } t = 0; for (j=0; j<18; j++) { for (k=0; k<48; k++) { t = ctx->buf[k] ^ s[t]; ctx->buf[k] = t; } t = (t + j) % 256; } } /* The routine updates the message-digest context to * account for the presence of each of the characters inBuf[0..inLen-1] * in the message whose digest is being computed. */ static void md2_write( MD2_CONTEXT *ctx, byte *inbuf, size_t inlen ) { int cnt; if( !inbuf ) return; if (ctx->count+inlen > 16) cnt = 16-ctx->count; else cnt = inlen; memcpy(ctx->inbuf+ctx->count, inbuf, cnt); inbuf += cnt; inlen -= cnt; ctx->count += cnt; while (ctx->count == 16) { checksum(ctx); transform(ctx); if (inlen > 16) cnt = 16; else cnt = inlen; memcpy(ctx->inbuf, inbuf, cnt); inbuf += cnt; inlen -= cnt; ctx->count = cnt; } } /* The routine final terminates the message-digest computation and * ends with the desired message digest in mdContext->digest[0...15]. * The handle is prepared for a new MD2 cycle. * Returns 16 bytes representing the digest. */ static void md2_final( MD2_CONTEXT *ctx ) { int i, cnt; cnt = 16 - ctx->count; for (i=ctx->count; i<16; i++) ctx->inbuf[i] = cnt; checksum(ctx); transform(ctx); memcpy(ctx->inbuf, ctx->checksum, 16); transform(ctx); } static byte * md2_read( MD2_CONTEXT *hd ) { return hd->buf; } struct ipmi_authdata_s { void *info; void *(*mem_alloc)(void *info, int size); void (*mem_free)(void *info, void *data); unsigned char data[16]; }; /* External functions for the IPMI authcode algorithms. */ int ipmi_md2_authcode_init(unsigned char *password, ipmi_authdata_t *handle, void *info, void *(*mem_alloc)(void *info, int size), void (*mem_free)(void *info, void *data)) { struct ipmi_authdata_s *data; data = mem_alloc(info, sizeof(*data)); if (!data) return ENOMEM; data->info = info; data->mem_alloc = mem_alloc; data->mem_free = mem_free; memcpy(data->data, password, 16); *handle = data; return 0; } int ipmi_md2_authcode_gen(ipmi_authdata_t handle, ipmi_auth_sg_t data[], void *output) { MD2_CONTEXT ctx; int i; md2_init(&ctx); md2_write(&ctx, handle->data, 16); for (i=0; data[i].data != NULL; i++) { md2_write(&ctx, data[i].data, data[i].len); } md2_write(&ctx, handle->data, 16); md2_final(&ctx); memcpy(output, md2_read(&ctx), 16); return 0; } int ipmi_md2_authcode_check(ipmi_authdata_t handle, ipmi_auth_sg_t data[], void *code) { MD2_CONTEXT ctx; int i; md2_init(&ctx); md2_write(&ctx, handle->data, 16); for (i=0; data[i].data != NULL; i++) { md2_write(&ctx, data[i].data, data[i].len); } md2_write(&ctx, handle->data, 16); md2_final(&ctx); if (memcmp(code, md2_read(&ctx), 16) != 0) return EINVAL; return 0; } void ipmi_md2_authcode_cleanup(ipmi_authdata_t handle) { memset(handle->data, 0, sizeof(handle->data)); handle->mem_free(handle->info, handle); handle = NULL; } /* The stuff below is libgcrypt-specific, and does not apply to IPMI. The stuff above is generic. Nice separation, thank you :-). -Corey Minyard */ #if 0 /**************** * Return some information about the algorithm. We need algo here to * distinguish different flavors of the algorithm. * Returns: A pointer to string describing the algorithm or NULL if * the ALGO is invalid. */ static const char * md2_get_info( int algo, size_t *contextsize, byte **r_asnoid, int *r_asnlen, int *r_mdlen, void (**r_init)( void *c ), void (**r_write)( void *c, byte *buf, size_t nbytes ), void (**r_final)( void *c ), byte *(**r_read)( void *c ) ) { static byte asn[18] = /* Object ID is 1.2.840.113549.2.5 */ { 0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86,0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10 }; if( algo != 1 ) return NULL; *contextsize = sizeof(MD2_CONTEXT); *r_asnoid = asn; *r_asnlen = DIM(asn); *r_mdlen = 16; *(void (**)(MD2_CONTEXT *))r_init = md2_init; *(void (**)(MD2_CONTEXT *, byte*, size_t))r_write = md2_write; *(void (**)(MD2_CONTEXT *))r_final = md2_final; *(byte *(**)(MD2_CONTEXT *))r_read = md2_read; return "MD2"; } #ifndef IS_MODULE static #endif const char * const gnupgext_version = "MD2 ($Revision: 1.4 $)"; static struct { int class; int version; int value; void (*func)(void); } func_table[] = { { 10, 1, 0, (void(*)(void))md2_get_info }, { 11, 1, 1 }, }; #ifndef IS_MODULE static #endif void * gnupgext_enum_func( int what, int *sequence, int *class, int *vers ) { void *ret; int i = *sequence; do { if( i >= DIM(func_table) || i < 0 ) return NULL; *class = func_table[i].class; *vers = func_table[i].version; switch( *class ) { case 11: case 21: case 31: ret = &func_table[i].value; break; default: ret = func_table[i].func; break; } i++; } while( what && what != *class ); *sequence = i; return ret; } #ifndef IS_MODULE void _gcry_md2_constructor(void) { _gcry_register_internal_cipher_extension( gnupgext_version, gnupgext_enum_func ); } #endif #endif /* end of file */ openipmi-2.0.18/utils/os_handler.c0000644000175000017500000003057711033044133016024 0ustar chuckchuck/* * os_handler.c * * MontaVista IPMI os handler tools. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2006 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include /* * This code is subtle, be careful. * * We handle three basic modes here: * * * single-threaded OS handler * * multi-threaded OS handler, multi-threaded (num_threads > 0) * * multi-threaded OS handler, single threaded support (num_threads == 0) * (multi-single mode) * * Single threaded OS handler is simple. We just run the event loop * until the wait condition is done. * * Full multi-threaded mode is simple, too. We allocate threads to * run the event loop, then we use condition variables to operate. * * Multi-single mode is not simple. You can't just run the event * loop. Another thread may be running the event loop, too, and thus * handle the particular operation that frees up our event loop (thus * we will still be stuck waiting in our event loop). We can't have * another thread arbitrarily run the event loop, as we need to * support single-threaded system. * * So what we do is allocate a single thread. It runs the event loop * *only when something is waiting*. Thus we are single-threaded if * the app is single threaded. But since condition variables are used * for wakeups, we can support multi-threaded applications properly. */ struct os_handler_waiter_factory_s { os_handler_t *os_hnd; unsigned int num_threads; int thread_priority; int has_threads; os_hnd_lock_t *lock; os_hnd_cond_t *cond; /* Number of currently running threads. */ unsigned int thread_count; /* Number of wait structures we have out for this factory. */ unsigned int num_waiters; /* Tells the main thread to stop. */ volatile int stop_threads; /* Number of single-thread users. */ unsigned int single_thread_use_count; os_hnd_cond_t *single_thread_cond; }; struct os_handler_waiter_s { os_handler_waiter_factory_t *factory; os_hnd_lock_t *lock; os_hnd_cond_t *cond; /* Am I using multi-single mode and waiting? */ int is_single; unsigned int count; }; /* This is a normal event loop thread for full multi-threaded mode. */ static void waiter_thread(void *data) { os_handler_waiter_factory_t *factory = data; os_handler_t *os_hnd = factory->os_hnd; while (!factory->stop_threads) { struct timeval tv = { 1, 0 }; os_hnd->perform_one_op(os_hnd, &tv); } os_hnd->lock(os_hnd, factory->lock); factory->thread_count--; if (factory->thread_count == 0) os_hnd->cond_wake(os_hnd, factory->cond); os_hnd->unlock(os_hnd, factory->lock); } /* Event loop thread for multi-single mode. Subtle, be careful and read the comments. */ static void single_waiter_thread(void *data) { os_handler_waiter_factory_t *factory = data; os_handler_t *os_hnd = factory->os_hnd; os_hnd->lock(os_hnd, factory->lock); while (!factory->stop_threads) { /* While things are waiting, run out thread. This is subtle here. If we are truely single-threaded, the thing that releases the wait is going to be running from this thread. This single_thread_use_count will be set to zero before returning from perform_one_op, and we just quit and wait to be woken again and won't call more event loop operations. If we are not single-threaded (the app is multi-threaded) we still run from here, but the app better be ready for multi-threaded operation. */ while (factory->single_thread_use_count) { struct timeval tv = { 1, 0 }; os_hnd->unlock(os_hnd, factory->lock); os_hnd->perform_one_op(os_hnd, &tv); os_hnd->lock(os_hnd, factory->lock); } /* Wait for someone to tell us there are more event to run */ os_hnd->cond_wait(os_hnd, factory->single_thread_cond, factory->lock); } factory->thread_count--; if (factory->thread_count == 0) os_hnd->cond_wake(os_hnd, factory->cond); os_hnd->unlock(os_hnd, factory->lock); } int os_handler_alloc_waiter_factory(os_handler_t *os_hnd, unsigned int num_threads, int thread_priority, os_handler_waiter_factory_t **factory) { os_handler_waiter_factory_t *nf; int rv; unsigned int i; int has_threads = 0; if (os_hnd->create_lock && os_hnd->create_cond && os_hnd->create_thread) has_threads = 1; if ((num_threads > 0) && !has_threads) { /* Asked for threads, but handler doesn't support them. */ return ENOSYS; } nf = ipmi_mem_alloc(sizeof(*nf)); if (!nf) return ENOMEM; memset(nf, 0, sizeof(*nf)); nf->has_threads = has_threads; nf->os_hnd = os_hnd; nf->thread_priority = thread_priority; nf->num_threads = num_threads; if (has_threads) { rv = os_hnd->create_lock(os_hnd, &nf->lock); if (rv) { ipmi_mem_free(nf); return rv; } rv = os_hnd->create_cond(os_hnd, &nf->cond); if (rv) { os_hnd->destroy_lock(os_hnd, nf->lock); ipmi_mem_free(nf); return rv; } } if (num_threads > 0) { for (i=0; ithread_count++; rv = os_hnd->create_thread(os_hnd, thread_priority, waiter_thread, nf); if (rv) { nf->thread_count--; os_handler_free_waiter_factory(nf); return rv; } } } else if (has_threads) { rv = os_hnd->create_cond(os_hnd, &nf->single_thread_cond); if (rv) { os_handler_free_waiter_factory(nf); return rv; } nf->thread_count++; rv = os_hnd->create_thread(os_hnd, thread_priority, single_waiter_thread, nf); if (rv) { nf->thread_count--; os_handler_free_waiter_factory(nf); return rv; } } *factory = nf; return 0; } int os_handler_free_waiter_factory(os_handler_waiter_factory_t *factory) { os_handler_t *os_hnd = factory->os_hnd; if (factory->lock) os_hnd->lock(os_hnd, factory->lock); if (factory->stop_threads) return EINVAL; if (factory->num_waiters > 0) return EAGAIN; if (factory->thread_count > 0) { factory->stop_threads = 1; if (factory->single_thread_cond) os_hnd->cond_wake(os_hnd, factory->single_thread_cond); os_hnd->cond_wait(os_hnd, factory->cond, factory->lock); } if (factory->has_threads) { os_hnd->unlock(os_hnd, factory->lock); os_hnd->destroy_lock(os_hnd, factory->lock); os_hnd->destroy_cond(os_hnd, factory->cond); } if (factory->single_thread_cond) os_hnd->destroy_cond(os_hnd, factory->single_thread_cond); ipmi_mem_free(factory); return 0; } os_handler_waiter_t * os_handler_alloc_waiter(os_handler_waiter_factory_t *factory) { os_handler_waiter_t *nw; os_handler_t *os_hnd = factory->os_hnd; int rv; nw = ipmi_mem_alloc(sizeof(*nw)); if (!nw) return NULL; memset(nw, 0, sizeof(*nw)); nw->factory = factory; if (factory->has_threads) { rv = os_hnd->create_lock(os_hnd, &nw->lock); if (rv) { ipmi_mem_free(nw); return NULL; } rv = os_hnd->create_cond(os_hnd, &nw->cond); if (rv) { os_hnd->destroy_lock(os_hnd, nw->lock); ipmi_mem_free(nw); return NULL; } } if (factory->lock) os_hnd->lock(os_hnd, factory->lock); factory->num_waiters++; if (factory->lock) os_hnd->unlock(os_hnd, factory->lock); nw->count = 1; return nw; } int os_handler_free_waiter(os_handler_waiter_t *waiter) { os_handler_t *os_hnd = waiter->factory->os_hnd; if (waiter->count > 0) return EAGAIN; if (waiter->factory->lock) os_hnd->lock(os_hnd, waiter->factory->lock); waiter->factory->num_waiters--; if (waiter->factory->lock) os_hnd->unlock(os_hnd, waiter->factory->lock); if (waiter->lock) os_hnd->destroy_lock(os_hnd, waiter->lock); if (waiter->cond) os_hnd->destroy_cond(os_hnd, waiter->cond); ipmi_mem_free(waiter); return 0; } void os_handler_waiter_use(os_handler_waiter_t *waiter) { os_handler_t *os_hnd = waiter->factory->os_hnd; if (waiter->lock) os_hnd->lock(os_hnd, waiter->lock); waiter->count++; if (waiter->lock) os_hnd->unlock(os_hnd, waiter->lock); } void os_handler_waiter_release(os_handler_waiter_t *waiter) { os_handler_t *os_hnd = waiter->factory->os_hnd; if (waiter->lock) os_hnd->lock(os_hnd, waiter->lock); if (waiter->count == 0) { os_hnd->log(os_hnd, IPMI_LOG_SEVERE, "os_handler_waiter_release: Got a release when the" " wait count was already zero"); } else { waiter->count--; if (waiter->lock && (waiter->count == 0)) { if (waiter->is_single) { /* We handle the single thread count here and not in the waiter to avoid a race condition. See comments at the beginning of this file. */ os_hnd->lock(os_hnd, waiter->factory->lock); waiter->factory->single_thread_use_count--; os_hnd->unlock(os_hnd, waiter->factory->lock); waiter->is_single = 0; } os_hnd->cond_wake(os_hnd, waiter->cond); } } if (waiter->lock) os_hnd->unlock(os_hnd, waiter->lock); } int os_handler_waiter_wait(os_handler_waiter_t *waiter, struct timeval *timeout) { os_handler_waiter_factory_t *factory = waiter->factory; os_handler_t *os_hnd = waiter->factory->os_hnd; int rv = 0; if (waiter->lock) { os_hnd->lock(os_hnd, waiter->lock); if (waiter->count > 0) { if (factory->num_threads == 0) { /* Threaded, but we don't have a simultaneous running event loop. */ os_hnd->lock(os_hnd, factory->lock); if (factory->single_thread_use_count == 0) { /* Wake the event loop thread. */ os_hnd->cond_wake(os_hnd, factory->single_thread_cond); } factory->single_thread_use_count++; os_hnd->unlock(os_hnd, factory->lock); waiter->is_single = 1; } rv = os_hnd->cond_timedwait(os_hnd, waiter->cond, waiter->lock, timeout); /* single_thread_use_count is decremented by the waker unless it failes to receive the wakeup. */ if (rv) factory->single_thread_use_count--; } os_hnd->unlock(os_hnd, waiter->lock); } else { while (waiter->count > 0) os_hnd->perform_one_op(os_hnd, timeout); } return rv; } openipmi-2.0.18/utils/ilist.c0000644000175000017500000002602710320111277015027 0ustar chuckchuck/* * ilist.c * * Generic lists in C. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002,2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include ilist_t * alloc_ilist(void) { ilist_t *rv; rv = ilist_mem_alloc(sizeof(*rv)); if (!rv) return NULL; rv->head = ilist_mem_alloc(sizeof(*(rv->head))); if (!rv->head) { ilist_mem_free(rv); return NULL; } rv->head->malloced = 1; rv->head->next = rv->head; rv->head->prev = rv->head; rv->head->item = NULL; return rv; } ilist_iter_t * alloc_ilist_iter(ilist_t *list) { ilist_iter_t *rv; rv = ilist_mem_alloc(sizeof(*rv)); if (!rv) return NULL; rv->list = list; rv->curr = list->head; return rv; } void free_ilist(ilist_t *list) { ilist_item_t *curr, *next; curr = list->head->next; while (curr != list->head) { next = curr->next; if (curr->malloced) ilist_mem_free(curr); curr = next; } ilist_mem_free(list->head); ilist_mem_free(list); } void free_ilist_iter(ilist_iter_t *iter) { ilist_mem_free(iter); } static int add_after(ilist_item_t *pos, void *item, ilist_item_t *entry) { ilist_item_t *new_item; if (entry) { new_item = entry; new_item->malloced = 0; } else { new_item = ilist_mem_alloc(sizeof(*new_item)); if (!new_item) return 0; new_item->malloced = 1; } new_item->item = item; new_item->next = pos->next; new_item->prev = pos; new_item->prev->next = new_item; new_item->next->prev = new_item; return 1; } static int add_before(ilist_item_t *pos, void *item, ilist_item_t *entry) { ilist_item_t *new_item; if (entry) { new_item = entry; new_item->malloced = 0; } else { new_item = ilist_mem_alloc(sizeof(*new_item)); if (!new_item) return 0; new_item->malloced = 1; } new_item->item = item; new_item->next = pos; new_item->prev = pos->prev; new_item->prev->next = new_item; new_item->next->prev = new_item; return 1; } int ilist_add_head(ilist_t *list, void *item, ilist_item_t *entry) { return add_after(list->head, item, entry); } int ilist_add_tail(ilist_t *list, void *item, ilist_item_t *entry) { return add_before(list->head, item, entry); } int ilist_add_before(ilist_iter_t *iter, void *item, ilist_item_t *entry) { return add_before(iter->curr, item, entry); } int ilist_add_after(ilist_iter_t *iter, void *item, ilist_item_t *entry) { return add_after(iter->curr, item, entry); } int ilist_empty(ilist_t *list) { return list->head->next == list->head; } int ilist_first(ilist_iter_t *iter) { iter->curr = iter->list->head->next; if (iter->curr == iter->list->head) return 0; return 1; } int ilist_last(ilist_iter_t *iter) { iter->curr = iter->list->head->prev; if (iter->curr == iter->list->head) return 0; return 1; } int ilist_next(ilist_iter_t *iter) { if (iter->curr->next == iter->list->head) return 0; iter->curr = iter->curr->next; return 1; } int ilist_prev(ilist_iter_t *iter) { if (iter->curr->prev == iter->list->head) return 0; iter->curr = iter->curr->prev; return 1; } void * ilist_get(ilist_iter_t *iter) { if (iter->curr == iter->list->head) return NULL; return iter->curr->item; } int ilist_delete(ilist_iter_t *iter) { ilist_item_t *curr; if (ilist_empty(iter->list)) return 0; curr = iter->curr; iter->curr = curr->next; curr->next->prev = curr->prev; curr->prev->next = curr->next; if (curr->malloced) ilist_mem_free(curr); return 1; } void ilist_unpositioned(ilist_iter_t *iter) { iter->curr = iter->list->head; } void * ilist_search_iter(ilist_iter_t *iter, ilist_search_cb cmp, void *cb_data) { ilist_item_t *curr; curr = iter->curr->next; while (curr != iter->list->head) { if (cmp(curr->item, cb_data)) { iter->curr = curr; return curr->item; } curr = curr->next; } return NULL; } void * ilist_search(ilist_t *list, ilist_search_cb cmp, void *cb_data) { ilist_item_t *curr; curr = list->head->next; while (curr != list->head) { if (cmp(curr->item, cb_data)) { return curr->item; } curr = curr->next; } return NULL; } void ilist_iter(ilist_t *list, ilist_iter_cb handler, void *cb_data) { ilist_item_t *curr, *next; ilist_iter_t iter; iter.list = list; iter.curr = list->head->next; while (iter.curr != list->head) { curr = iter.curr; next = curr->next; handler(&iter, curr->item, cb_data); iter.curr = next; } } void ilist_iter_rev(ilist_t *list, ilist_iter_cb handler, void *cb_data) { ilist_item_t *curr, *prev; ilist_iter_t iter; iter.list = list; iter.curr = list->head->prev; while (iter.curr != list->head) { curr = iter.curr; prev = curr->prev; handler(&iter, curr->item, cb_data); iter.curr = prev; } } void ilist_init_iter(ilist_iter_t *iter, ilist_t *list) { iter->list = list; iter->curr = list->head->next; } void ilist_sort(ilist_t *list, ilist_sort_cb cmp) { ilist_item_t *curr, *next; int changed = 1; if (ilist_empty(list)) return; /* An improved bubble sort. */ while (changed) { curr = list->head->next; changed = 0; while (curr->next != list->head) { next = curr->next; if (cmp(curr->item, next->item) > 0) { changed = 1; /* Swap the places of next and curr. */ curr->prev->next = next; next->next->prev = curr; curr->next = next->next; next->prev = curr->prev; curr->prev = next; next->next = curr; } else { curr = curr->next; } } } } void * ilist_remove_first(ilist_t *list) { ilist_item_t *curr; void *item; if (ilist_empty(list)) return NULL; curr = list->head->next; curr->next->prev = curr->prev; curr->prev->next = curr->next; item = curr->item; if (curr->malloced) ilist_mem_free(curr); return item; } void * ilist_remove_last(ilist_t *list) { ilist_item_t *curr; void *item; if (ilist_empty(list)) return NULL; curr = list->head->prev; curr->next->prev = curr->prev; curr->prev->next = curr->next; item = curr->item; if (curr->malloced) ilist_mem_free(curr); return item; } int ilist_remove_item_from_list(ilist_t *list, void *item) { ilist_item_t *curr; curr = list->head->next; while (curr != list->head) { if (curr->item == item) break; curr = curr->next; } if (curr == list->head) return 0; curr->next->prev = curr->prev; curr->prev->next = curr->next; if (curr->malloced) ilist_mem_free(curr); return 1; } typedef struct ilist_twoitem_entry_s { void *cb_data1; void *cb_data2; ilist_item_t entry; } ilist_twoitem_entry_t; static int twoitem_cmp(void *item, void *data) { ilist_twoitem_entry_t *e = item; ilist_twoitem_entry_t *c = data; return ((e->cb_data1 == c->cb_data1) && (e->cb_data2 == c->cb_data2)); } static int find_twoitem(ilist_iter_t *iter, ilist_t *list, void *cb_data1, void *cb_data2) { ilist_twoitem_entry_t *val, tmp = { cb_data1, cb_data2 }; ilist_init_iter(iter, list); ilist_unpositioned(iter); val = ilist_search_iter(iter, twoitem_cmp, &tmp); return (val != NULL); } int ilist_add_twoitem(ilist_t *list, void *cb_data1, void *cb_data2) { ilist_twoitem_entry_t *entry; entry = ilist_mem_alloc(sizeof(*entry)); if (!entry) return 0; entry->cb_data1 = cb_data1; entry->cb_data2 = cb_data2; ilist_add_tail(list, entry, &entry->entry); return 1; } int ilist_remove_twoitem(ilist_t *list, void *cb_data1, void *cb_data2) { ilist_iter_t iter; ilist_twoitem_entry_t *entry; if (! find_twoitem(&iter, list, cb_data1, cb_data2)) return 0; entry = ilist_get(&iter); ilist_delete(&iter); ilist_mem_free(entry); return 1; } int ilist_twoitem_exists(ilist_t *list, void *cb_data1, void *cb_data2) { ilist_iter_t iter; if (! find_twoitem(&iter, list, cb_data1, cb_data2)) return 0; return 1; } typedef struct twoitem_data_s { ilist_twoitem_cb handler; void *data; } twoitem_data_t; static void twoitem_iter(ilist_iter_t *iter, void *item, void *cb_data) { ilist_twoitem_entry_t *entry = item; twoitem_data_t *info = cb_data; info->handler(info->data, entry->cb_data1, entry->cb_data2); } void ilist_iter_twoitem(ilist_t *list, ilist_twoitem_cb handler, void *data) { twoitem_data_t info = { handler, data }; ilist_iter(list, twoitem_iter, &info); } void ilist_twoitem_destroy(ilist_t *list) { ilist_iter_t iter; ilist_twoitem_entry_t *entry; ilist_init_iter(&iter, list); while (ilist_first(&iter)) { entry = ilist_get(&iter); ilist_delete(&iter); ilist_mem_free(entry); } free_ilist(list); } openipmi-2.0.18/utils/ipmi_malloc.c0000644000175000017500000002720410414756162016202 0ustar chuckchuck/* * ipmi_malloc.c * * MontaVista IPMI memory handling code. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002,2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #ifdef HAVE_EXECINFO_H #include /* For backtrace() */ #endif #include #include #include #include void (*ipmi_malloc_log)(enum ipmi_log_type_e log_type, const char *format, ...) #if __GNUC__ > 2 __attribute__ ((__format__ (__printf__, 2, 3))) #endif = NULL; #define DBG_ALIGN 16 #define TB_SIZE 6 #define SIGNATURE 0x82c2e45a #define FREE_SIGNATURE 0xb981cef1 #define BYTE_SIGNATURE 0x74 int __ipmi_debug_malloc = 0; os_handler_t *malloc_os_hnd; struct dbg_malloc_header { unsigned long signature; unsigned long size; /* * The following tb is included even if !HAVE_EXECINFO_H, because * it is used to detect buffer underruns. */ void *tb[TB_SIZE]; }; struct dbg_malloc_trailer { /* * The following tb is included even if !HAVE_EXECINFO_H, because * it is used to detect buffer overruns. */ void *tb[TB_SIZE]; struct dbg_malloc_header *next, *prev; }; static struct dbg_malloc_header *free_queue = NULL; static struct dbg_malloc_header *free_queue_tail = NULL; static int free_queue_len; static int max_free_queue = 100; static struct dbg_malloc_header *alloced = NULL; static struct dbg_malloc_header *alloced_tail = NULL; static size_t dbg_align(size_t size) { if (size & (DBG_ALIGN-1)) size = (size & (~(DBG_ALIGN - 1))) + DBG_ALIGN; return size; } static struct dbg_malloc_trailer * trlr_from_hdr(struct dbg_malloc_header *hdr) { size_t real_size = dbg_align(hdr->size); return (struct dbg_malloc_trailer *) (((char *) hdr) + sizeof(*hdr) + real_size); } static void * ipmi_debug_malloc(size_t size, void **tb) { char *data; struct dbg_malloc_header *hdr; struct dbg_malloc_trailer *trlr; struct dbg_malloc_trailer *trlr2; size_t i; size_t real_size; real_size = dbg_align(size); data = malloc_os_hnd->mem_alloc(real_size + sizeof(struct dbg_malloc_header) + sizeof(struct dbg_malloc_trailer)); if (!data) return NULL; hdr = (struct dbg_malloc_header *) data; trlr = (struct dbg_malloc_trailer *) (data + real_size + sizeof(*hdr)); hdr->signature = SIGNATURE; hdr->size = size; memcpy(hdr->tb, tb, sizeof(hdr->tb)); for (i=0; itb[i] = (void *) SIGNATURE; } data += sizeof(*hdr); for (i=size; inext = NULL; trlr->prev = alloced_tail; if (alloced_tail) { trlr2 = trlr_from_hdr(alloced_tail); trlr2->next = hdr; } else alloced = hdr; alloced_tail = hdr; return data; } static void mem_debug_log(void *data, struct dbg_malloc_header *hdr, struct dbg_malloc_trailer *trlr, void **tb, char *text) { #ifdef HAVE_EXECINFO_H int i; #endif if (!ipmi_malloc_log) return; ipmi_malloc_log(IPMI_LOG_DEBUG_START, "%s", text); if (hdr) { ipmi_malloc_log(IPMI_LOG_DEBUG_CONT, " %ld bytes at %p", hdr->size, data); #ifdef HAVE_EXECINFO_H ipmi_malloc_log(IPMI_LOG_DEBUG_CONT, ", allocated at"); for (i=0; itb[i]; i++) ipmi_malloc_log(IPMI_LOG_DEBUG_CONT, " %p", hdr->tb[i]); #endif } else if (data) { ipmi_malloc_log(IPMI_LOG_DEBUG_CONT, " at %p", data); } #ifdef HAVE_EXECINFO_H if (trlr) { ipmi_malloc_log(IPMI_LOG_DEBUG_CONT, "\n originally freed at"); for (i=0; itb[i]; i++) ipmi_malloc_log(IPMI_LOG_DEBUG_CONT, " %p", trlr->tb[i]); } if (tb) { ipmi_malloc_log(IPMI_LOG_DEBUG_CONT, "\n at"); for (i=0; inext; if (!free_queue) free_queue_tail = NULL; free_queue_len--; data = ((char *) hdr) + sizeof(*hdr); if (hdr->signature != FREE_SIGNATURE) { mem_debug_log(data, hdr, trlr, NULL, "Header overrun"); goto out; } real_size = dbg_align(hdr->size); overwrite = 0; dp = (unsigned long *) data; for (i=0; imem_free(hdr); } static void enqueue_dbg_free(struct dbg_malloc_header *hdr, struct dbg_malloc_trailer *trlr) { while (free_queue_len >= max_free_queue) { dbg_remove_free_queue(); } trlr->next = NULL; if (free_queue_tail) { struct dbg_malloc_trailer *trlr2; trlr2 = trlr_from_hdr(free_queue_tail); trlr2->next = hdr; } else { free_queue = hdr; } free_queue_tail = hdr; free_queue_len++; } static void ipmi_debug_free(void *to_free, void **tb) { struct dbg_malloc_header *hdr; struct dbg_malloc_trailer *trlr; struct dbg_malloc_trailer *trlr2; size_t i; size_t real_size; unsigned long *dp; char *data = to_free; int overwrite; if (to_free == NULL) { mem_debug_log(data, NULL, NULL, tb, "Free called with NULL"); return; } hdr = (struct dbg_malloc_header *) (data - sizeof(*hdr)); if ((hdr->signature != SIGNATURE) && (hdr->signature != FREE_SIGNATURE)) { mem_debug_log(data, NULL, NULL, tb, "Free of invalid data"); return; } trlr = trlr_from_hdr(hdr); if (hdr->signature == FREE_SIGNATURE) { mem_debug_log(data, hdr, trlr, tb, "Double free"); return; } /* Remove it from the alloced list. */ if (trlr->next) { trlr2 = trlr_from_hdr(trlr->next); trlr2->prev = trlr->prev; } else { alloced_tail = trlr->prev; if (alloced_tail) { trlr2 = trlr_from_hdr(alloced_tail); trlr2->next = NULL; } } if (trlr->prev) { trlr2 = trlr_from_hdr(trlr->prev); trlr2->next = trlr->next; } else { alloced = trlr->next; if (alloced) { trlr2 = trlr_from_hdr(alloced); trlr2->prev = NULL; } } real_size = dbg_align(hdr->size); /* Check for writes after the end of data. */ overwrite = 0; for (i=0; itb[i] != ((void *) SIGNATURE)) overwrite = 1; for (i=hdr->size; isignature = FREE_SIGNATURE; #ifdef HAVE_EXECINFO_H memcpy(trlr->tb, tb, sizeof(trlr->tb)); #endif /* Fill the data area with a signature. */ dp = (unsigned long *) (((char *) hdr) + sizeof(*hdr)); for (i=0; i 0) { dbg_remove_free_queue(); } /* Now log everything that was still allocated. */ while (alloced) { trlr = trlr_from_hdr(alloced); mem_debug_log(((char *) alloced) + sizeof(*alloced), alloced, NULL, NULL, "Never freed"); to_free = alloced; alloced = trlr->next; } } } void * ipmi_mem_alloc(int size) { void *rv; unsigned char *c; static int seed; int i; if (DEBUG_MALLOC) { #ifdef HAVE_EXECINFO_H void *tb[TB_SIZE+1]; memset(tb, 0, sizeof(tb)); backtrace(tb, TB_SIZE+1); rv = ipmi_debug_malloc(size, tb+1); #else rv = ipmi_debug_malloc(size, NULL); #endif if (rv) { c = rv; /* Fill it with junk to catch using before initializing. */ for (i=0; imem_alloc(size); } void ipmi_mem_free(void *data) { if (DEBUG_MALLOC) { #ifdef HAVE_EXECINFO_H void *tb[TB_SIZE+1]; memset(tb, 0, sizeof(tb)); backtrace(tb, TB_SIZE+1); ipmi_debug_free(data, tb+1); #else ipmi_debug_free(data, NULL); #endif } else malloc_os_hnd->mem_free(data); } void * ilist_mem_alloc(size_t size) { return ipmi_mem_alloc(size); } void ilist_mem_free(void *data) { ipmi_mem_free(data); } char * ipmi_strdup(const char *str) { char *rv = ipmi_mem_alloc(strlen(str)+1); if (!rv) return NULL; strcpy(rv, str); return rv; } char * ipmi_strndup(const char *str, int n) { int length; char *rv = ipmi_mem_alloc(strlen(str)+1); for (length=0; length * source@mvista.com * * Copyright 2002,2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include struct ipmi_authdata_s { void *info; void *(*mem_alloc)(void *info, int size); void (*mem_free)(void *info, void *data); unsigned char data[16]; }; static int pw_authcode_init(unsigned char *password, ipmi_authdata_t *handle, void *info, void *(*mem_alloc)(void *info, int size), void (*mem_free)(void *info, void *data)) { struct ipmi_authdata_s *data; data = mem_alloc(info, sizeof(*data)); if (!data) return ENOMEM; data->info = info; data->mem_alloc = mem_alloc; data->mem_free = mem_free; memcpy(data->data, password, 16); *handle = data; return 0; } static int pw_authcode_gen(ipmi_authdata_t handle, ipmi_auth_sg_t data[], void *output) { memcpy(output, handle->data, 16); return 0; } static int pw_authcode_check(ipmi_authdata_t handle, ipmi_auth_sg_t data[], void *code) { if (strncmp((char *) handle->data, code, 16) != 0) return EINVAL; return 0; } static void pw_authcode_cleanup(ipmi_authdata_t handle) { memset(handle->data, 0, sizeof(handle->data)); handle->mem_free(handle->info, handle); } static int no_authcode_init(unsigned char *password, ipmi_authdata_t *handle, void *info, void *(*mem_alloc)(void *info, int size), void (*mem_free)(void *info, void *data)) { return 0; } static int no_authcode_gen(ipmi_authdata_t handle, ipmi_auth_sg_t data[], void *output) { memset(output, 0, 16); return 0; } static int no_authcode_check(ipmi_authdata_t handle, ipmi_auth_sg_t data[], void *code) { return 0; } static void no_authcode_cleanup(ipmi_authdata_t handle) { } ipmi_auth_t ipmi_auths[MAX_IPMI_AUTHS] = { { no_authcode_init, no_authcode_gen, no_authcode_check, no_authcode_cleanup }, { ipmi_md2_authcode_init, ipmi_md2_authcode_gen, ipmi_md2_authcode_check, ipmi_md2_authcode_cleanup }, { ipmi_md5_authcode_init, ipmi_md5_authcode_gen, ipmi_md5_authcode_check, ipmi_md5_authcode_cleanup }, { NULL, NULL, NULL, NULL }, { pw_authcode_init, pw_authcode_gen, pw_authcode_check, pw_authcode_cleanup }, { NULL, NULL, NULL, NULL }, }; openipmi-2.0.18/utils/locks.c0000644000175000017500000001226710320111300015002 0ustar chuckchuck/* * locks.c * * Code for abstracting locks in IPMI * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include struct ipmi_lock_s { os_hnd_lock_t *ll_lock; os_handler_t *os_hnd; }; int __ipmi_debug_locks = 0; int ipmi_create_lock_os_hnd(os_handler_t *os_hnd, ipmi_lock_t **new_lock) { ipmi_lock_t *lock; int rv; lock = ipmi_mem_alloc(sizeof(*lock)); if (!lock) return ENOMEM; lock->os_hnd = os_hnd; if (lock->os_hnd && lock->os_hnd->create_lock) { rv = lock->os_hnd->create_lock(lock->os_hnd, &(lock->ll_lock)); if (rv) { ipmi_mem_free(lock); return rv; } } else { lock->ll_lock = NULL; } *new_lock = lock; return 0; } void ipmi_destroy_lock(ipmi_lock_t *lock) { if (lock->ll_lock) lock->os_hnd->destroy_lock(lock->os_hnd, lock->ll_lock); ipmi_mem_free(lock); } void ipmi_lock(ipmi_lock_t *lock) { if (lock->ll_lock) lock->os_hnd->lock(lock->os_hnd, lock->ll_lock); } void ipmi_unlock(ipmi_lock_t *lock) { if (lock->ll_lock) lock->os_hnd->unlock(lock->os_hnd, lock->ll_lock); } struct ipmi_rwlock_s { os_hnd_rwlock_t *ll_lock; os_handler_t *os_hnd; }; int ipmi_create_rwlock_os_hnd(os_handler_t *os_hnd, ipmi_rwlock_t **new_lock) { ipmi_rwlock_t *lock; int rv; lock = ipmi_mem_alloc(sizeof(*lock)); if (!lock) return ENOMEM; lock->os_hnd = os_hnd; if (lock->os_hnd && lock->os_hnd->create_lock) { rv = lock->os_hnd->create_rwlock(lock->os_hnd, &(lock->ll_lock)); if (rv) { ipmi_mem_free(lock); return rv; } } else { lock->ll_lock = NULL; } *new_lock = lock; return 0; } void ipmi_destroy_rwlock(ipmi_rwlock_t *lock) { if (lock->ll_lock) lock->os_hnd->destroy_rwlock(lock->os_hnd, lock->ll_lock); ipmi_mem_free(lock); } void ipmi_rwlock_read_lock(ipmi_rwlock_t *lock) { if (lock->ll_lock) lock->os_hnd->read_lock(lock->os_hnd, lock->ll_lock); } void ipmi_rwlock_read_unlock(ipmi_rwlock_t *lock) { if (lock->ll_lock) lock->os_hnd->read_unlock(lock->os_hnd, lock->ll_lock); } void ipmi_rwlock_write_lock(ipmi_rwlock_t *lock) { if (lock->ll_lock) lock->os_hnd->write_lock(lock->os_hnd, lock->ll_lock); } void ipmi_rwlock_write_unlock(ipmi_rwlock_t *lock) { if (lock->ll_lock) lock->os_hnd->write_unlock(lock->os_hnd, lock->ll_lock); } #ifdef IPMI_CHECK_LOCKS /* Set a breakpoint here to detect locking errors. */ void ipmi_report_lock_error(os_handler_t *handler, char *str) { handler->log(handler, IPMI_LOG_WARNING, "%s", str); } void ipmi_check_lock(ipmi_lock_t *lock, char *str) { if ((!DEBUG_LOCKS) || (!lock) || (!lock->ll_lock)) return; if (! lock->os_hnd->is_locked(lock->os_hnd, lock->ll_lock)) IPMI_REPORT_LOCK_ERROR(lock->os_hnd, str); } #endif openipmi-2.0.18/utils/hash.c0000644000175000017500000000502110320111277014615 0ustar chuckchuck/* hash.c - Hash helper routines * Copyright (C) 2004 MontaVista Software. * Corey Minyard * * This file is part of the IPMI Interface (IPMIIF). * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ /* FIXME - need a better hash value. */ unsigned int ipmi_hash_pointer(void *ptr) { unsigned long val = (unsigned long) ptr; return val >> 5; } openipmi-2.0.18/glib/0000755000175000017500000000000011367555456013334 5ustar chuckchuckopenipmi-2.0.18/glib/glib_os_hnd.c0000644000175000017500000004440611267101063015733 0ustar chuckchuck/* * glib_os_hnd.c * * GLIB OS-handlers for OpenIPMI * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002,2003 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include /* Get the rwlocks for GNU. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_GDBM #include #endif #include #include #include typedef struct g_os_hnd_data_s { gint priority; os_vlog_t log_handler; #ifdef HAVE_GDBM char *gdbm_filename; GDBM_FILE gdbmf; GMutex *gdbm_lock; #endif } g_os_hnd_data_t; struct os_hnd_fd_id_s { guint ev_id; GIOChannel *chan; int fd; void *cb_data; os_data_ready_t data_ready; os_handler_t *handler; os_fd_data_freed_t freed; }; static gboolean fd_handler(GIOChannel *source, GIOCondition condition, gpointer data) { os_hnd_fd_id_t *fd_data = (os_hnd_fd_id_t *) data; void *cb_data; os_data_ready_t handler; int fd; handler = fd_data->data_ready; cb_data = fd_data->cb_data; fd = fd_data->fd; handler(fd, cb_data, fd_data); return TRUE; } static void free_fd_data(gpointer data) { os_hnd_fd_id_t *fd_data = (void *) data; if (fd_data->freed) fd_data->freed(fd_data->fd, fd_data->cb_data); g_free(data); } static int add_fd(os_handler_t *handler, int fd, os_data_ready_t data_ready, void *cb_data, os_fd_data_freed_t freed, os_hnd_fd_id_t **id) { os_hnd_fd_id_t *fd_data; g_os_hnd_data_t *info = handler->internal_data; fd_data = g_malloc(sizeof(*fd_data)); if (!fd_data) return ENOMEM; memset(fd_data, 0, sizeof(*fd_data)); fd_data->chan = g_io_channel_unix_new(fd); if (!fd_data->chan) { g_free(fd_data); return ENOMEM; } fd_data->fd = fd; fd_data->cb_data = cb_data; fd_data->data_ready = data_ready; fd_data->handler = handler; fd_data->freed = freed; fd_data->ev_id = g_io_add_watch_full(fd_data->chan, info->priority, G_IO_IN, fd_handler, fd_data, free_fd_data); *id = fd_data; return 0; } static int remove_fd(os_handler_t *handler, os_hnd_fd_id_t *fd_data) { g_source_remove(fd_data->ev_id); /* fd_data gets freed in the free_fd_data callback registered at set time. */ return 0; } struct os_hnd_timer_id_s { void *cb_data; os_timed_out_t timed_out; int running; os_handler_t *handler; guint ev_id; }; static gboolean timer_handler(gpointer data) { os_hnd_timer_id_t *timer_data = (os_hnd_timer_id_t *) data; /* Make a copy of this, because the handler may delete the timer data. */ void *cb_data; os_timed_out_t timed_out; timed_out = timer_data->timed_out; cb_data = timer_data->cb_data; timer_data->running = 0; timed_out(cb_data, timer_data); return FALSE; } static int start_timer(os_handler_t *handler, os_hnd_timer_id_t *id, struct timeval *timeout, os_timed_out_t timed_out, void *cb_data) { g_os_hnd_data_t *info = handler->internal_data; guint interval; if (id->running) return EBUSY; id->running = 1; id->cb_data = cb_data; id->timed_out = timed_out; interval = (timeout->tv_sec * 1000) | ((timeout->tv_usec + 999) / 1000); id->ev_id = g_timeout_add_full(info->priority, interval, timer_handler, id, NULL); return 0; } static int stop_timer(os_handler_t *handler, os_hnd_timer_id_t *id) { if (!id->running) return EINVAL; id->running = 0; g_source_remove(id->ev_id); return 0; } static int alloc_timer(os_handler_t *handler, os_hnd_timer_id_t **id) { os_hnd_timer_id_t *timer_data; timer_data = g_malloc(sizeof(*timer_data)); if (!timer_data) return ENOMEM; timer_data->running = 0; timer_data->timed_out = NULL; timer_data->handler = handler; *id = timer_data; return 0; } static int free_timer(os_handler_t *handler, os_hnd_timer_id_t *id) { if (id->running) return EBUSY; g_free(id); return 0; } static int get_random(os_handler_t *handler, void *data, unsigned int len) { #if GLIB_MAJOR_VERSION < 2 int fd = open("/dev/urandom", O_RDONLY); int rv = 0; if (fd == -1) return errno; while (len > 0) { rv = read(fd, data, len); if (rv < 0) { rv = errno; goto out; } len -= rv; } rv = 0; out: close(fd); return rv; #else gint32 val; char *out = data; while (len >= sizeof(val)) { val = g_random_int(); memcpy(out, &val, sizeof(val)); len -= sizeof(val); out += sizeof(val); } if (len) { val = g_random_int(); memcpy(out, &val, len); len -= sizeof(val); } return 0; #endif } static GStaticPrivate vlog_private = G_STATIC_PRIVATE_INIT; typedef struct vlog_data_s { int len; int curr; char *data; } vlog_data_t; static void vlog_data_destroy(gpointer data) { vlog_data_t *info = data; if (info->data) g_free(info->data); g_free(info); } static vlog_data_t * get_vlog_data(void) { vlog_data_t *rv; rv = g_static_private_get(&vlog_private); if (!rv) { rv = g_malloc(sizeof(*rv)); if (rv) { memset(rv, 0, sizeof(*rv)); rv->data = g_malloc(1024); if (rv->data) rv->len = 1024; else rv->len = 0; g_static_private_set(&vlog_private, rv, vlog_data_destroy); } } return rv; } static void add_vlog_data(vlog_data_t *info, const char *format, va_list ap) { int len; len = vsnprintf(info->data+info->curr, info->len-info->curr, format, ap); if ((len + info->curr) > info->len) { char *nd; int new_size; new_size = info->len + 64; while (new_size < (len + info->curr)) new_size += 64; nd = g_malloc(new_size); if (!nd) return; if (info->data) { memcpy(nd, info->data, info->curr); g_free(info->data); } info->data = nd; info->len = new_size; len = vsnprintf(info->data+info->curr, info->len-info->curr, format, ap); } info->curr += len; } static void glib_vlog(os_handler_t *handler, enum ipmi_log_type_e log_type, const char *format, va_list ap) { GLogLevelFlags flags; vlog_data_t *info; g_os_hnd_data_t *ginfo = handler->internal_data; os_vlog_t log_handler = ginfo->log_handler; if (log_handler) { log_handler(handler, format, log_type, ap); return; } switch (log_type) { case IPMI_LOG_INFO: flags = G_LOG_LEVEL_INFO; break; case IPMI_LOG_WARNING: flags = G_LOG_LEVEL_WARNING; break; case IPMI_LOG_SEVERE: flags = G_LOG_LEVEL_CRITICAL; break; case IPMI_LOG_FATAL: flags = G_LOG_LEVEL_ERROR; break; case IPMI_LOG_ERR_INFO: flags = G_LOG_LEVEL_MESSAGE; break; case IPMI_LOG_DEBUG: flags = G_LOG_LEVEL_DEBUG; break; case IPMI_LOG_DEBUG_END: info = get_vlog_data(); if (!info) return; add_vlog_data(info, format, ap); g_log("OpenIPMI", G_LOG_LEVEL_DEBUG, "%s", info->data); info->curr = 0; return; case IPMI_LOG_DEBUG_START: info = get_vlog_data(); if (!info) return; info->curr = 0; add_vlog_data(info, format, ap); return; case IPMI_LOG_DEBUG_CONT: info = get_vlog_data(); if (!info) return; add_vlog_data(info, format, ap); return; default: flags = G_LOG_LEVEL_INFO; break; } g_logv("OpenIPMI", flags, format, ap); } static void glib_log(os_handler_t *handler, enum ipmi_log_type_e log_type, const char *format, ...) { va_list ap; va_start(ap, format); glib_vlog(handler, log_type, format, ap); va_end(ap); } struct os_hnd_lock_s { GMutex *mutex; }; static int create_lock(os_handler_t *handler, os_hnd_lock_t **id) { os_hnd_lock_t *lock; lock = g_malloc(sizeof(*lock)); if (!lock) return ENOMEM; lock->mutex = g_mutex_new(); if (!lock->mutex) { g_free(lock); return ENOMEM; } *id = lock; return 0; } static int destroy_lock(os_handler_t *handler, os_hnd_lock_t *id) { g_mutex_free(id->mutex); g_free(id); return 0; } static int lock(os_handler_t *handler, os_hnd_lock_t *id) { g_mutex_lock(id->mutex); return 0; } static int unlock(os_handler_t *handler, os_hnd_lock_t *id) { g_mutex_unlock(id->mutex); return 0; } struct os_hnd_cond_s { GCond *cond; }; static int create_cond(os_handler_t *handler, os_hnd_cond_t **new_cond) { os_hnd_cond_t *cond; cond = g_malloc(sizeof(*cond)); if (!cond) return ENOMEM; cond->cond = g_cond_new(); if (!cond->cond) { g_free(cond); return ENOMEM; } *new_cond = cond; return 0; } static int destroy_cond(os_handler_t *handler, os_hnd_cond_t *cond) { g_cond_free(cond->cond); g_free(cond); return 0; } static int cond_wait(os_handler_t *handler, os_hnd_cond_t *cond, os_hnd_lock_t *lock) { g_cond_wait(cond->cond, lock->mutex); return 0; } static int cond_timedwait(os_handler_t *handler, os_hnd_cond_t *cond, os_hnd_lock_t *lock, struct timeval *rtimeout) { GTimeVal timeout; GTimeVal now; int rv; g_get_current_time(&now); timeout.tv_sec = rtimeout->tv_sec + now.tv_sec; timeout.tv_usec = rtimeout->tv_usec + now.tv_usec; while (timeout.tv_usec > 1000000) { timeout.tv_sec += 1; timeout.tv_usec -= 1000000; } rv = g_cond_timed_wait(cond->cond, lock->mutex, &timeout); if (rv) return ETIMEDOUT; return 0; } static int cond_wake(os_handler_t *handler, os_hnd_cond_t *cond) { g_cond_signal(cond->cond); return 0; } static int cond_broadcast(os_handler_t *handler, os_hnd_cond_t *cond) { g_cond_broadcast(cond->cond); return 0; } #if 0 static int create_thread(os_handler_t *handler, int priority, void (*startup)(void *data), void *data) { GThread *t; t = g_thread_create_full(startup, data, 0, FALSE, FALSE, priority, NULL); if (!t) return ENOMEM; return 0; } static int thread_exit(os_handler_t *handler) { g_thread_exit(NULL); } #endif static gint timeout_callback(gpointer data) { /* We continually run the timer until it is cancelled. */ return TRUE; } static int perform_one_op(os_handler_t *os_hnd, struct timeval *timeout) { /* Note that this is not technically 100% correct in a multi-threaded environment, since another thread may run it, but it is pretty close, I guess. */ int time_ms = (timeout->tv_sec * 1000) + ((timeout->tv_usec+500) / 1000); guint guid = g_timeout_add(time_ms, timeout_callback, NULL); g_main_iteration(TRUE); g_source_remove(guid); return 0; } static void operation_loop(os_handler_t *os_hnd) { for (;;) g_main_iteration(TRUE); } static void free_os_handler(os_handler_t *os_hnd) { g_os_hnd_data_t *info = os_hnd->internal_data; #ifdef HAVE_GDBM g_mutex_free(info->gdbm_lock); if (info->gdbm_filename) free(info->gdbm_filename); if (info->gdbmf) gdbm_close(info->gdbmf); #endif g_free(info); g_free(os_hnd); } static void * glib_malloc(int size) { return g_malloc(size); } static void glib_free(void *data) { g_free(data); } #ifdef HAVE_GDBM #define GDBM_FILE ".OpenIPMI_db" static void init_gdbm(g_os_hnd_data_t *info) { if (!info->gdbm_filename) { char *home = getenv("HOME"); if (!home) return; info->gdbm_filename = malloc(strlen(home)+strlen(GDBM_FILE)+2); if (!info->gdbm_filename) return; strcpy(info->gdbm_filename, home); strcat(info->gdbm_filename, "/"); strcat(info->gdbm_filename, GDBM_FILE); } info->gdbmf = gdbm_open(info->gdbm_filename, 512, GDBM_WRCREAT, 0600, NULL); /* gdbmf will be NULL on error, which is what reports an error. */ } static int database_store(os_handler_t *handler, char *key, unsigned char *data, unsigned int data_len) { g_os_hnd_data_t *info = handler->internal_data; datum gkey, gdata; int rv; g_mutex_lock(info->gdbm_lock); if (!info->gdbmf) { init_gdbm(info); if (!info->gdbmf) { g_mutex_unlock(info->gdbm_lock); return EINVAL; } } gkey.dptr = key; gkey.dsize = strlen(key); gdata.dptr = (char *) data; gdata.dsize = data_len; rv = gdbm_store(info->gdbmf, gkey, gdata, GDBM_REPLACE); g_mutex_unlock(info->gdbm_lock); if (rv) return EINVAL; return 0; } static int database_find(os_handler_t *handler, char *key, unsigned int *fetch_completed, unsigned char **data, unsigned int *data_len, void (*got_data)(void *cb_data, int err, unsigned char *data, unsigned int data_len), void *cb_data) { g_os_hnd_data_t *info = handler->internal_data; datum gkey, gdata; g_mutex_lock(info->gdbm_lock); if (!info->gdbmf) { init_gdbm(info); if (!info->gdbmf) { g_mutex_unlock(info->gdbm_lock); return EINVAL; } } gkey.dptr = key; gkey.dsize = strlen(key); gdata = gdbm_fetch(info->gdbmf, gkey); g_mutex_unlock(info->gdbm_lock); if (!gdata.dptr) return EINVAL; *data = (unsigned char *) gdata.dptr; *data_len = gdata.dsize; *fetch_completed = 1; return 0; } static void database_free(os_handler_t *handler, unsigned char *data) { free(data); } static int set_gdbm_filename(os_handler_t *os_hnd, char *name) { g_os_hnd_data_t *info = os_hnd->internal_data; char *nname; nname = strdup(name); if (!nname) return ENOMEM; if (info->gdbm_filename) free(info->gdbm_filename); info->gdbm_filename = nname; return 0; } #endif static void sset_log_handler(os_handler_t *handler, os_vlog_t log_handler) { g_os_hnd_data_t *info = handler->internal_data; info->log_handler = log_handler; } static os_handler_t ipmi_glib_os_handler = { .mem_alloc = glib_malloc, .mem_free = glib_free, .add_fd_to_wait_for = add_fd, .remove_fd_to_wait_for = remove_fd, .start_timer = start_timer, .stop_timer = stop_timer, .alloc_timer = alloc_timer, .free_timer = free_timer, .get_random = get_random, .log = glib_log, .vlog = glib_vlog, .create_lock = create_lock, .destroy_lock = destroy_lock, .lock = lock, .unlock = unlock, .create_cond = create_cond, .destroy_cond = destroy_cond, .cond_wait = cond_wait, .cond_timedwait = cond_timedwait, .cond_wake = cond_wake, .cond_broadcast = cond_broadcast, #if 0 .create_thread = create_thread, .thread_exit = thread_exit, #endif .free_os_handler = free_os_handler, .perform_one_op = perform_one_op, .operation_loop = operation_loop, #ifdef HAVE_GDBM .database_store = database_store, .database_find = database_find, .database_free = database_free, .database_set_filename = set_gdbm_filename, #endif .set_log_handler = sset_log_handler, }; os_handler_t * ipmi_glib_get_os_handler(int priority) { os_handler_t *rv; g_os_hnd_data_t *info; if (!g_thread_supported ()) g_thread_init(NULL); rv = g_malloc(sizeof(*rv)); if (!rv) return NULL; memcpy(rv, &ipmi_glib_os_handler, sizeof(*rv)); info = g_malloc(sizeof(*info)); if (! info) { g_free(rv); return NULL; } memset(info, 0, sizeof(*info)); #ifdef HAVE_GDBM info->gdbm_lock = g_mutex_new(); if (!info->gdbm_lock) { free(info); free(rv); return NULL; } #endif info->priority = priority; rv->internal_data = info; return rv; } static void (*log_hndlr)(const char *domain, const char *pfx, const char *msg); static void glib_handle_log(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) { void (*hndlr)(const char *domain, const char *pfx, const char *msg); char *pfx = ""; if (log_level & G_LOG_LEVEL_ERROR) pfx = "FATL"; else if (log_level & G_LOG_LEVEL_CRITICAL) pfx = "SEVR"; else if (log_level & G_LOG_LEVEL_WARNING) pfx = "WARN"; else if (log_level & G_LOG_LEVEL_MESSAGE) pfx = "EINF"; else if (log_level & G_LOG_LEVEL_INFO) pfx = "INFO"; else if (log_level & G_LOG_LEVEL_DEBUG) pfx = "DEBG"; hndlr = log_hndlr; if (hndlr) hndlr(log_domain, pfx, message); } void ipmi_glib_set_log_handler(void (*hndlr)(const char *domain, const char *pfx, const char *msg)) { log_hndlr = hndlr; g_log_set_handler("OpenIPMI", G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG | G_LOG_FLAG_FATAL, glib_handle_log, NULL); } openipmi-2.0.18/glib/Makefile.am0000644000175000017500000000216010705151263015346 0ustar chuckchuck empty:= space:= $(empty) $(empty) LIB_VERSION = 0.0.1 SPACE_VERSION = $(subst .,$(space),$(LIB_VERSION)) VERSION_CURRENT = $(wordlist 1, 1, $(SPACE_VERSION)) VERSION_REVISION = $(wordlist 3, 3, $(SPACE_VERSION)) VERSION_AGE = $(wordlist 2, 2, $(SPACE_VERSION)) LD_VERSION = $(VERSION_CURRENT):$(VERSION_REVISION):$(VERSION_AGE) AM_CFLAGS = -Wall -Wsign-compare -I$(top_srcdir)/include lib_LTLIBRARIES = @GLIB_TARGET@ @GLIB12_TARGET@ EXTRA_LTLIBRARIES = libOpenIPMIglib.la libOpenIPMIglib12.la libOpenIPMIglib_la_SOURCES = glib_os_hnd.c libOpenIPMIglib_la_CFLAGS = $(GLIB_CFLAGS) $(AM_CFLAGS) libOpenIPMIglib_la_LIBADD = $(GDBM_LIB) libOpenIPMIglib_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ -rpath $(libdir) \ -Wl,-Map -Wl,libOpenIPMIglib.map $(GLIB_LIBS) libOpenIPMIglib12_la_SOURCES = glib_os_hnd.c libOpenIPMIglib12_la_CFLAGS = $(GLIB12_CFLAGS) $(AM_CFLAGS) libOpenIPMIglib12_la_LIBADD = $(GDBM_LIB) libOpenIPMIglib12_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ -rpath $(libdir) \ -Wl,-Map -Wl,libOpenIPMIglib12.map $(GLIB12_LIBS) CLEANFILES = libOpenIPMIglib.map libOpenIPMIglib12.map glib12_os_hnd.c openipmi-2.0.18/glib/Makefile.in0000644000175000017500000004763011367554425015406 0ustar chuckchuck# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = glib DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libOpenIPMIglib_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libOpenIPMIglib_la_OBJECTS = libOpenIPMIglib_la-glib_os_hnd.lo libOpenIPMIglib_la_OBJECTS = $(am_libOpenIPMIglib_la_OBJECTS) libOpenIPMIglib12_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libOpenIPMIglib12_la_OBJECTS = libOpenIPMIglib12_la-glib_os_hnd.lo libOpenIPMIglib12_la_OBJECTS = $(am_libOpenIPMIglib12_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libOpenIPMIglib_la_SOURCES) \ $(libOpenIPMIglib12_la_SOURCES) DIST_SOURCES = $(libOpenIPMIglib_la_SOURCES) \ $(libOpenIPMIglib12_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BIBTEX = @BIBTEX@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIA = @DIA@ DIA_FILTER_NAME = @DIA_FILTER_NAME@ DSYMUTIL = @DSYMUTIL@ DVIPDF = @DVIPDF@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GDBM_LIB = @GDBM_LIB@ GLIB12_CFLAGS = @GLIB12_CFLAGS@ GLIB12_LIB = @GLIB12_LIB@ GLIB12_LIBS = @GLIB12_LIBS@ GLIB12_PKGCONF = @GLIB12_PKGCONF@ GLIB12_SO = @GLIB12_SO@ GLIB12_TARGET = @GLIB12_TARGET@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_DIR = @GLIB_DIR@ GLIB_LIB = @GLIB_LIB@ GLIB_LIBS = @GLIB_LIBS@ GLIB_PKGCONF = @GLIB_PKGCONF@ GLIB_SINGLE_LIB = @GLIB_SINGLE_LIB@ GLIB_SINGLE_SO = @GLIB_SINGLE_SO@ GLIB_SO = @GLIB_SO@ GLIB_TARGET = @GLIB_TARGET@ GLIB_VERSION = @GLIB_VERSION@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NMEDIT = @NMEDIT@ OBJEXT = @OBJEXT@ OPENIPMI_SMI = @OPENIPMI_SMI@ OPENIPMI_SWIG_LIBS = @OPENIPMI_SWIG_LIBS@ OPENIPMI_SWIG_SO = @OPENIPMI_SWIG_SO@ OPENIPMI_VERSION_EXTRA = @OPENIPMI_VERSION_EXTRA@ OPENIPMI_VERSION_MAJOR = @OPENIPMI_VERSION_MAJOR@ OPENIPMI_VERSION_MINOR = @OPENIPMI_VERSION_MINOR@ OPENIPMI_VERSION_RELEASE = @OPENIPMI_VERSION_RELEASE@ OPENSSLINCS = @OPENSSLINCS@ OPENSSLLIBS = @OPENSSLLIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_DIR = @PERL_DIR@ PERL_HAS_POSIX_THREADS = @PERL_HAS_POSIX_THREADS@ PERL_INSTALL_DIR = @PERL_INSTALL_DIR@ PERL_POSIX_LIB = @PERL_POSIX_LIB@ PERL_POSIX_SO = @PERL_POSIX_SO@ POPTLIBS = @POPTLIBS@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_DIR = @PYTHON_DIR@ PYTHON_GUI_DIR = @PYTHON_GUI_DIR@ PYTHON_HAS_POSIX_THREADS = @PYTHON_HAS_POSIX_THREADS@ PYTHON_INSTALL_DIR = @PYTHON_INSTALL_DIR@ PYTHON_INSTALL_LIB_DIR = @PYTHON_INSTALL_LIB_DIR@ PYTHON_POSIX_LIB = @PYTHON_POSIX_LIB@ PYTHON_POSIX_SO = @PYTHON_POSIX_SO@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNMPLIBS = @SNMPLIBS@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_DIR = @SWIG_DIR@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_DIR = @TCL_DIR@ TCL_LIB = @TCL_LIB@ TCL_LIBS = @TCL_LIBS@ TCL_PKGCONF = @TCL_PKGCONF@ TCL_SO = @TCL_SO@ TCL_TARGET = @TCL_TARGET@ TERM_LIBS = @TERM_LIBS@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ diaprog = @diaprog@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ glibprog = @glibprog@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlprog = @perlprog@ pkgprog = @pkgprog@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pythonprog = @pythonprog@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ swigprog = @swigprog@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ empty := space := $(empty) $(empty) LIB_VERSION = 0.0.1 SPACE_VERSION = $(subst .,$(space),$(LIB_VERSION)) VERSION_CURRENT = $(wordlist 1, 1, $(SPACE_VERSION)) VERSION_REVISION = $(wordlist 3, 3, $(SPACE_VERSION)) VERSION_AGE = $(wordlist 2, 2, $(SPACE_VERSION)) LD_VERSION = $(VERSION_CURRENT):$(VERSION_REVISION):$(VERSION_AGE) AM_CFLAGS = -Wall -Wsign-compare -I$(top_srcdir)/include lib_LTLIBRARIES = @GLIB_TARGET@ @GLIB12_TARGET@ EXTRA_LTLIBRARIES = libOpenIPMIglib.la libOpenIPMIglib12.la libOpenIPMIglib_la_SOURCES = glib_os_hnd.c libOpenIPMIglib_la_CFLAGS = $(GLIB_CFLAGS) $(AM_CFLAGS) libOpenIPMIglib_la_LIBADD = $(GDBM_LIB) libOpenIPMIglib_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ -rpath $(libdir) \ -Wl,-Map -Wl,libOpenIPMIglib.map $(GLIB_LIBS) libOpenIPMIglib12_la_SOURCES = glib_os_hnd.c libOpenIPMIglib12_la_CFLAGS = $(GLIB12_CFLAGS) $(AM_CFLAGS) libOpenIPMIglib12_la_LIBADD = $(GDBM_LIB) libOpenIPMIglib12_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ -rpath $(libdir) \ -Wl,-Map -Wl,libOpenIPMIglib12.map $(GLIB12_LIBS) CLEANFILES = libOpenIPMIglib.map libOpenIPMIglib12.map glib12_os_hnd.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu glib/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu glib/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libOpenIPMIglib.la: $(libOpenIPMIglib_la_OBJECTS) $(libOpenIPMIglib_la_DEPENDENCIES) $(LINK) $(libOpenIPMIglib_la_LDFLAGS) $(libOpenIPMIglib_la_OBJECTS) $(libOpenIPMIglib_la_LIBADD) $(LIBS) libOpenIPMIglib12.la: $(libOpenIPMIglib12_la_OBJECTS) $(libOpenIPMIglib12_la_DEPENDENCIES) $(LINK) $(libOpenIPMIglib12_la_LDFLAGS) $(libOpenIPMIglib12_la_OBJECTS) $(libOpenIPMIglib12_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libOpenIPMIglib12_la-glib_os_hnd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libOpenIPMIglib_la-glib_os_hnd.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libOpenIPMIglib_la-glib_os_hnd.lo: glib_os_hnd.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libOpenIPMIglib_la_CFLAGS) $(CFLAGS) -MT libOpenIPMIglib_la-glib_os_hnd.lo -MD -MP -MF "$(DEPDIR)/libOpenIPMIglib_la-glib_os_hnd.Tpo" -c -o libOpenIPMIglib_la-glib_os_hnd.lo `test -f 'glib_os_hnd.c' || echo '$(srcdir)/'`glib_os_hnd.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libOpenIPMIglib_la-glib_os_hnd.Tpo" "$(DEPDIR)/libOpenIPMIglib_la-glib_os_hnd.Plo"; else rm -f "$(DEPDIR)/libOpenIPMIglib_la-glib_os_hnd.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glib_os_hnd.c' object='libOpenIPMIglib_la-glib_os_hnd.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libOpenIPMIglib_la_CFLAGS) $(CFLAGS) -c -o libOpenIPMIglib_la-glib_os_hnd.lo `test -f 'glib_os_hnd.c' || echo '$(srcdir)/'`glib_os_hnd.c libOpenIPMIglib12_la-glib_os_hnd.lo: glib_os_hnd.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libOpenIPMIglib12_la_CFLAGS) $(CFLAGS) -MT libOpenIPMIglib12_la-glib_os_hnd.lo -MD -MP -MF "$(DEPDIR)/libOpenIPMIglib12_la-glib_os_hnd.Tpo" -c -o libOpenIPMIglib12_la-glib_os_hnd.lo `test -f 'glib_os_hnd.c' || echo '$(srcdir)/'`glib_os_hnd.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libOpenIPMIglib12_la-glib_os_hnd.Tpo" "$(DEPDIR)/libOpenIPMIglib12_la-glib_os_hnd.Plo"; else rm -f "$(DEPDIR)/libOpenIPMIglib12_la-glib_os_hnd.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glib_os_hnd.c' object='libOpenIPMIglib12_la-glib_os_hnd.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libOpenIPMIglib12_la_CFLAGS) $(CFLAGS) -c -o libOpenIPMIglib12_la-glib_os_hnd.lo `test -f 'glib_os_hnd.c' || echo '$(srcdir)/'`glib_os_hnd.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am \ install-libLTLIBRARIES install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am \ uninstall-libLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: openipmi-2.0.18/NEWS0000644000175000017500000000000007557774677013122 0ustar chuckchuckopenipmi-2.0.18/aclocal.m40000644000175000017500000101563611367554421014262 0ustar chuckchuck# generated automatically by aclocal 1.9.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # serial 52 Debian 1.5.26-4+lenny1 AC_PROG_LIBTOOL # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) # ----------------------------------------------------------- # If this macro is not defined by Autoconf, define it here. m4_ifdef([AC_PROVIDE_IFELSE], [], [m4_define([AC_PROVIDE_IFELSE], [m4_ifdef([AC_PROVIDE_$1], [$2], [$3])])]) # AC_PROG_LIBTOOL # --------------- AC_DEFUN([AC_PROG_LIBTOOL], [AC_REQUIRE([_AC_PROG_LIBTOOL])dnl dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. AC_PROVIDE_IFELSE([AC_PROG_CXX], [AC_LIBTOOL_CXX], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX ])]) dnl And a similar setup for Fortran 77 support AC_PROVIDE_IFELSE([AC_PROG_F77], [AC_LIBTOOL_F77], [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 ])]) dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [ifdef([AC_PROG_GCJ], [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) ifdef([A][M_PROG_GCJ], [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) ifdef([LT_AC_PROG_GCJ], [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) ])])# AC_PROG_LIBTOOL # _AC_PROG_LIBTOOL # ---------------- AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) ])# _AC_PROG_LIBTOOL # AC_LIBTOOL_SETUP # ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], [AC_PREREQ(2.50)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! AC_REQUIRE([AC_OBJEXT])dnl AC_REQUIRE([AC_EXEEXT])dnl dnl AC_LIBTOOL_SYS_MAX_CMD_LEN AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE AC_LIBTOOL_OBJDIR AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. [double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" AC_CHECK_TOOL(AR, ar, false) AC_CHECK_TOOL(RANLIB, ranlib, :) AC_CHECK_TOOL(STRIP, strip, :) old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then AC_PATH_MAGIC fi ;; esac _LT_REQUIRED_DARWIN_CHECKS AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) AC_ARG_ENABLE([libtool-lock], [AC_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes AC_ARG_WITH([pic], [AC_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= AC_LIBTOOL_LANG_C_CONFIG _LT_AC_TAGCONFIG ])# AC_LIBTOOL_SETUP # _LT_AC_SYS_COMPILER # ------------------- AC_DEFUN([_LT_AC_SYS_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_AC_SYS_COMPILER # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. AC_DEFUN([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` ]) # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. AC_DEFUN([_LT_COMPILER_BOILERPLATE], [AC_REQUIRE([LT_AC_PROG_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. AC_DEFUN([_LT_LINKER_BOILERPLATE], [AC_REQUIRE([LT_AC_PROG_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # -------------------------- # Check for some things on darwin AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. echo "int foo(void){return 1;}" > conftest.c $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib ${wl}-single_module conftest.c if test -f libconftest.dylib; then lt_cv_apple_cc_single_mod=yes rm -rf libconftest.dylib* fi rm conftest.c fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) case $host_os in rhapsody* | darwin1.[[0123]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}" fi if test "$DSYMUTIL" != ":"; then _lt_dsymutil="~$DSYMUTIL \$lib || :" else _lt_dsymutil= fi ;; esac ]) # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], [AC_REQUIRE([LT_AC_PROG_SED])dnl 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_AC_SYS_LIBPATH_AIX # _LT_AC_SHELL_INIT(ARG) # ---------------------- AC_DEFUN([_LT_AC_SHELL_INIT], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], [AC_DIVERT_PUSH(NOTICE)]) $1 AC_DIVERT_POP ])# _LT_AC_SHELL_INIT # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], [_LT_AC_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` ;; esac echo=${ECHO-echo} if test "X[$]1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} fi if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$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 && echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL [$]0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL [$]0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "[$]0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" fi AC_SUBST(ECHO) ])])# _LT_AC_PROG_ECHO_BACKSLASH # _LT_AC_LOCK # ----------- AC_DEFUN([_LT_AC_LOCK], [AC_ARG_ENABLE([libtool-lock], [AC_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw* | *-*-pw32*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; ]) esac need_locks="$enable_libtool_lock" ])# _LT_AC_LOCK # AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [AC_REQUIRE([LT_AC_PROG_SED]) AC_CACHE_CHECK([$1], [$2], [$2=no ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $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 fi fi $rm conftest* ]) if test x"[$]$2" = xyes; then ifelse([$5], , :, [$5]) else ifelse([$6], , :, [$6]) fi ])# AC_LIBTOOL_COMPILER_OPTION # AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ------------------------------------------------------------ # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" 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>&AS_MESSAGE_LOG_FD $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 fi else $2=yes fi fi $rm -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then ifelse([$4], , :, [$4]) else ifelse([$5], , :, [$5]) fi ])# AC_LIBTOOL_LINKER_OPTION # AC_LIBTOOL_SYS_MAX_CMD_LEN # -------------------------- AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [# find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi ])# AC_LIBTOOL_SYS_MAX_CMD_LEN # _LT_AC_CHECK_DLFCN # ------------------ AC_DEFUN([_LT_AC_CHECK_DLFCN], [AC_CHECK_HEADERS(dlfcn.h)dnl ])# _LT_AC_CHECK_DLFCN # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # --------------------------------------------------------------------- AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); }] EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_AC_TRY_DLOPEN_SELF # AC_LIBTOOL_DLOPEN_SELF # ---------------------- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_AC_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_AC_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi ])# AC_LIBTOOL_DLOPEN_SELF # AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) # --------------------------------- # Check to see if options -c and -o are simultaneously supported by compiler AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $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_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* ]) ])# AC_LIBTOOL_PROG_CC_C_O # AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) # ----------------------------------------- # Check to see if we can do hard links to lock some files if needed AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_REQUIRE([_LT_AC_LOCK])dnl hard_links="nottested" if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi ])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS # AC_LIBTOOL_OBJDIR # ----------------- AC_DEFUN([AC_LIBTOOL_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir ])# AC_LIBTOOL_OBJDIR # AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) # ---------------------------------------------- # Check hardcoding attributes. AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_AC_TAGVAR(hardcode_action, $1)= if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existant directories. if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_AC_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_AC_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_AC_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi ])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH # AC_LIBTOOL_SYS_LIB_STRIP # ------------------------ AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], [striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi ])# AC_LIBTOOL_SYS_LIB_STRIP # AC_LIBTOOL_SYS_DYNAMIC_LINKER # ----------------------------- # PORTME Fill in your ld.so characteristics AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" m4_if($1,[],[ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac 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 -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= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ 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 ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`echo $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # 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;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec], [lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"]) sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec], [lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"]) sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi ])# AC_LIBTOOL_SYS_DYNAMIC_LINKER # _LT_AC_TAGCONFIG # ---------------- AC_DEFUN([_LT_AC_TAGCONFIG], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_ARG_WITH([tags], [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], [include additional configurations @<:@automatic@:>@])], [tagnames="$withval"]) if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then AC_MSG_WARN([output file `$ofile' does not exist]) fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) else AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) fi fi if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in "") ;; *) AC_MSG_ERROR([invalid tag name: $tagname]) ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then AC_MSG_ERROR([tag name \"$tagname\" already exists]) fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_LIBTOOL_LANG_CXX_CONFIG else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then AC_LIBTOOL_LANG_F77_CONFIG else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then AC_LIBTOOL_LANG_GCJ_CONFIG else tagname="" fi ;; RC) AC_LIBTOOL_LANG_RC_CONFIG ;; *) AC_MSG_ERROR([Unsupported tag name: $tagname]) ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" AC_MSG_ERROR([unable to update list of available tagged configurations.]) fi fi ])# _LT_AC_TAGCONFIG # AC_LIBTOOL_DLOPEN # ----------------- # enable checks for dlopen support AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) ])# AC_LIBTOOL_DLOPEN # AC_LIBTOOL_WIN32_DLL # -------------------- # declare package support for building win32 DLLs AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) ])# AC_LIBTOOL_WIN32_DLL # AC_ENABLE_SHARED([DEFAULT]) # --------------------------- # implement the --enable-shared flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_SHARED], [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([shared], [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]AC_ENABLE_SHARED_DEFAULT) ])# AC_ENABLE_SHARED # AC_DISABLE_SHARED # ----------------- # set the default shared flag to --disable-shared AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no) ])# AC_DISABLE_SHARED # AC_ENABLE_STATIC([DEFAULT]) # --------------------------- # implement the --enable-static flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_STATIC], [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([static], [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]AC_ENABLE_STATIC_DEFAULT) ])# AC_ENABLE_STATIC # AC_DISABLE_STATIC # ----------------- # set the default static flag to --disable-static AC_DEFUN([AC_DISABLE_STATIC], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no) ])# AC_DISABLE_STATIC # AC_ENABLE_FAST_INSTALL([DEFAULT]) # --------------------------------- # implement the --enable-fast-install flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_FAST_INSTALL], [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([fast-install], [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) ])# AC_ENABLE_FAST_INSTALL # AC_DISABLE_FAST_INSTALL # ----------------------- # set the default to --disable-fast-install AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no) ])# AC_DISABLE_FAST_INSTALL # AC_LIBTOOL_PICMODE([MODE]) # -------------------------- # implement the --with-pic flag # MODE is either `yes' or `no'. If omitted, it defaults to `both'. AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl pic_mode=ifelse($#,1,$1,default) ])# AC_LIBTOOL_PICMODE # AC_PROG_EGREP # ------------- # This is predefined starting with Autoconf 2.54, so this conditional # definition can be removed once we require Autoconf 2.54 or later. m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi]) EGREP=$ac_cv_prog_egrep AC_SUBST([EGREP]) ])]) # AC_PATH_TOOL_PREFIX # ------------------- # find a file program which can recognize shared library AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="ifelse([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi ])# AC_PATH_TOOL_PREFIX # AC_PATH_MAGIC # ------------- # find a file program which can recognize a shared library AC_DEFUN([AC_PATH_MAGIC], [AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# AC_PATH_MAGIC # AC_PROG_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([AC_PROG_LD], [AC_ARG_WITH([gnu-ld], [AC_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no]) AC_REQUIRE([LT_AC_PROG_SED])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown ])# AC_DEPLIBS_CHECK_METHOD # AC_PROG_NM # ---------- # find the pathname to a BSD-compatible name lister AC_DEFUN([AC_PROG_NM], [AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi]) NM="$lt_cv_path_NM" ])# AC_PROG_NM # AC_CHECK_LIBM # ------------- # check for math library AC_DEFUN([AC_CHECK_LIBM], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac ])# AC_CHECK_LIBM # AC_LIBLTDL_CONVENIENCE([DIRECTORY]) # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl convenience library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-convenience to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, # it is assumed to be `libltdl'. LIBLTDL will be prefixed with # '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' # (note the single quotes!). If your package is not flat and you're not # using automake, define top_builddir and top_srcdir appropriately in # the Makefiles. AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case $enable_ltdl_convenience in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" ])# AC_LIBLTDL_CONVENIENCE # AC_LIBLTDL_INSTALLABLE([DIRECTORY]) # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl installable library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-install to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, # and an installed libltdl is not found, it is assumed to be `libltdl'. # LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with # '${top_srcdir}/' (note the single quotes!). If your package is not # flat and you're not using automake, define top_builddir and top_srcdir # appropriately in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, lt_dlinit, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" LTDLINCL= fi # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" ])# AC_LIBLTDL_INSTALLABLE # AC_LIBTOOL_CXX # -------------- # enable support for C++ libraries AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_LT_AC_LANG_CXX]) ])# AC_LIBTOOL_CXX # _LT_AC_LANG_CXX # --------------- AC_DEFUN([_LT_AC_LANG_CXX], [AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([_LT_AC_PROG_CXXCPP]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) ])# _LT_AC_LANG_CXX # _LT_AC_PROG_CXXCPP # ------------------ AC_DEFUN([_LT_AC_PROG_CXXCPP], [ AC_REQUIRE([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 AC_PROG_CXXCPP fi ])# _LT_AC_PROG_CXXCPP # AC_LIBTOOL_F77 # -------------- # enable support for Fortran 77 libraries AC_DEFUN([AC_LIBTOOL_F77], [AC_REQUIRE([_LT_AC_LANG_F77]) ])# AC_LIBTOOL_F77 # _LT_AC_LANG_F77 # --------------- AC_DEFUN([_LT_AC_LANG_F77], [AC_REQUIRE([AC_PROG_F77]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) ])# _LT_AC_LANG_F77 # AC_LIBTOOL_GCJ # -------------- # enable support for GCJ libraries AC_DEFUN([AC_LIBTOOL_GCJ], [AC_REQUIRE([_LT_AC_LANG_GCJ]) ])# AC_LIBTOOL_GCJ # _LT_AC_LANG_GCJ # --------------- AC_DEFUN([_LT_AC_LANG_GCJ], [AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) ])# _LT_AC_LANG_GCJ # AC_LIBTOOL_RC # ------------- # enable support for Windows resource files AC_DEFUN([AC_LIBTOOL_RC], [AC_REQUIRE([LT_AC_PROG_RC]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) ])# AC_LIBTOOL_RC # AC_LIBTOOL_LANG_C_CONFIG # ------------------------ # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) AC_DEFUN([_LT_AC_LANG_C_CONFIG], [lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_AC_SYS_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_SYS_LIB_STRIP AC_LIBTOOL_DLOPEN_SELF # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) AC_LIBTOOL_CONFIG($1) AC_LANG_POP CC="$lt_save_CC" ])# AC_LIBTOOL_LANG_C_CONFIG # AC_LIBTOOL_LANG_CXX_CONFIG # -------------------------- # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], [AC_LANG_PUSH(C++) AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([_LT_AC_PROG_CXXCPP]) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_AC_TAGVAR(no_undefined_flag, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Dependencies to place before and after the object being linked: _LT_AC_TAGVAR(predep_objects, $1)= _LT_AC_TAGVAR(postdep_objects, $1)= _LT_AC_TAGVAR(predeps, $1)= _LT_AC_TAGVAR(postdeps, $1)= _LT_AC_TAGVAR(compiler_lib_search_path, $1)= _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)= # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration AC_PROG_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_AC_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_AC_TAGVAR(archive_cmds, $1)='' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_AC_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_AC_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' fi fi ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--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_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; darwin* | rhapsody*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" if test "$GXX" = yes ; then output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_AC_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}" _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi else case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before switch to ELF _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_AC_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; hpux9*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_AC_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_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${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 # necessary to make sure instantiated templates are included # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_AC_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' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_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++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_AC_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_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_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' # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. 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 # necessary to make sure instantiated templates are included # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; openbsd2*) # C++ shared libraries are fairly broken _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd='echo' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; osf3*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $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~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes 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 # necessary to make sure instantiated templates are included # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_AC_TAGVAR(GCC, $1)="$GXX" _LT_AC_TAGVAR(LD, $1)="$LD" AC_LIBTOOL_POSTDEP_PREDEP($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_CONFIG($1) AC_LANG_POP CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld ])# AC_LIBTOOL_LANG_CXX_CONFIG # AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) # ------------------------------------ # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP], [AC_REQUIRE([LT_AC_PROG_SED])dnl dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_AC_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac ])# AC_LIBTOOL_POSTDEP_PREDEP # AC_LIBTOOL_LANG_F77_CONFIG # -------------------------- # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)]) AC_DEFUN([_LT_AC_LANG_F77_CONFIG], [AC_REQUIRE([AC_PROG_F77]) AC_LANG_PUSH(Fortran 77) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_AC_TAGVAR(no_undefined_flag, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_AC_TAGVAR(GCC, $1)="$G77" _LT_AC_TAGVAR(LD, $1)="$LD" AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_CONFIG($1) AC_LANG_POP CC="$lt_save_CC" ])# AC_LIBTOOL_LANG_F77_CONFIG # AC_LIBTOOL_LANG_GCJ_CONFIG # -------------------------- # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], [AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_CONFIG($1) AC_LANG_RESTORE CC="$lt_save_CC" ])# AC_LIBTOOL_LANG_GCJ_CONFIG # AC_LIBTOOL_LANG_RC_CONFIG # ------------------------- # Ensure that the configuration vars for the Windows resource compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) AC_DEFUN([_LT_AC_LANG_RC_CONFIG], [AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) AC_LANG_RESTORE CC="$lt_save_CC" ])# AC_LIBTOOL_LANG_RC_CONFIG # AC_LIBTOOL_CONFIG([TAGNAME]) # ---------------------------- # If TAGNAME is not passed, then create an initial libtool script # with a default configuration from the untagged config vars. Otherwise # add code to config.status for appending the configuration named by # TAGNAME from the matching tagged config vars. AC_DEFUN([AC_LIBTOOL_CONFIG], [# The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ _LT_AC_TAGVAR(compiler, $1) \ _LT_AC_TAGVAR(CC, $1) \ _LT_AC_TAGVAR(LD, $1) \ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ _LT_AC_TAGVAR(old_archive_cmds, $1) \ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ _LT_AC_TAGVAR(predep_objects, $1) \ _LT_AC_TAGVAR(postdep_objects, $1) \ _LT_AC_TAGVAR(predeps, $1) \ _LT_AC_TAGVAR(postdeps, $1) \ _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \ _LT_AC_TAGVAR(archive_cmds, $1) \ _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ _LT_AC_TAGVAR(postinstall_cmds, $1) \ _LT_AC_TAGVAR(postuninstall_cmds, $1) \ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ _LT_AC_TAGVAR(allow_undefined_flag, $1) \ _LT_AC_TAGVAR(no_undefined_flag, $1) \ _LT_AC_TAGVAR(export_symbols_cmds, $1) \ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ _LT_AC_TAGVAR(hardcode_automatic, $1) \ _LT_AC_TAGVAR(module_cmds, $1) \ _LT_AC_TAGVAR(module_expsym_cmds, $1) \ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ _LT_AC_TAGVAR(fix_srcfile_path, $1) \ _LT_AC_TAGVAR(exclude_expsyms, $1) \ _LT_AC_TAGVAR(include_expsyms, $1); do case $var in _LT_AC_TAGVAR(old_archive_cmds, $1) | \ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ _LT_AC_TAGVAR(archive_cmds, $1) | \ _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ _LT_AC_TAGVAR(module_cmds, $1) | \ _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\[$]0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` ;; esac ifelse([$1], [], [cfgfile="${ofile}T" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 $rm -f "$cfgfile" AC_MSG_NOTICE([creating $ofile])], [cfgfile="$ofile"]) cat <<__EOF__ >> "$cfgfile" ifelse([$1], [], [#! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # 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 # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG], [# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) # Is the compiler the GNU C compiler? with_gcc=$_LT_AC_TAGVAR(GCC, $1) # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_[]_LT_AC_TAGVAR(LD, $1) # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) # Commands used to build and install a shared archive. archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) # The directories searched by this compiler when creating a shared # library compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1) # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) # Flag that forces no undefined symbols. no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) # The commands to list exported symbols. export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) # Symbols that must always be exported. include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) ifelse([$1],[], [# ### END LIBTOOL CONFIG], [# ### END LIBTOOL TAG CONFIG: $tagname]) __EOF__ ifelse([$1],[], [ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ]) else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ])# AC_LIBTOOL_CONFIG # AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------------------- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi ])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE # --------------------------------- AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([LT_AC_PROG_SED]) AC_REQUIRE([AC_PROG_NM]) AC_REQUIRE([AC_OBJEXT]) # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32*) symcode='[[ABCDGISTW]]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; linux* | k*bsd*-gnu) if test "$host_cpu" = ia64; then symcode='[[ABCDGIRSTW]]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[[]] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi ]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE # AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) # --------------------------------------- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], [_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)= AC_MSG_CHECKING([for $compiler option to produce PIC]) ifelse([$1],[CXX],[ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; dgux*) case $cc_basename in ec++*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; icpc* | ecpc*) # Intel C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; vxworks*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; newsos6) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='' ;; esac ;; esac ;; osf3* | osf4* | osf5*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1), [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" ;; esac # # Check to make sure the static flag actually works. # wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) ]) # AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) # ------------------------------------ # See if the linker supports building shared libraries. AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in 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 if $NM -V 2>&1 | grep 'GNU' > /dev/null; then _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' else _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw*) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' ;; linux* | k*bsd*-gnu) _LT_AC_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ],[ runpath_var= _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_AC_TAGVAR(archive_cmds, $1)= _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_AC_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. _LT_CC_BASENAME([$compiler]) case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_AC_TAGVAR(ld_shlibs, $1)=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--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_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; interix[[3-9]]*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_AC_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*) # Portland Group f77 and f90 compilers _LT_AC_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' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_AC_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' tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; *) tmp_sharedflag='-shared' ;; esac _LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then _LT_AC_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~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi _LT_AC_TAGVAR(link_all_deplibs, $1)=no else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=yes _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' else _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_AC_TAGVAR(archive_cmds, $1)='' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_AC_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_AC_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' fi fi ;; amigaos*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # see comment about different semantics on the GNU ld section _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; bsdi[[45]]*) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_AC_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}" _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac fi ;; dgux*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_AC_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_AC_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac fi ]) AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_AC_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $rm conftest* 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_AC_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) _LT_AC_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no else _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) ;; esac fi ;; esac ])# AC_LIBTOOL_PROG_LD_SHLIBS # _LT_AC_FILE_LTDLL_C # ------------------- # Be careful that the start marker always follows a newline. AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include # #undef WIN32_LEAN_AND_MEAN # #include # # #ifndef __CYGWIN__ # # ifdef __CYGWIN32__ # # define __CYGWIN__ __CYGWIN32__ # # endif # #endif # # #ifdef __cplusplus # extern "C" { # #endif # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); # #ifdef __cplusplus # } # #endif # # #ifdef __CYGWIN__ # #include # DECLARE_CYGWIN_DLL( DllMain ); # #endif # HINSTANCE __hDllInstance_base; # # BOOL APIENTRY # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) # { # __hDllInstance_base = hInst; # return TRUE; # } # /* ltdll.c ends here */ ])# _LT_AC_FILE_LTDLL_C # _LT_AC_TAGVAR(VARNAME, [TAGNAME]) # --------------------------------- AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) AC_DEFUN([LT_AC_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj, no) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS) ]) AC_DEFUN([LT_AC_PROG_RC], [AC_CHECK_TOOL(RC, windres, no) ]) # Cheap backport of AS_EXECUTABLE_P and required macros # from Autoconf 2.59; we should not use $as_executable_p directly. # _AS_TEST_PREPARE # ---------------- m4_ifndef([_AS_TEST_PREPARE], [m4_defun([_AS_TEST_PREPARE], [if test -x / >/dev/null 2>&1; then as_executable_p='test -x' else as_executable_p='test -f' fi ])])# _AS_TEST_PREPARE # AS_EXECUTABLE_P # --------------- # Check whether a file is executable. m4_ifndef([AS_EXECUTABLE_P], [m4_defun([AS_EXECUTABLE_P], [AS_REQUIRE([_AS_TEST_PREPARE])dnl $as_executable_p $1[]dnl ])])# AS_EXECUTABLE_P # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # # LT_AC_PROG_SED # -------------- # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. AC_DEFUN([LT_AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ]) # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.9.6])]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.58])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. # # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). # This was a mistake. There are at least two reasons why we must not # use `-m 0755': # - it causes special bits like SGID to be ignored, # - it may be too restrictive (some setups expect 775 directories). # # Do not use -m 0755 and let people choose whatever they expect by # setting umask. # # We cannot accept any implementation of `mkdir' that recognizes `-p'. # Some implementations (such as Solaris 8's) are not thread-safe: if a # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' # concurrently, both version can detect that a/ is missing, but only # one can create it and the other will error out. Consequently we # restrict ourselves to GNU make (using the --version option ensures # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi AC_SUBST([mkdir_p])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) openipmi-2.0.18/OpenIPMI.spec.in0000644000175000017500000001302110572077405015243 0ustar chuckchuck# For common adjustments that are needed for this file, search for # "USERFIX" Name: OpenIPMI Summary: %{name} - Library interface to IPMI Version: @OPENIPMI_VERSION_MAJOR@.@OPENIPMI_VERSION_MINOR@.@OPENIPMI_VERSION_RELEASE@ Release: 2 License: LGPL URL: http://openipmi.sourceforge.net Group: Utilities Vendor: OpenIPMI Project Packager: Tariq Shureih Source: %{name}-@VERSION@.tar.gz Buildroot: /var/tmp/%{name}-root BuildRequires: pkgconfig, perl >= 5, swig >= 1.3 Summary: IPMI Library Group: Utilities # Figure out if glib12 is installed %define glib12 %(if ls -l /usr/lib/libglib-1.2* >/dev/null 2>&1; then echo yes; else echo no; fi) %description This package contains a shared library implementation of IPMI and the basic tools used with OpenIPMI. %package devel Summary: Development files for OpenIPMI Group: Utilities Requires: OpenIPMI = %{version}, pkgconfig %description devel Contains additional files need for a developer to create applications and/or middleware that depends on libOpenIPMI %package perl Summary: Perl interface for OpenIPMI Group: Utilities Requires: OpenIPMI = %{version}, perl >= 5 %description perl A Perl interface for OpenIPMI. %package python Summary: Python interface for OpenIPMI Group: Utilities Requires: OpenIPMI = %{version}, python %description python A Python interface for OpenIPMI. %package gui Summary: GUI (in python) for OpenIPMI Group: Utilities Requires: OpenIPMI-python = %{version}, tkinter %description gui A GUI interface for OpenIPMI. Written in python an requiring wxWidgets. %package ui Summary: User Interface (ui) Group: Utilities Requires: OpenIPMI = %{version} %description ui This package contains a user interface %package lanserv Summary: Emulates an IPMI network listener Group: Utilities Requires: OpenIPMI = %{version} %description lanserv This package contains a network IPMI listener. ################################################### %prep ################################################### %setup ################################################### %build ################################################### # USERFIX: Things you might have to add to configure: # --with-tclcflags='-I /usr/include/tclN.M' --with-tcllibs=-ltclN.M # Obviously, replace N.M with the version of tcl on your system. %configure make ################################################### %install ################################################### rm -rf %{buildroot} make DESTDIR=%{buildroot} install install -d %{buildroot}/etc/init.d install -d %{buildroot}/etc/sysconfig install ipmi.init %{buildroot}/etc/init.d/ipmi install ipmi.sysconf %{buildroot}/etc/sysconfig/ipmi ################################################### %post ################################################### chkconfig --add ipmi ################################################### %preun ################################################### if [ $1 = 0 ]; then /etc/init.d/ipmi stop >/dev/null 2>&1 /sbin/chkconfig --del ipmi fi ################################################### %postun ################################################### if [ "$1" -ge "1" ]; then /etc/init.d/ipmi condrestart >/dev/null 2>&1 || : fi ################################################### %files ################################################### %defattr(-,root,root) %{_libdir}/libOpenIPMIcmdlang.so.* %{_libdir}/libOpenIPMIglib.so.* # USERFIX: You might need to modify the following if glib12 is not # handled properly by the autodetection %if %{glib12} != "no" %{_libdir}/libOpenIPMIglib12.so.* %endif %{_libdir}/libOpenIPMItcl.so.* %{_libdir}/libOpenIPMIposix.so.* %{_libdir}/libOpenIPMIpthread.so.* %{_libdir}/libOpenIPMI.so.* %{_libdir}/libOpenIPMIutils.so.* %doc COPYING COPYING.LIB FAQ INSTALL README README.Force %doc README.MotorolaMXP CONFIGURING_FOR_LAN COPYING.BSD /etc/init.d/ipmi /etc/sysconfig/ipmi ################################################### %files perl ################################################### %defattr(-,root,root) %{perl_vendorarch} %doc swig/OpenIPMI.i swig/perl/sample swig/perl/ipmi_powerctl ################################################### %files python ################################################### %defattr(-,root,root) %{_libdir}/python*/site-packages/*OpenIPMI.* %doc swig/OpenIPMI.i ################################################### %files gui ################################################### %defattr(-,root,root) %dir %{_libdir}/python*/site-packages/openipmigui %{_libdir}/python*/site-packages/openipmigui/* %{_bindir}/openipmigui ################################################### %files devel ################################################### %defattr(-,root,root) %{_includedir}/OpenIPMI %{_libdir}/*.a %{_libdir}/*.la %{_libdir}/*.so %{_libdir}/pkgconfig %doc doc/IPMI.pdf ################################################### %files ui ################################################### %defattr(-,root,root) %{_bindir}/ipmi_ui %{_bindir}/ipmicmd %{_bindir}/openipmicmd %{_bindir}/ipmish %{_bindir}/openipmish %{_bindir}/solterm %{_bindir}/rmcp_ping %{_libdir}/libOpenIPMIui.so.* %doc %{_mandir}/man1/ipmi_ui.1* %doc %{_mandir}/man1/openipmicmd.1* %doc %{_mandir}/man1/openipmish.1* %doc %{_mandir}/man1/openipmigui.1* %doc %{_mandir}/man1/solterm.1* %doc %{_mandir}/man1/rmcp_ping.1* %doc %{_mandir}/man7/ipmi_cmdlang.7* %doc %{_mandir}/man7/openipmi_conparms.7* ################################################### %files lanserv ################################################### %defattr(-,root,root) %{_bindir}/ipmilan %{_libdir}/libIPMIlanserv.so.* %doc %{_mandir}/man8/ipmilan.8* openipmi-2.0.18/sample/0000755000175000017500000000000011367555460013673 5ustar chuckchuckopenipmi-2.0.18/sample/sample3.c0000644000175000017500000004305111363572740015402 0ustar chuckchuck/* * test1.c * * OpenIPMI test code showing event setup * * Author: Corey Minyard * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* This sample application demostrates some general handling of sensors, like reading values, setting up events, and things of that nature. It also demonstrates some good coding practices like refcounting structures. */ static const char *progname; #define MAX_SENSOR_NAME_SIZE 128 typedef struct sdata_s { unsigned int refcount; ipmi_sensor_id_t sensor_id; char name[MAX_SENSOR_NAME_SIZE]; ipmi_event_state_t *es; ipmi_thresholds_t *th; int state_sup; int thresh_sup; struct sdata_s *next, *prev; } sdata_t; static sdata_t *sdata_list = NULL; static sdata_t * alloc_sdata(ipmi_sensor_t *sensor) { sdata_t *sdata; sdata = malloc(sizeof(*sdata)); if (!sdata) return NULL; sdata->es = malloc(ipmi_event_state_size()); if (!sdata->es) { free(sdata); return NULL; } ipmi_event_state_init(sdata->es); sdata->th = malloc(ipmi_thresholds_size()); if (!sdata->th) { free(sdata->es); free(sdata); return NULL; } ipmi_thresholds_init(sdata->th); sdata->refcount = 1; sdata->sensor_id = ipmi_sensor_convert_to_id(sensor); ipmi_sensor_get_name(sensor, sdata->name, sizeof(sdata->name)); sdata->next = sdata_list; sdata->prev = NULL; sdata_list = sdata; return sdata; } static sdata_t * find_sdata(ipmi_sensor_t *sensor) { ipmi_sensor_id_t id = ipmi_sensor_convert_to_id(sensor); sdata_t *link; link = sdata_list; while (link) { if (ipmi_cmp_sensor_id(id, link->sensor_id) == 0) return link; link = link->next; } return NULL; } static void use_sdata(sdata_t *sdata) { sdata->refcount++; } static void release_sdata(sdata_t *sdata) { sdata->refcount--; if (sdata->refcount == 0) { /* Remove it from the list. */ if (sdata->next) sdata->next->prev = sdata->prev; if (sdata->prev) sdata->prev->next = sdata->next; else sdata_list = sdata->next; free(sdata->es); free(sdata->th); free(sdata); } } static void con_usage(const char *name, const char *help, void *cb_data) { printf("\n%s%s", name, help); } static void usage(void) { printf("Usage:\n"); printf(" %s \n", progname); printf(" Where is one of:"); ipmi_parse_args_iter_help(con_usage, NULL); } static void got_thresh_reading(ipmi_sensor_t *sensor, int err, enum ipmi_value_present_e value_present, unsigned int raw_value, double val, ipmi_states_t *states, void *cb_data) { sdata_t *sdata = cb_data; enum ipmi_thresh_e thresh; if (err) { printf("Error 0x%x getting discrete states for sensor %s\n", err, sdata->name); goto out; } printf("Got threshold reading for sensor %s\n", sdata->name); if (ipmi_is_event_messages_enabled(states)) printf(" event messages enabled\n"); if (ipmi_is_sensor_scanning_enabled(states)) printf(" sensor scanning enabled\n"); if (ipmi_is_initial_update_in_progress(states)) printf(" initial update in progress\n"); switch (value_present) { case IPMI_NO_VALUES_PRESENT: printf(" no value present\n"); break; case IPMI_BOTH_VALUES_PRESENT: { const char *percent = ""; const char *base; const char *mod_use = ""; const char *modifier = ""; const char *rate; base = ipmi_sensor_get_base_unit_string(sensor); if (ipmi_sensor_get_percentage(sensor)) percent = "%"; switch (ipmi_sensor_get_modifier_unit_use(sensor)) { case IPMI_MODIFIER_UNIT_NONE: break; case IPMI_MODIFIER_UNIT_BASE_DIV_MOD: mod_use = "/"; modifier = ipmi_sensor_get_modifier_unit_string(sensor); break; case IPMI_MODIFIER_UNIT_BASE_MULT_MOD: mod_use = "*"; modifier = ipmi_sensor_get_modifier_unit_string(sensor); break; } rate = ipmi_sensor_get_rate_unit_string(sensor); printf(" value: %lf%s %s%s%s%s\n", val, percent, base, mod_use, modifier, rate); } /* FALLTHROUGH */ case IPMI_RAW_VALUE_PRESENT: printf(" raw value: 0x%2.2x\n", raw_value); } if (sdata->thresh_sup == IPMI_THRESHOLD_ACCESS_SUPPORT_NONE) goto out; for (thresh=IPMI_LOWER_NON_CRITICAL; thresh<=IPMI_UPPER_NON_RECOVERABLE; thresh++) { int val, rv; rv = ipmi_sensor_threshold_reading_supported(sensor, thresh, &val); if (rv || !val) continue; if (ipmi_is_threshold_out_of_range(states, thresh)) printf(" Threshold %s is out of range\n", ipmi_get_threshold_string(thresh)); else printf(" Threshold %s is in range\n", ipmi_get_threshold_string(thresh)); } out: release_sdata(sdata); } static void got_discrete_states(ipmi_sensor_t *sensor, int err, ipmi_states_t *states, void *cb_data) { sdata_t *sdata = cb_data; int i; if (err) { printf("Error 0x%x getting discrete states for sensor %s\n", err, sdata->name); goto out; } if (err) { printf("Error 0x%x getting discrete states for sensor %s\n", err, sdata->name); goto out; } printf("Got state reading for sensor %s\n", sdata->name); if (ipmi_is_event_messages_enabled(states)) printf(" event messages enabled\n"); if (ipmi_is_sensor_scanning_enabled(states)) printf(" sensor scanning enabled\n"); if (ipmi_is_initial_update_in_progress(states)) printf(" initial update in progress\n"); for (i=0; i<15; i++) { int val, rv; rv = ipmi_sensor_discrete_event_readable(sensor, i, &val); if (rv || !val) continue; printf(" state %d value is %d\n", i, ipmi_is_state_set(states, i)); } out: release_sdata(sdata); } static void event_set_done(ipmi_sensor_t *sensor, int err, void *cb_data) { sdata_t *sdata = cb_data; if (err) { printf("Error 0x%x setting events for sensor %s\n", err, sdata->name); goto out; } printf("Events set for sensor %s\n", sdata->name); out: release_sdata(sdata); } static void got_events(ipmi_sensor_t *sensor, int err, ipmi_event_state_t *states, void *cb_data) { sdata_t *sdata = cb_data; int rv; if (err) { printf("Error 0x%x getting events for sensor %s\n", err, sdata->name); goto out_err; } /* Turn on the general events for a sensor, since this at least supports per-sensor enables. */ ipmi_event_state_set_events_enabled(sdata->es, 1); ipmi_event_state_set_scanning_enabled(sdata->es, 1); printf("Sensor %s event settings:\n", sdata->name); if (sdata->state_sup != IPMI_EVENT_SUPPORT_PER_STATE) { /* No per-state sensors, just do the global enable. */ } else if (ipmi_sensor_get_event_reading_type(sensor) == IPMI_EVENT_READING_TYPE_THRESHOLD) { /* Check each event, print out the current state, and turn it on in the events to set if it is available. */ enum ipmi_event_value_dir_e value_dir; enum ipmi_event_dir_e dir; enum ipmi_thresh_e thresh; int val; for (value_dir=IPMI_GOING_LOW; value_dir<=IPMI_GOING_HIGH; value_dir++) { for (dir=IPMI_ASSERTION; dir<=IPMI_DEASSERTION; dir++) { for (thresh=IPMI_LOWER_NON_CRITICAL; thresh<=IPMI_UPPER_NON_RECOVERABLE; thresh++) { char *v; rv = ipmi_sensor_threshold_event_supported (sensor, thresh, value_dir, dir, &val); if (rv || !val) continue; if (ipmi_is_threshold_event_set(states, thresh, value_dir, dir)) v = ""; else v = " not"; printf(" %s %s %s was%s enabled\n", ipmi_get_threshold_string(thresh), ipmi_get_value_dir_string(value_dir), ipmi_get_event_dir_string(dir), v); ipmi_threshold_event_set(sdata->es, thresh, value_dir, dir); } } } } else { /* Check each event, print out the current state, and turn it on in the events to set if it is available. */ enum ipmi_event_dir_e dir; int i; for (dir=IPMI_ASSERTION; dir<=IPMI_DEASSERTION; dir++) { for (i=0; i<15; i++) { char *v; int val; rv = ipmi_sensor_discrete_event_supported (sensor, i, dir, &val); if (rv || !val) continue; if (ipmi_is_discrete_event_set(states, i, dir)) v = ""; else v = " not"; printf(" bit %d %s was%s enabled\n", i, ipmi_get_event_dir_string(dir), v); ipmi_discrete_event_set(sdata->es, i, dir); } } } rv = ipmi_sensor_set_event_enables(sensor, sdata->es, event_set_done, sdata); if (rv) { printf("Error 0x%x enabling events for sensor %s\n", err, sdata->name); goto out_err; } return; out_err: release_sdata(sdata); } static void thresholds_set(ipmi_sensor_t *sensor, int err, void *cb_data) { sdata_t *sdata = cb_data; if (err) { printf("Error 0x%x setting thresholds for sensor %s\n", err, sdata->name); goto out; } printf("Thresholds set for sensor %s\n", sdata->name); out: release_sdata(sdata); } static void got_thresholds(ipmi_sensor_t *sensor, int err, ipmi_thresholds_t *th, void *cb_data) { sdata_t *sdata = cb_data; enum ipmi_thresh_e thresh; int rv; if (err) { printf("Error 0x%x getting events for sensor %s\n", err, sdata->name); goto out_err; } printf("Sensor %s threshold settings:\n", sdata->name); for (thresh=IPMI_LOWER_NON_CRITICAL; thresh<=IPMI_UPPER_NON_RECOVERABLE; thresh++) { int val; double dval; rv = ipmi_sensor_threshold_readable(sensor, thresh, &val); if (rv || !val) /* Threshold not available. */ continue; rv = ipmi_threshold_get(th, thresh, &dval); if (rv) { printf(" threshold %s could not be fetched due to error 0x%x\n", ipmi_get_threshold_string(thresh), rv); } else { printf(" threshold %s is %lf\n", ipmi_get_threshold_string(thresh), dval); } } rv = ipmi_get_default_sensor_thresholds(sensor, sdata->th); if (rv) { printf("Error 0x%x getting def thresholds for sensor %s\n", rv, sdata->name); goto out_err; } rv = ipmi_sensor_set_thresholds(sensor, sdata->th, thresholds_set, sdata); if (rv) { printf("Error 0x%x setting thresholds for sensor %s\n", rv, sdata->name); goto out_err; } return; out_err: release_sdata(sdata); } /* Whenever the status of a sensor changes, the function is called We display the information of the sensor if we find a new sensor */ static void sensor_change(enum ipmi_update_e op, ipmi_entity_t *ent, ipmi_sensor_t *sensor, void *cb_data) { sdata_t *sdata; int rv; if (op == IPMI_ADDED) { sdata = alloc_sdata(sensor); if (!sdata) { printf("Unable to allocate sensor name memory\n"); return; } printf("Sensor added: %s\n", sdata->name); /* Get the current reading. */ if (ipmi_sensor_get_event_reading_type(sensor) == IPMI_EVENT_READING_TYPE_THRESHOLD) { use_sdata(sdata); rv = ipmi_sensor_get_reading(sensor, got_thresh_reading, sdata); if (rv) { printf("ipmi_reading_get returned error 0x%x for sensor %s\n", rv, sdata->name); release_sdata(sdata); } } else { use_sdata(sdata); rv = ipmi_sensor_get_states(sensor, got_discrete_states, sdata); if (rv) { printf("ipmi_states_get returned error 0x%x for sensor %s\n", rv, sdata->name); release_sdata(sdata); } } /* Set up events. */ sdata->state_sup = ipmi_sensor_get_event_support(sensor); switch (sdata->state_sup) { case IPMI_EVENT_SUPPORT_NONE: case IPMI_EVENT_SUPPORT_GLOBAL_ENABLE: /* No events to set up. */ printf("Sensor %s has no event support\n", sdata->name); goto get_thresh; } use_sdata(sdata); rv = ipmi_sensor_get_event_enables(sensor, got_events, sdata); if (rv) { printf("ipmi_sensor_events_enable_get returned error 0x%x" " for sensor %s\n", rv, sdata->name); release_sdata(sdata); } get_thresh: /* Handle the threshold settings. */ if (ipmi_sensor_get_event_reading_type(sensor) != IPMI_EVENT_READING_TYPE_THRESHOLD) /* Thresholds only for threshold sensors (duh) */ goto out; sdata->thresh_sup = ipmi_sensor_get_threshold_access(sensor); switch (sdata->thresh_sup) { case IPMI_THRESHOLD_ACCESS_SUPPORT_NONE: printf("Sensor %s has no threshold support\n", sdata->name); goto out; case IPMI_THRESHOLD_ACCESS_SUPPORT_FIXED: printf("Sensor %s has fixed threshold support\n", sdata->name); goto out; } use_sdata(sdata); rv = ipmi_sensor_get_thresholds(sensor, got_thresholds, sdata); if (rv) { printf("ipmi_thresholds_get returned error 0x%x" " for sensor %s\n", rv, sdata->name); release_sdata(sdata); } } else if (op == IPMI_DELETED) { sdata = find_sdata(sensor); if (!sdata) { char name[120]; ipmi_sensor_get_name(sensor, name, sizeof(name)); printf("sensor %s was deleted but not found in the sensor db\n", name); goto out; } printf("sensor %s was deleted\n", sdata->name); release_sdata(sdata); } out: return; } /* Whenever the status of an entity changes, the function is called When a new entity is created, we search all sensors that belong to the entity */ static void entity_change(enum ipmi_update_e op, ipmi_domain_t *domain, ipmi_entity_t *entity, void *cb_data) { int rv; char name[50]; ipmi_entity_get_name(entity, name, sizeof(name)); if (op == IPMI_ADDED) { printf("Entity added: %s\n", name); /* Register callback so that when the status of a sensor changes, sensor_change is called */ rv = ipmi_entity_add_sensor_update_handler(entity, sensor_change, NULL); if (rv) { printf("ipmi_entity_set_sensor_update_handler: 0x%x", rv); exit(1); } } } /* After we have established connection to domain, this function get called At this time, we can do whatever things we want to do. Herr we want to search all entities in the system */ void setup_done(ipmi_domain_t *domain, int err, unsigned int conn_num, unsigned int port_num, int still_connected, void *user_data) { int rv; /* Register a callback functin entity_change. When a new entities is created, entity_change is called */ rv = ipmi_domain_add_entity_update_handler(domain, entity_change, domain); if (rv) { printf("ipmi_domain_add_entity_update_handler return error: %d\n", rv); return; } } static os_handler_t *os_hnd; int main(int argc, char *argv[]) { int rv; int curr_arg = 1; ipmi_args_t *args; ipmi_con_t *con; progname = argv[0]; /* OS handler allocated first. */ os_hnd = ipmi_posix_setup_os_handler(); if (!os_hnd) { printf("ipmi_smi_setup_con: Unable to allocate os handler\n"); exit(1); } /* Use the default log handler. */ /* Initialize the OpenIPMI library. */ ipmi_init(os_hnd); rv = ipmi_parse_args2(&curr_arg, argc, argv, &args); if (rv) { fprintf(stderr, "Error parsing command arguments, argument %d: %s\n", curr_arg, strerror(rv)); usage(); exit(1); } rv = ipmi_args_setup_con(args, os_hnd, NULL, &con); if (rv) { fprintf(stderr, "ipmi_ip_setup_con: %s", strerror(rv)); exit(1); } rv = ipmi_open_domain("", &con, 1, setup_done, NULL, NULL, NULL, NULL, 0, NULL); if (rv) { fprintf(stderr, "ipmi_init_domain: %s\n", strerror(rv)); exit(1); } /* This is the main loop of the event-driven program. Try to exit the program */ /* Let the selector code run the select loop. */ os_hnd->operation_loop(os_hnd); /* Technically, we can't get here, but this is an example. */ os_hnd->free_os_handler(os_hnd); return 0; } openipmi-2.0.18/sample/sample2.c0000644000175000017500000002123511363572740015401 0ustar chuckchuck/* * sample.c * * OpenIPMI sample code * * Author: MontaVista Software * Corey Minyard * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include /* This sample application demostrates a very simple method to use OpenIPMI. It takes a entity id, entity instance, and control name, looks for that sensor to be created, then prints out the value every 5 seconds. */ static os_handler_t *os_hnd; static const char *progname; static void con_usage(const char *name, const char *help, void *cb_data) { printf("\n%s%s", name, help); } static void usage(void) { printf("Usage:\n"); printf(" %s \n", progname); printf(" Where the entity id, instance, and control name identify a\n"); printf(" control to monitor, and "); printf(" where is one of:"); ipmi_parse_args_iter_help(con_usage, NULL); } int control_set = 0; ipmi_control_id_t control_id; struct timeval check_timeout; os_hnd_timer_id_t *check_timer; int entity_id; int entity_instance; const char *control_name; ipmi_domain_id_t domain_id; int leaving = 0; void leave_done(void *cb_data) { exit(0); } void leave2(ipmi_domain_t *domain, void *cb_data) { ipmi_domain_close(domain, leave_done, NULL); } void leave(void) { leaving = 1; ipmi_domain_pointer_cb(domain_id, leave2, NULL); } void got_val(ipmi_control_t *control, int err, int *val, void *cb_data) { int i; int count; if (err) { printf("Error reading values\n"); exit(1); } count = ipmi_control_get_num_vals(control); printf("Value:"); for (i=0; istart_timer(os_hnd, check_timer, &check_timeout, control_check_timeout, NULL); } /* Whenever the status of a control changes, the function is called We display the information of the control if we find a new control */ static void control_change(enum ipmi_update_e op, ipmi_entity_t *ent, ipmi_control_t *control, void *cb_data) { int id, instance; char name[33]; id = ipmi_entity_get_entity_id(ent); instance = ipmi_entity_get_entity_instance(ent); ipmi_control_get_id(control, name, 32); if (op == IPMI_ADDED) { if ((id == entity_id) && (instance == entity_instance) && (strcmp(control_name, name) == 0)) { control_id = ipmi_control_convert_to_id(control); control_set = 1; } } } /* Whenever the status of an entity changes, the function is called When a new entity is created, we search all controls that belong to the entity */ static void entity_change(enum ipmi_update_e op, ipmi_domain_t *domain, ipmi_entity_t *entity, void *cb_data) { int rv; int id, instance; id = ipmi_entity_get_entity_id(entity); instance = ipmi_entity_get_entity_instance(entity); if (op == IPMI_ADDED) { /* Register callback so that when the status of a control changes, control_change is called */ rv = ipmi_entity_add_control_update_handler(entity, control_change, entity); if (rv) { printf("ipmi_entity_add_control_update_handler: 0x%x", rv); leave(); } } } /* After we have established connection to domain, this function get called At this time, we can do whatever things we want to do. Herr we want to search all entities in the system */ void setup_done(ipmi_domain_t *domain, int err, unsigned int conn_num, unsigned int port_num, int still_connected, void *user_data) { int rv; domain_id = ipmi_domain_convert_to_id(domain); /* Register a callback functin entity_change. When a new entity is created, entity_change is called */ rv = ipmi_domain_add_entity_update_handler(domain, entity_change, domain); if (rv) { printf("ipmi_domain_add_entity_update_handler return error: %d\n", rv); return; } } static void thread(void *data) { os_handler_t *os_hnd = data; /* This is the main loop of the event-driven program. Try to exit the program */ os_hnd->operation_loop(os_hnd); } int main(int argc, char *argv[]) { int rv; int curr_arg = 4; ipmi_args_t *args; ipmi_con_t *con; progname = argv[0]; if (argc < 4) { usage(); exit(1); } entity_id = strtoul(argv[1], NULL, 10); entity_instance = strtoul(argv[2], NULL, 10); control_name = argv[3]; /* OS handler allocated first. */ os_hnd = ipmi_posix_thread_setup_os_handler(SIGUSR1); if (!os_hnd) { printf("ipmi_smi_setup_con: Unable to allocate os handler\n"); exit(1); } /* Use the default log handler. */ /* Initialize the OpenIPMI library. */ ipmi_init(os_hnd); rv = ipmi_parse_args2(&curr_arg, argc, argv, &args); if (rv) { fprintf(stderr, "Error parsing command arguments, argument %d: %s\n", curr_arg, strerror(rv)); usage(); exit(1); } rv = ipmi_args_setup_con(args, os_hnd, NULL, &con); if (rv) { fprintf(stderr, "ipmi_ip_setup_con: %s", strerror(rv)); exit(1); } rv = ipmi_open_domain("", &con, 1, setup_done, NULL, NULL, NULL, NULL, 0, NULL); if (rv) { fprintf(stderr, "ipmi_init_domain: %s\n", strerror(rv)); exit(1); } rv = os_hnd->alloc_timer(os_hnd, &check_timer); if (rv) { fprintf(stderr, "alloc_timer: %x\n", rv); leave(); } check_timeout.tv_sec = 5; check_timeout.tv_usec = 0; os_hnd->start_timer(os_hnd, check_timer, &check_timeout, control_check_timeout, NULL); rv = os_hnd->create_thread(os_hnd, 0, thread, os_hnd); if (rv) { fprintf(stderr, "create_thread: %x\n", rv); exit(1); } rv = os_hnd->create_thread(os_hnd, 0, thread, os_hnd); if (rv) { fprintf(stderr, "create_thread 2: %x\n", rv); exit(1); } /* Let the other threads take over. */ for (;;) sleep(100); /* Note that at cleanup time, you should call os_hnd->free_os_handler(os_hnd); but this doesn't have any cleanup. */ return 0; } openipmi-2.0.18/sample/dump_sensors.c0000644000175000017500000001525011363572740016557 0ustar chuckchuck/* * dump_sensors.c * * OpenIPMI test code * * Author: Corey Minyard * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static const char *progname; static void con_usage(const char *name, const char *help, void *cb_data) { printf("\n%s%s", name, help); } static void usage(void) { printf("Usage:\n"); printf(" %s \n", progname); printf(" Where is one of:"); ipmi_parse_args_iter_help(con_usage, NULL); } static int done; /* Whenever the status of a sensor changes, the function is called We display the information of the sensor if we find a new sensor */ static void sensor_change(enum ipmi_update_e op, ipmi_entity_t *ent, ipmi_sensor_t *sensor, void *cb_data) { int id, instance; char name[33]; id = ipmi_entity_get_entity_id(ent); instance = ipmi_entity_get_entity_instance(ent); ipmi_sensor_get_id(sensor, name, 32); if (op == IPMI_ADDED) { int lun, num; printf("Sensor added: %d.%d.%s\n", id, instance, name); ipmi_sensor_get_num(sensor, &lun, &num); printf(" owner: %d\n", ipmi_sensor_get_owner(sensor)); printf(" channel: %d\n", ipmi_sensor_get_channel(sensor)); printf(" lun: %d\n", lun); printf(" num: %d\n", num); } } /* Whenever the status of an entity changes, the function is called When a new entity is created, we search all sensors that belong to the entity */ static void entity_change(enum ipmi_update_e op, ipmi_domain_t *domain, ipmi_entity_t *entity, void *cb_data) { int rv; int id, instance; id = ipmi_entity_get_entity_id(entity); instance = ipmi_entity_get_entity_instance(entity); if (op == IPMI_ADDED) { printf("Entity added: %d.%d\n", id, instance); /* Register callback so that when the status of a sensor changes, sensor_change is called */ rv = ipmi_entity_add_sensor_update_handler(entity, sensor_change, entity); if (rv) { printf("ipmi_entity_set_sensor_update_handler: 0x%x", rv); exit(1); } } } /* After we have established connection to domain, this function get called At this time, we can do whatever things we want to do. Herr we want to search all entities in the system */ void setup_done(ipmi_domain_t *domain, int err, unsigned int conn_num, unsigned int port_num, int still_connected, void *user_data) { int rv; /* Register a callback function entity_change. When a new entities is created, entity_change is called */ rv = ipmi_domain_add_entity_update_handler(domain, entity_change, domain); if (rv) { printf("ipmi_domain_add_entity_update_handler return error: %d\n", rv); return; } } static void domain_closed(void *cb_data) { done = 1; } static void domain_up(ipmi_domain_t *domain, void *cb_data) { int rv; rv = ipmi_domain_close(domain, domain_closed, NULL); if (rv) { printf("ipmi_domain_close return error: %d\n", rv); exit(1); } } static os_handler_t *os_hnd; static void my_vlog(os_handler_t *handler, const char *format, enum ipmi_log_type_e log_type, va_list ap) { int do_nl = 1; switch(log_type) { case IPMI_LOG_INFO: printf("INFO: "); break; case IPMI_LOG_WARNING: printf("WARN: "); break; case IPMI_LOG_SEVERE: printf("SEVR: "); break; case IPMI_LOG_FATAL: printf("FATL: "); break; case IPMI_LOG_ERR_INFO: printf("EINF: "); break; case IPMI_LOG_DEBUG_START: do_nl = 0; /* FALLTHROUGH */ case IPMI_LOG_DEBUG: printf("DEBG: "); break; case IPMI_LOG_DEBUG_CONT: do_nl = 0; /* FALLTHROUGH */ case IPMI_LOG_DEBUG_END: break; } vprintf(format, ap); if (do_nl) printf("\n"); } int main(int argc, char *argv[]) { int rv; int curr_arg = 1; ipmi_args_t *args; ipmi_con_t *con; progname = argv[0]; /* OS handler allocated first. */ os_hnd = ipmi_posix_setup_os_handler(); if (!os_hnd) { printf("ipmi_smi_setup_con: Unable to allocate os handler\n"); exit(1); } /* Override the default log handler (just to show how). */ os_hnd->set_log_handler(os_hnd, my_vlog); /* Initialize the OpenIPMI library. */ ipmi_init(os_hnd); rv = ipmi_parse_args2(&curr_arg, argc, argv, &args); if (rv) { fprintf(stderr, "Error parsing command arguments, argument %d: %s\n", curr_arg, strerror(rv)); usage(); exit(1); } rv = ipmi_args_setup_con(args, os_hnd, NULL, &con); if (rv) { fprintf(stderr, "ipmi_ip_setup_con: %s", strerror(rv)); exit(1); } rv = ipmi_open_domain("", &con, 1, setup_done, NULL, domain_up, NULL, NULL, 0, NULL); if (rv) { fprintf(stderr, "ipmi_init_domain: %s\n", strerror(rv)); exit(1); } /* We run the select loop here, this shows how you can use sel_select. You could add your own processing in this loop. */ while (!done) os_hnd->perform_one_op(os_hnd, NULL); os_hnd->free_os_handler(os_hnd); return 0; } openipmi-2.0.18/sample/rmcp_ping.c0000644000175000017500000002010711131657623016006 0ustar chuckchuck/* * rmcp_ping.c * * OpenIPMI RMCP pinger * * Author: Montavista Software * Corey Minyard * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include #include #include unsigned char ping_msg[12] = { 0x06, /* RMCP version 1.0 */ 0x00, /* reserved */ 0xff, /* RMCP seq num, not used for IPMI */ 0x06, /* ASF message */ 0x00, 0x00, 0x11, 0xbe, /* ASF IANA */ 0x80, /* Presence Ping */ 0x00, /* Message tag */ 0x00, /* Reserved */ 0x00 /* Data Length */ }; static char *progname; static void usage(void) { fprintf(stderr, "Send an RMCP ping packet onces a second to the destination,\n"); fprintf(stderr, "printing unique responses it receives\n"); fprintf(stderr, "Usage:\n"); fprintf(stderr, " %s [-p ] [-t ] [-s ]" " [-d] [destination]\n", progname); fprintf(stderr, " -p - Destination port, defaults to 623\n"); fprintf(stderr, " -t - Sets the number of seconds to wait for responses" " (default 10)\n"); fprintf(stderr, " -s - Sets the start tag to start sending at" " (0-254, default 0\n"); fprintf(stderr, " -d - enable debugging\n"); fprintf(stderr, " destination - the target address, default is the broadcast\n"); fprintf(stderr, " address (default 255.255.255.255)\n"); exit(1); } int port = 0x26f; int waittime = 10; int starttag = 0; int debug_packet = 0; struct socklist { struct in_addr addr; struct socklist *next; }; struct socklist *socklist = NULL; static int add_host(struct sockaddr *addr) { struct socklist *curr = socklist; struct sockaddr_in *ip; if (addr->sa_family != AF_INET) return 0; ip = (struct sockaddr_in *) addr; while (curr) { if (ip->sin_addr.s_addr == curr->addr.s_addr) break; curr = curr->next; } if (curr) return 0; curr = malloc(sizeof(*curr)); curr->addr = ip->sin_addr; curr->next = socklist; socklist = curr; return 1; } int main(int argc, char *argv[]) { unsigned char rsp[28]; int sock; int rv; struct sockaddr dest; size_t destlen; struct sockaddr src; int val; socklen_t fromlen; fd_set readfds; struct timeval currtime; struct timeval endtime; struct timeval twait; char host[200]; char serv[200]; char *addrname; int send_next; int i; char *end; progname = argv[0]; for (i=1; i= argc) { fprintf(stderr, "No parameter given for -p\n\n"); usage(); } port = strtoul(argv[i], &end, 0); if (port < 0 || port > 65535 || *end != '\0') { fprintf(stderr, "Wrong port specified for -p\n\n"); usage(); } } else if (strcmp(argv[i], "-t") == 0) { i++; if (i >= argc) { fprintf(stderr, "No parameter given for -t\n\n"); usage(); } waittime = strtoul(argv[i], &end, 0); if (waittime < 0 || *end != '\0') { fprintf(stderr, "Wrong waittime specified for -t\n\n"); usage(); } } else if (strcmp(argv[i], "-s") == 0) { i++; if (i >= argc) { fprintf(stderr, "No parameter given for -s\n\n"); usage(); } starttag = strtoul(argv[i], &end, 0); if (starttag < 0 || starttag > 254 || *end != '\0') { fprintf(stderr, "Invalid start tag for -s\n\n"); usage(); } } else if (strcmp(argv[i], "-d") == 0) { debug_packet++; } } if (i < argc) { struct addrinfo hints, *res0; char ports[16]; snprintf(ports, sizeof(ports), "%d", port); memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; rv = getaddrinfo(argv[i], ports, &hints, &res0); if (rv != 0) { fprintf(stderr, "Unable to handle given address: %s\n\n", gai_strerror(rv)); usage(); } dest = *(res0->ai_addr); destlen = res0->ai_addrlen; freeaddrinfo(res0); } else { struct sockaddr_in *ip = (struct sockaddr_in *) &dest; ip->sin_family = AF_INET; ip->sin_port = htons(port); ip->sin_addr.s_addr = INADDR_BROADCAST; destlen = sizeof(*ip); } sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); if (sock == -1) { perror("socket"); exit(1); } /* We want it to be non-blocking. */ rv = fcntl(sock, F_SETFL, O_NONBLOCK); if (rv) { close(sock); perror("fcntl(sock, F_SETFL, O_NONBLOCK)"); exit(1); } val = 1; rv = setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val)); if (rv) { close(sock); perror("setsockopt(sock, SO_BROADCAST)"); exit(1); } gettimeofday(&currtime, NULL); endtime = currtime; endtime.tv_sec += waittime; send_next = 1; for (;;) { if ((endtime.tv_sec < currtime.tv_sec) || ((endtime.tv_sec == currtime.tv_sec) && (endtime.tv_usec < currtime.tv_usec))) break; if (send_next) { ping_msg[9] = starttag; starttag++; if (starttag > 254) starttag = 0; rv = sendto(sock, ping_msg, sizeof(ping_msg), 0, &dest, destlen); if (rv < 0) { close(sock); perror("sendto"); exit(1); } send_next = 0; } twait.tv_usec = 0; twait.tv_sec = 1; FD_ZERO(&readfds); FD_SET(sock, &readfds); rv = select(sock+1, &readfds, NULL, NULL, &twait); if (rv < 0) { close(sock); perror("select"); exit(1); } if (rv == 0) { send_next = 1; goto next; } fromlen = sizeof(src); rv = recvfrom(sock, rsp, sizeof(rsp), 0, &src, &fromlen); if (debug_packet && (rv > 0)) { int i; printf("Got packet:"); for (i=0; isin_addr); } else addrname = host; printf("%s", addrname); if ((rsp[20] & 0x80) && ((rsp[20] & 0xf) == 0x01)) printf(" IPMI"); printf("\n"); } next: gettimeofday(&currtime, NULL); } return 0; } openipmi-2.0.18/sample/solterm.c0000644000175000017500000005464111363572740015532 0ustar chuckchuck/* * solterm.c * * IPMI Serial-over-LAN Terminal application * * Author: Cyclades Australia Pty. Ltd. * Darius Davis * * Copyright 2005 Cyclades Australia Pty. Ltd. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #undef USE_SUSPEND /* * Usage: * * solterm -U username -P password [-Ra auth] [-Ri integ] [-Rc conf] hostname [-e escape_char] * [-notencrypted] [-notauthenticated] [-bitrate (9600|19200|38400|57600|115200)] * [-alerts (succeed|defer|fail)] [-holdoff] [-v] [-q] * * -Ra auth Specify authentication algorithm to use. * -Ri integ Specify integrity algorithm to use. * -Rc conf Specify confidentiality algorithm to use. * -e escape_char The escape character to use (Default: ~). * -notencrypted Specify that SoL packets should not be encrypted. * -notauthenticated Specify that SoL packets should not be authenticated. * -bitrate xxx Specify bit rate to use. BMCs are not required to * support all bit rates. Make sure this matches the bit * rate at which the baseboard is communicating! * -alerts succeed Specify that serial/modem alerts are to succeed while SoL is active. * -alerts deferred Serial/modem alerts are to be deferred for the duration of the SoL session. * -alerts fail Serial/modem alerts automatically fail during the SoL session. * -holdoff Specifies that CTS, DTR and DSR are to be deasserted at the start of the SoL session, * so that the configuration may be modified before the handshake is released. */ typedef enum { condition_running, condition_exiting, condition_exit_now } exit_condition_t; typedef enum { escape_waiting_for_CR, escape_waiting_for_escape, escape_next } escape_status_t; char escape_char = '~'; escape_status_t escape_status = escape_waiting_for_escape; struct termios orig_attr; static const char *progname; exit_condition_t exit_condition; ipmi_sol_conn_t *active_connection = NULL; int connection_up = 0; int verbosity; #define INITIAL_VERBOSITY 10 typedef struct { int authenticated, encrypted; int bit_rate; ipmi_sol_serial_alert_behavior alert_behavior; int holdoff; int ACK_timeout_usec; int ACK_retries; } sol_configuration_t; static void my_vlog(os_handler_t *handler, const char *format, enum ipmi_log_type_e log_type, va_list ap) { int do_nl = 1; switch(log_type) { case IPMI_LOG_INFO: if (verbosity < 3) return; printf("INFO: "); break; case IPMI_LOG_WARNING: if (verbosity < 1) return; printf("WARN: "); break; case IPMI_LOG_SEVERE: printf("SEVR: "); break; case IPMI_LOG_FATAL: printf("FATL: "); break; case IPMI_LOG_ERR_INFO: if (verbosity < 2) return; printf("EINF: "); break; case IPMI_LOG_DEBUG_START: if (verbosity < 2) return; do_nl = 0; /* FALLTHROUGH */ case IPMI_LOG_DEBUG: if (verbosity < 2) return; printf("DEBG: "); break; case IPMI_LOG_DEBUG_CONT: if (verbosity < 2) return; do_nl = 0; /* FALLTHROUGH */ case IPMI_LOG_DEBUG_END: if (verbosity < 2) return; break; } vprintf(format, ap); if (do_nl) printf("\n"); } void con_usage(const char *name, const char *help, void *cb_data) { if (strcmp(name, "lan") != 0) /* Only supports LAN. */ return; printf("\n%s%s\n", name, help); } static void usage(void) { printf("Usage:\n" " %s \n" " [-e escape_char] [-notencrypted] [-notauthenticated]\n" " [-bitrate (9600|19200|38400|57600|115200)]\n" " [-alerts (succeed|defer|fail)] [-holdoff] [-ack-retries n]\n" " [-ack-timeout usec] [-v] [-q]\n\n" "-e escape_char The escape character to use. Default is ~.\n" "-notencrypted Specify that SoL packets should not be encrypted.\n" "-notauthenticated Specify that SoL packets should not be authenticated.\n" "-bitrate xxx Specify bit rate to use. BMCs are not required to support all\n" " bit rates. Make sure this matches the bit rate at which the\n" " baseboard is communicating! Defaults to the BMC's configured\n" " nonvolatile bit rate.\n" "-alerts succeed Specify that serial/modem alerts are to succeed while\n" " SoL is active.\n" "-alerts deferred Serial/modem alerts are to be deferred for the duration\n" " of the SoL session.\n" "-alerts fail Serial/modem alerts automatically fail during the SoL session.\n" " This is the default.\n" "-holdoff Specifies that CTS, DTR and DSR are to be deasserted at the\n" " start of the SoL session,so that the configuration may be\n" " modified before the handshake is released.\n" "-v Be more verbose. May be specified multiple times.\n" "-q Be quieter. Opposite of -v.\n" "\n specified connection parameters for solterm. Note that only\n" "lan connection are supported for solterm. These parms are:\n", progname); ipmi_parse_args_iter_help(con_usage, NULL); } static void show_buffer_text(const void *data, size_t count) { unsigned int i; printf("["); for (i = 0; i < count; ++i) { char c = ((unsigned char *)data)[i]; if (isprint(c)) putchar(c); else putchar('.'); } printf("]"); fflush(stdout); } static void show_buffer_hex(const void *data, size_t count) { unsigned int i; printf("["); for (i = 0; i < count; ++i) printf("%02x", ((unsigned char *)data)[i]); printf("]"); fflush(stdout); } static int data_received(ipmi_sol_conn_t *conn, const void *data, size_t count, void *user_data) { unsigned int i; if (verbosity > 3) show_buffer_text(data, count); if (verbosity > 5) show_buffer_hex(data, count); for (i = 0; i < count; ++i) printf("%c", ((unsigned char *)data)[i]); fflush(stdout); return 0; } static void break_detected(ipmi_sol_conn_t *conn, void *user_data) { tcsendbreak(1, 0); } static void bmc_transmit_overrun(ipmi_sol_conn_t *conn, void *user_data) { if (verbosity < 0) return; fprintf(stderr, "[BMC-BUFFER-OVERRUN]"); fflush(stderr); } /*typedef enum { ipmi_sol_state_closed, ipmi_sol_state_connecting, ipmi_sol_state_connected, ipmi_sol_state_connected_ctu, ipmi_sol_state_closing } ipmi_sol_state;*/ char *state_names[5] = {"Closed", "Connecting", "Connected", "Connected (Char Trans Unavail)", "Closing"}; #define ERROR_STRING_LEN 50 static void connection_state(ipmi_sol_conn_t *conn, ipmi_sol_state state, int error, void *cb_data) { char error_string[ERROR_STRING_LEN]; ipmi_get_error_string(error, error_string, ERROR_STRING_LEN); if ((verbosity > 2) && (state == ipmi_sol_state_closed)) printf("===============================================================================\n"); ipmi_log((error ? IPMI_LOG_SEVERE : IPMI_LOG_INFO), "Connection state changed: %s; Reason: %s", state_names[state], error_string); if ((verbosity > 2) && (state == ipmi_sol_state_connected || state == ipmi_sol_state_connected_ctu)) printf("===============================================================================\n"); if ((state == ipmi_sol_state_connected || state == ipmi_sol_state_connected_ctu) && !connection_up) { if (verbosity >= 0) { printf("Connected. Escape character is %c. %c? for help; %c. to disconnect.\n", escape_char, escape_char, escape_char); fflush(stdout); } connection_up = 1; } if (state == ipmi_sol_state_closed) exit_condition = condition_exit_now; fflush(stdout); } static void transmit_complete(ipmi_sol_conn_t *conn, int error, void *user_data) { if (!error) { if (verbosity > 5) { printf("[TC]"); fflush(stdout); } return; } if (IPMI_IS_SOL_ERR(error) && (IPMI_GET_SOL_ERR(error) == IPMI_SOL_UNCONFIRMABLE_OPERATION)) { if (verbosity > 1) fprintf(stderr, "[Unconfirmable]"); } else { /* * Transmission failed */ char buf[50]; fprintf(stderr, "[Pkt lost: %s]", ipmi_get_error_string(error, buf, 50)); fflush(stderr); } } static void flush_complete(ipmi_sol_conn_t *conn, int error, int queues_flushed, void *user_data) { transmit_complete(conn, error, user_data); } static void sol_send(const char *text, int count) { int rv; if (verbosity > 5) show_buffer_hex(text, count); rv = ipmi_sol_write(active_connection, text, count, transmit_complete, NULL); if (rv) { char buf[50]; fprintf(stderr, "[TX err: %s]", ipmi_get_error_string(rv, buf, 50)); } } static void sol_send_break() { int rv = ipmi_sol_send_break(active_connection, transmit_complete, NULL); if (rv) { char buf[50]; fprintf(stderr, "[TX err: %s]", ipmi_get_error_string(rv, buf, 50)); } } static void sol_do_flush() { int rv = ipmi_sol_flush(active_connection, IPMI_SOL_ALL_QUEUES, flush_complete, NULL); if (rv) { char buf[50]; fprintf(stderr, "[TX err: %s]", ipmi_get_error_string(rv, buf, 50)); } } static void unconfigure_terminal() { tcsetattr(STDIN_FILENO, TCSANOW, &orig_attr); signal(SIGINT, SIG_DFL); signal(SIGPIPE, SIG_DFL); } static void signal_handler(int signal) { unconfigure_terminal(); exit(1); } static void configure_terminal() { struct termios attr; tcgetattr(STDIN_FILENO, &attr); tcgetattr(STDIN_FILENO, &orig_attr); attr.c_iflag &= ~(/*IGNBRK|BRKINT|PARMRK|*/ISTRIP|INLCR|IGNCR|ICRNL|IXON|IXANY|IXOFF); /* attr.c_oflag &= ~OPOST;*/ attr.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN | ECHOE | ECHOK); attr.c_cflag &= ~(CSIZE|PARENB); attr.c_cflag |= CS8; tcsetattr(STDIN_FILENO, TCSANOW, &attr); signal(SIGINT, signal_handler); signal(SIGPIPE, signal_handler); } static int configure_sol() { int rv; rv = ipmi_sol_register_data_received_callback(active_connection, data_received, NULL); if (rv) ipmi_log(IPMI_LOG_SEVERE, "Error registering for data_received event: %s.", strerror(rv)); rv = ipmi_sol_register_break_detected_callback(active_connection, break_detected, NULL); if (rv) ipmi_log(IPMI_LOG_SEVERE, "Error registering for break_detected event: %s.", strerror(rv)); rv = ipmi_sol_register_bmc_transmit_overrun_callback(active_connection, bmc_transmit_overrun, NULL); if (rv) ipmi_log(IPMI_LOG_SEVERE, "Error registering for bmc_transmit_overrun event: %s.", strerror(rv)); rv = ipmi_sol_register_connection_state_callback(active_connection, connection_state, NULL); if (rv) ipmi_log(IPMI_LOG_SEVERE, "Error registering for connection_state event: %s.", strerror(rv)); ipmi_sol_set_ACK_retries(active_connection, 10); ipmi_sol_set_ACK_timeout(active_connection, 1000000); return 0; } static void conn_changed(ipmi_con_t *ipmi, int err, unsigned int port_num, int any_port_up, void *cb_data) { static int last_any_port_up = -1; int rv = err; if (any_port_up == last_any_port_up) return; last_any_port_up = any_port_up; if (any_port_up) { if (verbosity > 2) ipmi_log(IPMI_LOG_INFO, "IPMI connection is up. Bringing up SoL connection."); ipmi_sol_open(active_connection); } else { char buf[50]; ipmi_log(IPMI_LOG_SEVERE, "No connection to BMC is available. %s.", ipmi_get_error_string(rv, buf, 50)); ipmi_sol_force_close(active_connection); exit_condition = condition_exit_now; } } static void solterm_disconnect() { if (!connection_up) { exit_condition = condition_exit_now; } else /* * If we aren't already shutting down, do a forcible shut down! */ if (exit_condition == condition_running) { exit_condition = condition_exiting; ipmi_sol_close(active_connection); } else { ipmi_log(IPMI_LOG_WARNING, "Forcing SoL connection closed."); exit_condition = condition_exit_now; } } static void show_escape(unsigned char c) { if (isprint(c)) printf("[%c%c]", escape_char, c); else if ((c >= 1) && (c <= 26)) printf("[%c^%c]", escape_char, (c | 0x40)); else printf("[%c\\0x%02x]", escape_char, c); } static void show_help() { char hostname[80]; printf("\nThis is solterm"); if (0 == gethostname(&hostname[0], 80)) { hostname[79] = 0; printf(" on \"%s\"", &hostname[0]); } printf( ". Supported escape sequences:\n" "%c. - terminate connection\n" "%cB - send a BREAK to the managed baseboard\n" "%cF - flush local and remote buffers\n\n" "Baseboard RS232 Control signals:\n" "\t%cR/%cr - ASSERT/deassert RI (Ring Indicator) at managed baseboard\n" "\t%cD/%cd - ASSERT/deassert DCD and DSR at managed baseboard\n" "\t%cC/%cc - CTS PAUSE/place cts under BMC control\n\n", escape_char, escape_char, escape_char, escape_char, escape_char, escape_char, escape_char, escape_char, escape_char ); #ifdef USE_SUSPEND printf( "%c^Z - suspend solterm\n", escape_char); #endif printf( "%c? - this message\n" "%c%c - send the escape character by typing it twice\n" "(Note that escapes are only recognized immediately after newline.)\n", escape_char, escape_char, escape_char ); } static int did_handle_escape(unsigned char c) { switch (c) { case '.': /* Disconnect */ show_escape(c); solterm_disconnect(); return 1; case 'b': case 'B': /* Send Break */ show_escape(c); sol_send_break(); return 1; case 'f': case 'F': /* Flush everything */ show_escape(c); sol_do_flush(); return 1; case 'R': case 'r': show_escape(c); if (connection_up) ipmi_sol_set_RI_asserted(active_connection, (c == 'R'), transmit_complete, NULL); return 1; case 'D': case 'd': show_escape(c); if (connection_up) ipmi_sol_set_DCD_DSR_asserted(active_connection, (c == 'D'), transmit_complete, NULL); return 1; case 'C': case 'c': show_escape(c); if (connection_up) ipmi_sol_set_CTS_assertable(active_connection, (c == 'c'), transmit_complete, NULL); return 1; #ifdef USE_SUSPEND case 'Z' & 0x1f: /* ^Z */ show_escape(c); fflush(stdout); unconfigure_terminal(); kill(getpid(), SIGTSTP); configure_terminal(); printf("Resuming SoL session...\n"); fflush(stdout); return 1; #endif case '?': show_escape(c); show_help(); return 1; } return 0; } static void stdin_data_avail(int fd, void *cb_data, os_hnd_fd_id_t *id) { struct timeval tv; char c; fd_set theSet; tv.tv_sec = 0; tv.tv_usec = 0; FD_ZERO(&theSet); FD_SET(STDIN_FILENO, &theSet); if (!connection_up) ipmi_log(IPMI_LOG_WARNING, "Trying to transmit with no active connection!"); while (select(1, &theSet, NULL, NULL, &tv)) { if (0 == read(STDIN_FILENO, &c, 1)) { solterm_disconnect(); break; } else if ((escape_status == escape_next) && (c != escape_char) && did_handle_escape(c)) { /* If it was handled, we just go back to waiting for another escape char. * We should do this so the user can do ~R~r to assert then deassert RI. */ escape_status = escape_waiting_for_escape; fflush(stdout); } else if ((escape_status == escape_waiting_for_escape) && (escape_char == c)) escape_status = escape_next; else if ((escape_status == escape_waiting_for_CR) && ('\r' == c)) { if (connection_up) sol_send(&c, 1); escape_status = escape_waiting_for_escape; } else if (connection_up) { /* First, send the bottled-up escape char if it wasn't actually used as an escape char! */ if ((escape_status == escape_next) && (escape_char != c)) sol_send(&escape_char, 1); sol_send(&c, 1); if ('\r' == c) escape_status = escape_waiting_for_escape; else escape_status = escape_waiting_for_CR; } } } static os_handler_t *os_hnd; ipmi_open_option_t domain_open_options = { IPMI_OPEN_OPTION_ALL, { ival: 0 }}; static int parse_sol_bit_rate(char *src, int *bit_rate) { if (0 == strcmp(src, "9600")) *bit_rate = IPMI_SOL_BIT_RATE_9600; else if (0 == strcmp(src, "19200")) *bit_rate = IPMI_SOL_BIT_RATE_19200; else if (0 == strcmp(src, "38400")) *bit_rate = IPMI_SOL_BIT_RATE_38400; else if (0 == strcmp(src, "57600")) *bit_rate = IPMI_SOL_BIT_RATE_57600; else if (0 == strcmp(src, "115200")) *bit_rate = IPMI_SOL_BIT_RATE_115200; else return 0; return 1; } static int parse_sol_alerts(char *src, ipmi_sol_serial_alert_behavior *behavior) { if (0 == strcasecmp(src, "fail")) *behavior = ipmi_sol_serial_alerts_fail; else if (0 == strcasecmp(src, "defer")) *behavior = ipmi_sol_serial_alerts_deferred; else if (0 == strcasecmp(src, "deferred")) *behavior = ipmi_sol_serial_alerts_deferred; else if (0 == strcasecmp(src, "succeed")) *behavior = ipmi_sol_serial_alerts_succeed; else return 0; return 1; } #define ARG (argv[curr_arg]) #define NEXT_ARG \ {\ curr_arg++; \ if (curr_arg >= argc) { \ ipmi_log(IPMI_LOG_FATAL, "Expected parameter after argument \"%s\"", argv[argc - 1]); \ exit(1); \ } \ } int main(int argc, char *argv[]) { int rv; int curr_arg = 1; ipmi_args_t *args; ipmi_con_t *ipmi; char *name = "remote system"; os_hnd_fd_id_t *stdin_id; sol_configuration_t sol_configuration; memset(&sol_configuration, 0, sizeof(sol_configuration)); /* Enable authentication and encryption by default. */ sol_configuration.authenticated = 1; sol_configuration.encrypted = 1; exit_condition = condition_running; verbosity = INITIAL_VERBOSITY; progname = argv[0]; /* OS handler allocated first. */ os_hnd = ipmi_posix_setup_os_handler(); if (!os_hnd) { fprintf(stderr, "main: Unable to allocate os handler\n"); exit(1); } os_hnd->set_log_handler(os_hnd, my_vlog); /* Initialize the OpenIPMI library. */ ipmi_init(os_hnd); if (argc < 2) { usage(); exit(1); } /* Now we make sure "lan" is the first argument so we get the right connection type... */ if (strcmp(argv[1], "lan") != 0) { fprintf(stderr, "main: %s only supports lan connections\n", progname); exit(1); } curr_arg = 1; rv = ipmi_parse_args2(&curr_arg, argc, argv, &args); if (rv) { ipmi_log(IPMI_LOG_FATAL, "Error parsing command arguments, argument %d: %s\n", curr_arg, strerror(rv)); usage(); exit(1); } while (curr_arg < argc) { if (0 == strcmp(ARG, "-notencrypted")) sol_configuration.encrypted = 0; else if (0 == strcmp(ARG, "-notauthenticated")) sol_configuration.authenticated = 0; else if (0 == strcmp(ARG, "-holdoff")) sol_configuration.holdoff = 1; else if (0 == strncmp(ARG, "-bitrate=", 9)) { if (!parse_sol_bit_rate(&ARG[9], &sol_configuration.bit_rate)) break; } else if (0 == strcmp(ARG, "-bitrate")) { NEXT_ARG; if (!parse_sol_bit_rate(ARG, &sol_configuration.bit_rate)) break; } else if (0 == strncmp(ARG, "-alerts=", 8)) { if (!parse_sol_alerts(&ARG[8], &sol_configuration.alert_behavior)) break; } else if (0 == strncmp(ARG, "-alert=", 7)) { if (!parse_sol_alerts(&ARG[7], &sol_configuration.alert_behavior)) break; } else if ((0 == strcmp(ARG, "-alerts")) || (0 == strcmp(ARG, "-alert"))) { NEXT_ARG; if (!parse_sol_alerts(ARG, &sol_configuration.alert_behavior)) break; } else if (0 == strcmp(ARG, "-ack-retries")) { NEXT_ARG; // if (!parse_int(ARG } else if (0 == strcmp(ARG, "-e")) { NEXT_ARG; if (strlen(argv[curr_arg]) != 1) break; escape_char = argv[curr_arg][0]; } else if (0 == strcmp(ARG, "-v")) verbosity++; else if (0 == strcmp(ARG, "-q")) verbosity--; else break; curr_arg++; } if (curr_arg < argc) { ipmi_log(IPMI_LOG_FATAL, "Unknown arg: %s", argv[curr_arg]); usage(); exit(1); } if (sol_configuration.encrypted && !sol_configuration.authenticated) { ipmi_log(IPMI_LOG_FATAL, "Encryption cannot be enabled unless authentication is also enabled."); exit(1); } verbosity -= INITIAL_VERBOSITY; rv = ipmi_args_setup_con(args, os_hnd, NULL, &ipmi); if (rv) { ipmi_log(IPMI_LOG_FATAL, "ipmi_ip_setup_con: %s", strerror(rv)); exit(1); } if (ipmi->name) name = ipmi->name; rv = ipmi_sol_create(ipmi, &active_connection); if (rv) { ipmi_log(IPMI_LOG_FATAL, "Unable to create sol_conn. Error 0x%08x", rv); exit(1); } rv = configure_sol(); if (rv) { ipmi_log(IPMI_LOG_SEVERE, "Unable to configure sol_conn. Error 0x%08x", rv); } /* * Copy the parsed configuration into the sol_conn */ ipmi_sol_set_use_encryption(active_connection, sol_configuration.encrypted); ipmi_sol_set_use_authentication(active_connection, sol_configuration.authenticated); ipmi_sol_set_bit_rate(active_connection, sol_configuration.bit_rate); ipmi_sol_set_shared_serial_alert_behavior(active_connection, sol_configuration.alert_behavior); ipmi_sol_set_deassert_CTS_DCD_DSR_on_connect(active_connection, sol_configuration.holdoff); if (verbosity > 4) DEBUG_MSG_ENABLE(); if (verbosity > 5) DEBUG_RAWMSG_ENABLE(); if (verbosity >= 0) { printf( "Connecting to %s...\n", name); fflush(stdout); } configure_terminal(); rv = ipmi->add_con_change_handler(ipmi, conn_changed, NULL); ipmi->start_con(ipmi); os_hnd->add_fd_to_wait_for(os_hnd, STDIN_FILENO, stdin_data_avail, /* os_data_ready_t */ NULL, /* cb_data */ NULL, /*os_fd_data_freed_t */ &stdin_id); while (exit_condition != condition_exit_now) { os_hnd->perform_one_op(os_hnd, NULL); } unconfigure_terminal(); if (active_connection) { ipmi_sol_force_close(active_connection); ipmi_sol_free(active_connection); } if (connection_up) printf("Connection to %s closed.\n", name); os_hnd->free_os_handler(os_hnd); return 0; } openipmi-2.0.18/sample/ipmicmd.c0000644000175000017500000004530010576005502015447 0ustar chuckchuck/* * ipmicmd.c * * A test program that allows you to send messages on IPMI. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Note that F.Isabelle of Kontron did a significant amount of work on * this in the beginning, but not much is left of that work since it * has been redone to sit on top of the IPMI connections. * * Copyright 2002,2003 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ /* To use the program, run it, and you will receive a prompt. Then enter ipmi commands. Type "help" for more details. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void ipmi_oem_force_conn_init(void); int ipmi_oem_motorola_mxp_init(void); static int interactive = 1; static int interactive_done = 0; char *progname; selector_t *sel; os_handler_t *os_hnd; static ipmi_con_t *con; static int continue_operation = 1; /* We cobbled everything in the next section together to provide the things that the low-level handlers need. */ void ipmi_write_lock() { } void ipmi_write_unlock() { } void ipmi_read_lock() { } void ipmi_read_unlock() { } static void leave(int ret) { if (con && con->close_connection) { con->close_connection(con); con = NULL; } if (sel) { sel_free_selector(sel); sel = NULL; } exit(ret); } void printInfo(void) { printf("ipmicmd\n"); printf("This little utility is an ipmi command tool ;-)\n"); printf("It can be used to send commands to an IPMI interface\n"); printf("type -? for usage info.\n"); printf("Enjoy!\n"); } void con_usage(const char *name, const char *help, void *cb_data) { printf("\n%s%s", name, help); } void usage(void) { printf("%s [-k ] [-v] \n", progname); printf("Where is one of:"); ipmi_parse_args_iter_help(con_usage, NULL); } char * get_addr_type(int type) { switch (type) { case IPMI_SYSTEM_INTERFACE_ADDR_TYPE: return "SI"; case IPMI_IPMB_ADDR_TYPE: return "ipmb"; case IPMI_IPMB_BROADCAST_ADDR_TYPE: return "ipmb broadcast"; case IPMI_LAN_ADDR_TYPE: return "lan"; default: return "UNKNOWN"; } } void dump_msg_data(const ipmi_msg_t *msg, const ipmi_addr_t *addr, const char *type) { ipmi_system_interface_addr_t *smi_addr = NULL; int i; ipmi_ipmb_addr_t *ipmb_addr = NULL; ipmi_lan_addr_t *lan_addr = NULL; if (addr->addr_type == IPMI_SYSTEM_INTERFACE_ADDR_TYPE) { smi_addr = (struct ipmi_system_interface_addr *) addr; } else if ((addr->addr_type == IPMI_IPMB_ADDR_TYPE) || (addr->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE)) { ipmb_addr = (struct ipmi_ipmb_addr *) addr; } else if (addr->addr_type == IPMI_LAN_ADDR_TYPE) { lan_addr = (struct ipmi_lan_addr *) addr; } if (interactive) { printf("Got message:\n"); printf(" type = %s\n", type); printf(" addr_type = %s\n", get_addr_type(addr->addr_type)); printf(" channel = 0x%x\n", addr->channel); if (smi_addr) printf(" lun = 0x%x\n", smi_addr->lun); else if (ipmb_addr) printf(" slave addr = %x,%x\n", ipmb_addr->slave_addr, ipmb_addr->lun); else if (lan_addr) printf(" lan addr = %x,%x,%x,%x\n", lan_addr->session_handle, lan_addr->remote_SWID, lan_addr->local_SWID, lan_addr->lun); printf(" netfn = 0x%x\n", msg->netfn); printf(" cmd = 0x%x\n", msg->cmd); printf(" data ="); } else { if (smi_addr) { printf("%2.2x %2.2x %2.2x %2.2x ", addr->channel, msg->netfn, smi_addr->lun, msg->cmd); } else if (ipmb_addr) { printf("%2.2x %2.2x %2.2x %2.2x ", addr->channel, msg->netfn, ipmb_addr->lun, msg->cmd); } else if (lan_addr) printf(" lan addr = %x,%x,%x,%x\n", lan_addr->session_handle, lan_addr->remote_SWID, lan_addr->local_SWID, lan_addr->lun); } for (i=0; idata_len; i++) { if (((i%16) == 0) && (i != 0)) { printf("\n "); } printf("%2.2x ", msg->data[i]); } printf("\n"); } void cmd_handler(ipmi_con_t *ipmi, const ipmi_addr_t *addr, unsigned int addr_len, const ipmi_msg_t *cmd, long sequence, void *data1, void *data2, void *data3) { dump_msg_data(cmd, addr, "command"); printf("Command sequence = 0x%lx\n", sequence); } int rsp_handler(ipmi_con_t *ipmi, ipmi_msgi_t *rspi) { dump_msg_data(&rspi->msg, &rspi->addr, "response"); if (!interactive) continue_operation = 0; return IPMI_MSG_ITEM_NOT_USED; } void event_handler(ipmi_con_t *ipmi, const ipmi_addr_t *addr, unsigned int addr_len, ipmi_event_t *event, void *cb_data) { unsigned int record_id = ipmi_event_get_record_id(event); unsigned int type = ipmi_event_get_type(event); unsigned int data_len = ipmi_event_get_data_len(event); const unsigned char *data = ipmi_event_get_data_ptr(event); unsigned int i; printf("Got event:\n"); printf(" %4.4x (%2.2x):", record_id, type); for (i=0; idata1; if (data->count == 0) { unsigned long diff; struct timeval end_time; gettimeofday(&end_time, NULL); diff = (((end_time.tv_sec - data->start_time.tv_sec) * 1000000) + (end_time.tv_usec - data->start_time.tv_usec)); printf("Time was %fus per msg, %ldus total\n", ((float) diff) / ((float)(data->total_count)), diff); free(data); free(rspi); } else { int rv; rv = con->send_command(data->con, &data->addr, data->addr_len, &data->msg, timed_rsp_handler, rspi); data->count--; if (rv) { fprintf(stderr, "Error sending command: %x\n", rv); free(data); } else return IPMI_MSG_ITEM_USED; } return IPMI_MSG_ITEM_USED; } void time_msgs(ipmi_con_t *con, ipmi_msg_t *msg, ipmi_addr_t *addr, unsigned int addr_len, unsigned long count) { timed_data_t *data; int rv; ipmi_msgi_t *rspi; data = malloc(sizeof(*data)); if (!data) { fprintf(stderr, "No memory to perform command\n"); return; } rspi = ipmi_alloc_msg_item(); if (!rspi) { free(data); fprintf(stderr, "No memory to perform command\n"); return; } data->con = con; gettimeofday(&data->start_time, NULL); memcpy(&data->msg, msg, sizeof(data->msg)); memcpy(data->data, msg->data, msg->data_len); data->msg.data = data->data; memcpy(&data->addr, addr, addr_len); data->addr_len = addr_len; data->count = count; data->total_count = count; rspi->data1 = data; rv = con->send_command(data->con, &data->addr, data->addr_len, &data->msg, timed_rsp_handler, rspi); data->count--; if (rv) { fprintf(stderr, "Error sending command: %x\n", rv); free(data); ipmi_free_msg_item(rspi); } } int process_input_line(char *buf) { char *strtok_data; char *endptr; char *v = strtok_r(buf, " \t\r\n,.\"", &strtok_data); unsigned int pos = 0; int start; ipmi_addr_t addr; unsigned int addr_len; ipmi_msg_t msg; unsigned char outbuf[MAX_IPMI_DATA_SIZE]; int rv = 0; short channel; unsigned char seq = 0; unsigned int time_count = 0; int lan_addr = 0; if (v == NULL) return -1; if (strcmp(v, "help") == 0) { /* Strange that anyone would try this when not in interactive mode, * but it is possible */ if (!interactive) return -1; printf("Commands are:\n"); printf(" regcmd - Register to receive this cmd\n"); printf(" unregcmd - Unregister to receive this cmd\n"); printf(" help - This help\n"); printf(" 0f - send a command\n"); printf(" to the local BMC\n"); printf(" [ipmb] [seq] -\n"); printf(" send an IPMB command on the channel. seq is used if this is a response\n"); printf(" lan [seq] -\n"); printf(" send a command on a LAN channel. seq is used if this is a response\n"); printf(" [ipmb] 00 -\n"); printf(" broadcast a command on the channel.\n"); printf(" test_lat - Send the command and wait for\n" " the response times and measure the average\n" " time.\n"); return 0; } if (strcmp(v, "quit") == 0) { continue_operation = 0; return 0; } if (strcmp(v, "regcmd") == 0) { unsigned char netfn, cmd; v = strtok_r(NULL, " \t\r\n,.", &strtok_data); if (!v) { fprintf(stderr, "No netfn for regcmd\n"); return -1; } netfn = strtoul(v, &endptr, 16); v = strtok_r(NULL, " \t\r\n,.", &strtok_data); if (!v) { fprintf(stderr, "No cmd for regcmd\n"); return -1; } cmd = strtoul(v, &endptr, 16); rv = con->register_for_command(con, netfn, cmd, cmd_handler, NULL, NULL, NULL); if (rv) { fprintf(stderr, "Could not set to get receive command: %x\n", rv); return -1; } return 0; } if (strcmp(v, "unregcmd") == 0) { unsigned char netfn, cmd; v = strtok_r(NULL, " \t\r\n,.", &strtok_data); if (!v) { fprintf(stderr, "No netfn for regcmd\n"); return -1; } netfn = strtoul(v, &endptr, 16); v = strtok_r(NULL, " \t\r\n,.", &strtok_data); if (!v) { fprintf(stderr, "No cmd for regcmd\n"); return -1; } cmd = strtoul(v, &endptr, 16); rv = con->deregister_for_command(con, netfn, cmd); if (rv) { fprintf(stderr, "Could not set to get receive command: %x", rv); return -1; } return 0; } if (strcmp(v, "test_lat") == 0) { v = strtok_r(NULL, " \t\r\n,.", &strtok_data); if (!v) { fprintf(stderr, "No count for test_lat\n"); return -1; } time_count = strtoul(v, &endptr, 16); v = strtok_r(NULL, " \t\r\n,.", &strtok_data); } if (strcmp(v, "lan") == 0) { lan_addr = 1; v = strtok_r(NULL, " \t\r\n,.", &strtok_data); } else if (strcmp(v, "ipmb") == 0) { lan_addr = 0; v = strtok_r(NULL, " \t\r\n,.", &strtok_data); } while (v != NULL) { if (pos >= sizeof(outbuf)) { fprintf(stderr, "Message too long"); return -1; } outbuf[pos] = strtoul(v, &endptr, 16); if (*endptr != '\0') { fprintf(stderr, "Value %d was invalid\n", pos+1); return -1; } pos++; v = strtok_r(NULL, " \t\r\n,.", &strtok_data); } if (pos <= 0) { fprintf(stderr, "No channel specified\n"); return -1; } start = 0; channel = outbuf[start]; start++; if (channel == IPMI_BMC_CHANNEL) { struct ipmi_system_interface_addr *si = (void *) &addr; if ((pos-start) < 1) { fprintf(stderr, "No LUN specified\n"); return -1; } si->lun = outbuf[start]; start++; msg.netfn = outbuf[start]; start++; si->addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; si->channel = IPMI_BMC_CHANNEL; addr_len = sizeof(*si); } else if (lan_addr) { struct ipmi_lan_addr *lan = (void *) &addr; if ((pos-start) < 3) { fprintf(stderr, "No LAN address specified\n"); return -1; } lan->addr_type = IPMI_LAN_ADDR_TYPE; lan->channel = channel; lan->session_handle = outbuf[start]; start++; lan->remote_SWID = outbuf[start]; start++; lan->local_SWID = outbuf[start]; start++; lan->lun = outbuf[start]; start++; msg.netfn = outbuf[start]; start++; addr_len = sizeof(*lan); } else { struct ipmi_ipmb_addr *ipmb = (void *) &addr; if ((pos-start) < 2) { fprintf(stderr, "No IPMB address specified\n"); return -1; } if (outbuf[start] == 0) { ipmb->addr_type = IPMI_IPMB_BROADCAST_ADDR_TYPE; start++; } else { ipmb->addr_type = IPMI_IPMB_ADDR_TYPE; } ipmb->slave_addr = outbuf[start]; start++; ipmb->channel = channel; ipmb->lun = outbuf[start]; start++; msg.netfn = outbuf[start]; start++; addr_len = sizeof(*ipmb); } if (msg.netfn & 1) { if ((pos-start) < 1) { fprintf(stderr, "No sequence for response\n"); return -1; } seq = outbuf[start]; start++; } if ((pos-start) < 1) { fprintf(stderr, "Message too short\n"); return -1; } msg.cmd = outbuf[start]; start++; msg.data = &(outbuf[start]); msg.data_len = pos-start; if (time_count) { time_msgs(con, &msg, &addr, addr_len, time_count); rv = 0; } else { if (msg.netfn & 1) rv = con->send_response(con, &addr, addr_len, &msg, seq); else rv = con->send_command(con, &addr, addr_len, &msg, rsp_handler, NULL); if (rv) { fprintf(stderr, "Error sending command: %x\n", rv); } } return(rv); } static char input_line[256]; static int pos = 0; static void user_input_ready(int fd, void *data) { int count = read(0, input_line+pos, 255-pos); int i, j; if (count < 0) { perror("input read"); con->close_connection(con); leave(1); } if (count == 0) { if (interactive) printf("\n"); con->close_connection(con); continue_operation = 0; return; } for (i=0; count > 0; i++, count--) { if ((input_line[pos] == '\n') || (input_line[pos] == '\r')) { input_line[pos] = '\0'; process_input_line(input_line); for (j=0; j "); fflush(stdout); } else { pos++; } } if (pos >= 255) { fprintf(stderr, "Input line too long\n"); pos = 0; if (interactive) printf("=> "); fflush(stdout); } } char *cmdstr; static void con_changed_handler(ipmi_con_t *ipmi, int err, unsigned int port_num, int still_connected, void *cb_data) { if (!interactive) { if (err) { fprintf(stderr, "Unable to setup connection: %x\n", err); leave(1); } if (!interactive_done) { interactive_done = 1; if (process_input_line(cmdstr)) continue_operation = 0; } } else { if (err) fprintf(stderr, "Connection failed to port %d: %x\n", port_num, err); else fprintf(stderr, "Connection up to port %d\n", port_num); if (!still_connected) fprintf(stderr, "All connection to the BMC are down\n"); } } int main(int argc, char *argv[]) { int rv; int pos; int curr_arg; ipmi_args_t *args; int i; progname = argv[0]; /* Have to initalize this first so the usage help will work, since it needs OpenIPMI initialized. */ /* OS handler allocated first. */ os_hnd = ipmi_posix_get_os_handler(); if (!os_hnd) { fprintf(stderr, "ipmi_smi_setup_con: Unable to allocate os handler\n"); exit(1); } /* Create selector with os handler. */ sel_alloc_selector(os_hnd, &sel); /* The OS handler has to know about the selector. */ ipmi_posix_os_handler_set_sel(os_hnd, sel); /* Initialize the OEM handlers. */ rv = ipmi_init(os_hnd); if (rv) { fprintf(stderr, "Error initializing connections: 0x%x\n", rv); exit(1); } for (i=1; i= argc) { usage(); exit(1); } cmdstr = argv[i]; interactive = 0; } else if ((strcmp(argv[i], "-v") == 0) || (strcmp(argv[i], "--version") == 0)) { printInfo(); exit(0); } else { usage(); exit(1); } } if (i >= argc) { fprintf(stderr, "Not enough arguments\n"); exit(1); } curr_arg = i; if (strcmp(argv[0], "ipmicmd") == 0) /* Backwards compatible interface */ rv = ipmi_parse_args(&curr_arg, argc, argv, &args); else rv = ipmi_parse_args2(&curr_arg, argc, argv, &args); if (rv) { fprintf(stderr, "Error parsing command arguments, argument %d: %s\n", curr_arg, strerror(rv)); exit(1); } rv = ipmi_args_setup_con(args, os_hnd, sel, &con); if (rv) { fprintf(stderr, "ipmi_ip_setup_con: %s\n", strerror(rv)); exit(1); } if (interactive) { rv = con->add_event_handler(con, event_handler, NULL); if (rv) { fprintf(stderr, "Could not set to get events: %x\n", rv); } sel_set_fd_handlers(sel, 0, NULL, user_input_ready, NULL, NULL, NULL); sel_set_fd_read_handler(sel, 0, SEL_FD_HANDLER_ENABLED); } con->add_con_change_handler(con, con_changed_handler, NULL); rv = con->start_con(con); if (rv) { fprintf(stderr, "Could not start connection: %x\n", rv); exit(1); } pos = 0; if (interactive) printf("=> "); fflush(stdout); while (continue_operation) { rv = os_hnd->perform_one_op(os_hnd, NULL); if (rv) break; } leave(rv); return rv; } openipmi-2.0.18/sample/waiter_sample.c0000644000175000017500000002505111061036474016664 0ustar chuckchuck/* * waiter_sample.c * * OpenIPMI test code how to use OS handler waiters for blocking code. * * Author: Corey Minyard * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* This sample application demostrates some general handling of sensors, like reading values, setting up events, and things of that nature. It also demonstrates some good coding practices like refcounting structures. */ static const char *progname; #define MAX_SENSORS 128 struct waiter_data { os_handler_waiter_t *waiter; int err; ipmi_sensor_id_t sensors[MAX_SENSORS]; int sensors_type[MAX_SENSORS]; unsigned int num_sensors; unsigned int curr; /* values from a threshold sensor. */ enum ipmi_value_present_e value_present; unsigned int raw_value; double val; /* values from a discrete and a threshold sensor */ ipmi_states_t *states; }; void setup_done(ipmi_domain_t *domain, int err, unsigned int conn_num, unsigned int port_num, int still_connected, void *cb_data) { struct waiter_data *wd = cb_data; if (err) { wd->err = err; os_handler_waiter_release(wd->waiter); } } void fully_up(ipmi_domain_t *domain, void *cb_data) { struct waiter_data *wd = cb_data; wd->err = 0; os_handler_waiter_release(wd->waiter); } void sensor_handler(ipmi_entity_t *entity, ipmi_sensor_t *sensor, void *cb_data) { struct waiter_data *wd = cb_data; if (wd->num_sensors >= MAX_SENSORS) return; wd->sensors[wd->num_sensors] = ipmi_sensor_convert_to_id(sensor); wd->sensors_type[wd->num_sensors] = ipmi_sensor_get_event_reading_type(sensor); wd->num_sensors++; } void entity_iterate_sensors(ipmi_entity_t *entity, void *cb_data) { ipmi_entity_iterate_sensors(entity, sensor_handler, cb_data); } void domain_iterate_entities(ipmi_domain_t *domain, void *cb_data) { ipmi_domain_iterate_entities(domain, entity_iterate_sensors, cb_data); } void close_done(void *cb_data) { struct waiter_data *wd = cb_data; os_handler_waiter_release(wd->waiter); } void domain_close(ipmi_domain_t *domain, void *cb_data) { struct waiter_data *wd = cb_data; wd->err = ipmi_domain_close(domain, close_done, cb_data); if (wd->err) os_handler_waiter_release(wd->waiter); } static void handle_sensor_reading(ipmi_sensor_t *sensor, int err, enum ipmi_value_present_e value_present, unsigned int raw_value, double val, ipmi_states_t *states, void *cb_data) { struct waiter_data *wd = cb_data; enum ipmi_thresh_e thresh; char name[IPMI_SENSOR_NAME_LEN]; ipmi_sensor_get_name(sensor, name, sizeof(name)); if (err) { printf("Error 0x%x getting discrete states for sensor %s\n", err, name); goto out; } printf("Got threshold reading for sensor %s\n", name); if (ipmi_is_event_messages_enabled(states)) printf(" event messages enabled\n"); if (ipmi_is_sensor_scanning_enabled(states)) printf(" sensor scanning enabled\n"); if (ipmi_is_initial_update_in_progress(states)) printf(" initial update in progress\n"); switch (value_present) { case IPMI_NO_VALUES_PRESENT: printf(" no value present\n"); break; case IPMI_BOTH_VALUES_PRESENT: { const char *percent = ""; const char *base; const char *mod_use = ""; const char *modifier = ""; const char *rate; base = ipmi_sensor_get_base_unit_string(sensor); if (ipmi_sensor_get_percentage(sensor)) percent = "%"; switch (ipmi_sensor_get_modifier_unit_use(sensor)) { case IPMI_MODIFIER_UNIT_NONE: break; case IPMI_MODIFIER_UNIT_BASE_DIV_MOD: mod_use = "/"; modifier = ipmi_sensor_get_modifier_unit_string(sensor); break; case IPMI_MODIFIER_UNIT_BASE_MULT_MOD: mod_use = "*"; modifier = ipmi_sensor_get_modifier_unit_string(sensor); break; } rate = ipmi_sensor_get_rate_unit_string(sensor); printf(" value: %lf%s %s%s%s%s\n", val, percent, base, mod_use, modifier, rate); } /* FALLTHROUGH */ case IPMI_RAW_VALUE_PRESENT: printf(" raw value: 0x%2.2x\n", raw_value); } if (ipmi_sensor_get_threshold_access(sensor) == IPMI_THRESHOLD_ACCESS_SUPPORT_NONE) goto out; for (thresh=IPMI_LOWER_NON_CRITICAL; thresh<=IPMI_UPPER_NON_RECOVERABLE; thresh++) { int val, rv; rv = ipmi_sensor_threshold_reading_supported(sensor, thresh, &val); if (rv || !val) continue; if (ipmi_is_threshold_out_of_range(states, thresh)) printf(" Threshold %s is out of range\n", ipmi_get_threshold_string(thresh)); else printf(" Threshold %s is in range\n", ipmi_get_threshold_string(thresh)); } out: os_handler_waiter_release(wd->waiter); } static void handle_sensor_states(ipmi_sensor_t *sensor, int err, ipmi_states_t *states, void *cb_data) { struct waiter_data *wd = cb_data; int i; char name[IPMI_SENSOR_NAME_LEN]; ipmi_sensor_get_name(sensor, name, sizeof(name)); if (err) { printf("Error 0x%x getting discrete states for sensor %s\n", err, name); goto out; } printf("Got state reading for sensor %s\n", name); if (ipmi_is_event_messages_enabled(states)) printf(" event messages enabled\n"); if (ipmi_is_sensor_scanning_enabled(states)) printf(" sensor scanning enabled\n"); if (ipmi_is_initial_update_in_progress(states)) printf(" initial update in progress\n"); for (i=0; i<15; i++) { int val, rv; rv = ipmi_sensor_discrete_event_readable(sensor, i, &val); if (rv || !val) continue; printf(" state %d value is %d\n", i, ipmi_is_state_set(states, i)); } out: os_handler_waiter_release(wd->waiter); } int main(int argc, char *argv[]) { int rv; int curr_arg = 1; ipmi_args_t *args; ipmi_con_t *con; os_handler_waiter_factory_t *waiterf; os_handler_t *os_hnd; char ebuf[128]; ipmi_domain_id_t domain_id; /* * We can do this without dynamic allocation because this function will * never be exited until the progran is done. */ struct waiter_data waiter_space; struct waiter_data *wd = &waiter_space; progname = argv[0]; /* OS handler allocated first. */ os_hnd = ipmi_posix_setup_os_handler(); if (!os_hnd) { printf("ipmi_smi_setup_con: Unable to allocate os handler\n"); exit(1); } /* Use the default log handler. */ /* Initialize the OpenIPMI library. */ ipmi_init(os_hnd); rv = ipmi_parse_args2(&curr_arg, argc, argv, &args); if (rv) { fprintf(stderr, "Error parsing command arguments, argument %d: %s\n", curr_arg, ipmi_get_error_string(rv, ebuf, sizeof(ebuf))); exit(1); } rv = ipmi_args_setup_con(args, os_hnd, NULL, &con); if (rv) { fprintf(stderr, "ipmi_ip_setup_con: %s", ipmi_get_error_string(rv, ebuf, sizeof(ebuf))); exit(1); } rv = os_handler_alloc_waiter_factory(os_hnd, 0, 0, &waiterf); if (rv) { fprintf(stderr, "os_handler_alloc_waiter_factory: %s", ipmi_get_error_string(rv, ebuf, sizeof(ebuf))); exit(1); } wd->num_sensors = 0; wd->waiter = os_handler_alloc_waiter(waiterf); if (!wd->waiter) { fprintf(stderr, "os_handler_alloc_waiter: Out of memory"); exit(1); } rv = ipmi_open_domain("", &con, 1, setup_done, wd, fully_up, wd, NULL, 0, &domain_id); if (rv) { fprintf(stderr, "ipmi_init_domain: %s\n", ipmi_get_error_string(rv, ebuf, sizeof(ebuf))); exit(1); } os_handler_waiter_wait(wd->waiter, NULL); if (wd->err) { fprintf(stderr, "Error starting connection: %s\n", ipmi_get_error_string(wd->err, ebuf, sizeof(ebuf))); } /* * At this point the domain is fully up. We can iterate the * sensors now. First get a list of all sensor ids. */ ipmi_domain_pointer_cb(domain_id, domain_iterate_entities, wd); /* * Now scan the sensors */ for (wd->curr = 0; wd->curr < wd->num_sensors; wd->curr++) { os_handler_waiter_use(wd->waiter); if (wd->sensors_type[wd->curr] == IPMI_EVENT_READING_TYPE_THRESHOLD) rv = ipmi_sensor_id_get_reading(wd->sensors[wd->curr], handle_sensor_reading, wd); else rv = ipmi_sensor_id_get_states(wd->sensors[wd->curr], handle_sensor_states, wd); if (rv) { fprintf(stderr, "Error reading sensor: %s\n", ipmi_get_error_string(rv, ebuf, sizeof(ebuf))); continue; } os_handler_waiter_wait(wd->waiter, NULL); } wd->err = 0; os_handler_waiter_use(wd->waiter); rv = ipmi_domain_pointer_cb(domain_id, domain_close, wd); if (rv) { fprintf(stderr, "close ptr cb: %s\n", ipmi_get_error_string(rv, ebuf, sizeof(ebuf))); exit(1); } os_handler_waiter_wait(wd->waiter, NULL); if (wd->err) { fprintf(stderr, "ipmi_domain_close: %s\n", ipmi_get_error_string(wd->err, ebuf, sizeof(ebuf))); } /* Technically, we can't get here, but this is an example. */ os_hnd->free_os_handler(os_hnd); return 0; } openipmi-2.0.18/sample/example_oem.c0000644000175000017500000013010210576005502016313 0ustar chuckchuck/* * example_oem.c * * Example OEM code * * (C) 2003 MontaVista Software, Inc. All right reserved. * * This code is placed into the public domain, you may use this code * incorporate it into a design, or whatever you want. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include /* These are the identifiers used in the get device id command to identify the various board types. */ #define OEM_MANUFACTURER_ID 0x998877 #define OEM_PRODUCT_ID 0x6655 /* Information common to all sensors. */ typedef struct oem_sensor_header_s { unsigned int assert_events; unsigned int deassert_events; void *data; void (*data_freer)(void *); } oem_sensor_header_t; /* Information common to all controls. */ typedef struct oem_control_header_s { void *data; } oem_control_header_t; /* Various LED settings. */ static ipmi_control_transition_t off_led[] = { {IPMI_CONTROL_COLOR_BLACK, 1 } }; static ipmi_control_transition_t on_blue_led[] = { { IPMI_CONTROL_COLOR_BLUE, 1 } }; static ipmi_control_transition_t blue_led1[] = /* A flashing blue LED. */ { { IPMI_CONTROL_COLOR_BLUE, 500 }, { IPMI_CONTROL_COLOR_BLACK, 500 }, }; /* Setting 0 if off, setting 1 is solid on, setting 2 is flashing. */ static ipmi_control_setting_t blue_blinking_led_set[] = { { 1, off_led }, { 1, on_blue_led }, { 2, blue_led1 }, }; static ipmi_control_light_t blue_blinking_led[] = {{ 3, blue_blinking_led_set }}; typedef struct oem_sens_info_s oem_sens_info_t; typedef void (*oem_states_get_val_cb)(ipmi_sensor_t *sensor, oem_sens_info_t *sens_info, unsigned char *data, ipmi_states_t *states); /* Should return the new error. */ typedef int (*oem_states_err_cb)(ipmi_sensor_t *sensor, oem_sens_info_t *sens_info, int err, unsigned char *data, ipmi_states_t *states); struct oem_sens_info_s { ipmi_sensor_op_info_t sdata; void *sdinfo; oem_states_get_val_cb get_states; oem_states_err_cb err_states; ipmi_states_read_cb done; void *cb_data; }; static oem_sens_info_t * alloc_sens_info(void *sdinfo, ipmi_states_read_cb done, void *cb_data) { oem_sens_info_t *sens_info; sens_info = ipmi_mem_alloc(sizeof(*sens_info)); if (!sens_info) return NULL; memset(sens_info, 0, sizeof(*sens_info)); sens_info->sdinfo = sdinfo; sens_info->done = done; sens_info->cb_data = cb_data; return sens_info; } typedef struct oem_control_info_s oem_control_info_t; typedef int (*oem_control_get_val_cb)(ipmi_control_t *control, oem_control_info_t *control_info, unsigned char *data); struct oem_control_info_s { ipmi_control_op_info_t sdata; unsigned char vals[4]; void *idinfo; ipmi_control_op_cb done_set; ipmi_control_val_cb done_get; oem_control_get_val_cb get_val; ipmi_control_identifier_val_cb get_identifier_val; void *cb_data; }; typedef struct oem_reading_done_s { ipmi_sensor_op_info_t sdata; void *sdinfo; ipmi_reading_done_cb done; void *cb_data; } oem_reading_done_t; /* If registered against an MC, this will be called with each sensor. If you return 1, the sensor will NOT be added to the standard set of sensors for the MC. */ static int oem_new_sensor(ipmi_mc_t *mc, ipmi_entity_t *ent, ipmi_sensor_t *sensor, void *link, void *cb_data) { int lun, num; ipmi_sensor_get_num(sensor, &lun, &num); /* This is where you fix up broken SDR info, and set sensors as hot-swap sensors, and the like. You can also set custom data converters or whatever you like here. */ switch (num) { default: } return 0; } /* The following are various OEM operations that you will need to override (or just use the standard ones */ static int oem_events_enable_set(ipmi_sensor_t *sensor, ipmi_event_state_t *states, ipmi_sensor_done_cb done, void *cb_data) { return ENOTSUP; } static int oem_events_enable_get(ipmi_sensor_t *sensor, ipmi_event_enables_get_cb done, void *cb_data) { ipmi_event_state_t state; oem_sensor_header_t *hdr = ipmi_sensor_get_oem_info(sensor); if (done) { ipmi_event_state_init(&state); ipmi_event_state_set_scanning_enabled(&state, 1); state.__assertion_events = hdr->assert_events; state.__deassertion_events = hdr->deassert_events; done(sensor, 0, &state, cb_data); } return 0; } static int oem_sensor_get_hysteresis(ipmi_sensor_t *sensor, ipmi_hysteresis_get_cb done, void *cb_data) { return ENOSYS; } static int oem_sensor_set_hysteresis(ipmi_sensor_t *sensor, unsigned int positive_hysteresis, unsigned int negative_hysteresis, ipmi_sensor_done_cb done, void *cb_data) { return ENOSYS; } static int oem_thresholds_get(ipmi_sensor_t *sensor, ipmi_thresh_get_cb done, void *cb_data) { ipmi_thresholds_t th; int rv; rv = ipmi_get_default_sensor_thresholds(sensor, 0, &th); if (done) done(sensor, rv, &th, cb_data); return 0; } static int oem_thresholds_set(ipmi_sensor_t *sensor, ipmi_thresholds_t *thresholds, ipmi_sensor_done_cb done, void *cb_data) { return ENOSYS; } static int oem_sensor_get_tolerance(ipmi_sensor_t *sensor, int val, double *tolerance) { return ENOSYS; } static int oem_sensor_get_accuracy(ipmi_sensor_t *sensor, int val, double *accuracy) { return ENOSYS; } /* * The get done operation for most discrete sensors is pretty * standard. We call a function to extract the states from the * message, then call the user's callback. */ static void oem_discrete_sensor_get_done(ipmi_sensor_t *sensor, int err, ipmi_msg_t *rsp, void *cb_data) { oem_sens_info_t *sens_info = cb_data; ipmi_states_t states; ipmi_init_states(&states); ipmi_set_sensor_scanning_enabled(&states, 1); if (err) { /* Check the error handler first, and let it handle the error. */ if (sens_info->err_states) { err = sens_info->err_states(sensor, sens_info, err, rsp->data, &states); if (!err) goto deliver; } if (sens_info->done) sens_info->done(sensor, err, &states, sens_info->cb_data); goto out; } if (rsp->data[0] != 0) { ipmi_log(IPMI_LOG_ERR_INFO, "oem_discrete_sensor_get_done: Received IPMI error: %x", rsp->data[0]); if (sens_info->done) sens_info->done(sensor, IPMI_IPMI_ERR_VAL(rsp->data[0]), &states, sens_info->cb_data); goto out; } sens_info->get_states(sensor, sens_info, rsp->data, &states); deliver: if (sens_info->done) sens_info->done(sensor, 0, &states, sens_info->cb_data); out: ipmi_sensor_opq_done(sensor); ipmi_mem_free(sens_info); } /* Called to free the OEM data we attach to the sensor. */ static void oem_cleanup_sensor_oem_info(ipmi_sensor_t *sensor, void *oem_info) { oem_sensor_header_t *hdr = oem_info; if (hdr) { if (hdr->data_freer) hdr->data_freer(hdr->data); ipmi_mem_free(hdr); } } /* Allocate basic sensor information. The parms are: * data - Generic data for the sensor-specific handling to use. * data_freer() - a function to handle cleaning up data when the * sensor is freed * sensor_type - the IPMI sensor type. * reading_type - the IPMI reading type. * id - The string name for the sensor. * assert_events - The supported assertion event bitmask * deassert_events - The supported deassertion event bitmask */ static int oem_alloc_basic_sensor( void *data, void (*data_freer)(void *), unsigned int sensor_type, unsigned int reading_type, char *id, unsigned int assert_events, unsigned int deassert_events, ipmi_sensor_t **sensor) { int rv; oem_sensor_header_t *hdr; hdr = ipmi_mem_alloc(sizeof(*hdr)); if (!hdr) return ENOMEM; hdr->assert_events = assert_events; hdr->deassert_events = deassert_events; hdr->data = data; hdr->data_freer = data_freer; /* Allocate the sensor. */ rv = ipmi_sensor_alloc_nonstandard(sensor); if (rv) { ipmi_mem_free(hdr); return rv; } /* Fill out a bunch of default values. */ ipmi_sensor_set_oem_info(*sensor, hdr, oem_cleanup_sensor_oem_info); ipmi_sensor_set_entity_instance_logical(*sensor, 0); ipmi_sensor_set_sensor_init_scanning(*sensor, 1); ipmi_sensor_set_sensor_init_events(*sensor, 0); ipmi_sensor_set_sensor_init_thresholds(*sensor, 0); ipmi_sensor_set_sensor_init_hysteresis(*sensor, 0); ipmi_sensor_set_sensor_init_type(*sensor, 1); ipmi_sensor_set_sensor_init_pu_events(*sensor, 0); ipmi_sensor_set_sensor_init_pu_scanning(*sensor, 1); ipmi_sensor_set_ignore_for_presence(*sensor, 1); ipmi_sensor_set_supports_auto_rearm(*sensor, 1); if (assert_events || deassert_events) ipmi_sensor_set_event_support(*sensor, IPMI_EVENT_SUPPORT_GLOBAL_ENABLE); else ipmi_sensor_set_event_support(*sensor, IPMI_EVENT_SUPPORT_NONE); ipmi_sensor_set_sensor_type(*sensor, sensor_type); ipmi_sensor_set_event_reading_type(*sensor, reading_type); ipmi_sensor_set_id(*sensor, id); ipmi_sensor_set_sensor_type_string( *sensor, ipmi_get_sensor_type_string(sensor_type)); ipmi_sensor_set_event_reading_type_string( *sensor, ipmi_get_event_reading_type_string(reading_type)); return rv; } /* * Finish the sensor handling, basically add it to the MC and entity. */ static int oem_finish_sensor(ipmi_mc_t *mc, ipmi_sensor_t *sensor, unsigned int num, ipmi_entity_t *entity) { int rv; /* Add it to the MC and entity. */ rv = ipmi_sensor_add_nonstandard(mc, sensor, num, entity, NULL, NULL); if (rv) { void *hdr; hdr = ipmi_sensor_get_oem_info(sensor); ipmi_sensor_destroy(sensor); ipmi_mem_free(hdr); } return rv; } /* * Allocate discrete sensor information. The first are the same as for the * basic sensor above. The other parms are: * states_get - A function that gets the current states. * sensor_reading_name_string - A function to get the reading type * string. This may be NULL and the standard one will be * used. */ static int oem_alloc_discrete_sensor( ipmi_mc_t *mc, ipmi_entity_t *entity, unsigned int num, void *data, void (*data_freer)(void *), unsigned int sensor_type, unsigned int reading_type, char *id, unsigned int assert_events, unsigned int deassert_events, ipmi_states_get_cb states_get, ipmi_sensor_reading_name_string_cb sensor_reading_name_string, ipmi_sensor_t **sensor) { int rv; ipmi_sensor_cbs_t cbs; int i; rv = oem_alloc_basic_sensor(data, data_freer, sensor_type, reading_type, id, assert_events, deassert_events, sensor); if (rv) return rv; /* If the event can be asserted or deasserted, assume it can be returned and generates an event both ways. */ for (i=0; i<=14; i++) { int aval = assert_events & 1; int dval = deassert_events & 1; ipmi_sensor_set_discrete_assertion_event_supported(*sensor, i, aval); ipmi_sensor_set_discrete_deassertion_event_supported(*sensor, i, dval); ipmi_sensor_discrete_set_event_readable(*sensor, i, aval | dval); assert_events >>= 1; deassert_events >>= 1; } /* Create all the callbacks in the data structure. */ memset(&cbs, 0, sizeof(cbs)); cbs.ipmi_sensor_events_enable_set = oem_events_enable_set; cbs.ipmi_sensor_events_enable_get = oem_events_enable_get; cbs.ipmi_states_get = states_get; /* If ths user supply a function to get the name strings, use it. Otherwise use the standard one. */ if (sensor_reading_name_string) cbs.ipmi_sensor_reading_name_string = sensor_reading_name_string; else cbs.ipmi_sensor_reading_name_string = ipmi_standard_sensor_cb.ipmi_sensor_reading_name_string; ipmi_sensor_set_callbacks(*sensor, &cbs); rv = oem_finish_sensor(mc, *sensor, num, entity); return rv; } /* * Allocate a semi-standard threshold sensor information. Semi-standard * means that it can use standard conversion formulas, is linear, and * is a more "normal" sensor. The first parmse are the same as for the * basic sensor above. The other parms are: * reading_get - A function that gets the current reading. * raw_nominal - the raw (0-255) value for the nominal reading. * raw_normal_max - the raw value for the max value inside the * threshold. * raw_normal_max - the raw value for the min value inside the * threshold. * m, b, b_exp, r_exp - The sensor conversion values. */ static int oem_alloc_semi_stand_threshold_sensor( ipmi_mc_t *mc, ipmi_entity_t *entity, unsigned int num, void *data, void (*data_freer)(void *), unsigned int sensor_type, unsigned int base_unit, char *id, unsigned int assert_events, unsigned int deassert_events, ipmi_reading_get_cb reading_get, int raw_nominal, /* -1 disables. */ int raw_normal_min, /* -1 disables. */ int raw_normal_max, /* -1 disables. */ int m, int b, int b_exp, int r_exp, ipmi_sensor_t **sensor) { int rv; ipmi_sensor_cbs_t cbs; int i; enum ipmi_thresh_e thresh; rv = oem_alloc_basic_sensor(data, data_freer, sensor_type, IPMI_EVENT_READING_TYPE_THRESHOLD, id, assert_events, deassert_events, sensor); if (rv) return rv; ipmi_sensor_set_rate_unit_string(*sensor, ipmi_get_rate_unit_string(0)); ipmi_sensor_set_base_unit_string(*sensor, ipmi_get_unit_type_string(base_unit)); ipmi_sensor_set_modifier_unit_string(*sensor, ipmi_get_unit_type_string(0)); ipmi_sensor_set_hysteresis_support(*sensor, 0); ipmi_sensor_set_threshold_access(*sensor, 0); ipmi_sensor_set_analog_data_format(*sensor, IPMI_ANALOG_DATA_FORMAT_UNSIGNED); ipmi_sensor_set_rate_unit(*sensor, 0); ipmi_sensor_set_modifier_unit_use(*sensor, 0); ipmi_sensor_set_percentage(*sensor, 0); ipmi_sensor_set_base_unit(*sensor, base_unit); ipmi_sensor_set_modifier_unit(*sensor, 0); ipmi_sensor_set_linearization(*sensor, 0); if (raw_normal_min >= 0) { ipmi_sensor_set_raw_normal_min(*sensor, raw_normal_min); ipmi_sensor_set_normal_min_specified(*sensor, 1); } else { ipmi_sensor_set_raw_normal_min(*sensor, 0); ipmi_sensor_set_normal_min_specified(*sensor, 0); } if (raw_normal_max >= 0) { ipmi_sensor_set_raw_normal_max(*sensor, raw_normal_max); ipmi_sensor_set_normal_max_specified(*sensor, 1); } else { ipmi_sensor_set_raw_normal_max(*sensor, 0); ipmi_sensor_set_normal_max_specified(*sensor, 0); } if (raw_nominal >= 0) { ipmi_sensor_set_raw_nominal_reading(*sensor, raw_nominal); ipmi_sensor_set_nominal_reading_specified(*sensor, 1); } else { ipmi_sensor_set_raw_nominal_reading(*sensor, 0); ipmi_sensor_set_nominal_reading_specified(*sensor, 0); } ipmi_sensor_set_raw_sensor_max(*sensor, 0xff); ipmi_sensor_set_raw_sensor_min(*sensor, 0); ipmi_sensor_set_raw_upper_non_recoverable_threshold(*sensor, 0); ipmi_sensor_set_raw_upper_critical_threshold(*sensor, 0); ipmi_sensor_set_raw_upper_non_critical_threshold(*sensor, 0); ipmi_sensor_set_raw_lower_non_recoverable_threshold(*sensor, 0); ipmi_sensor_set_raw_lower_critical_threshold(*sensor, 0); ipmi_sensor_set_raw_lower_non_critical_threshold(*sensor, 0); ipmi_sensor_set_positive_going_threshold_hysteresis(*sensor, 0); ipmi_sensor_set_negative_going_threshold_hysteresis(*sensor, 0); for (thresh = IPMI_LOWER_NON_CRITICAL; thresh <= IPMI_UPPER_NON_RECOVERABLE; thresh++) { if ((1 << ((thresh*2) + IPMI_GOING_LOW)) & assert_events) ipmi_sensor_set_threshold_assertion_event_supported (*sensor, thresh, IPMI_GOING_LOW, 1); if ((1 << ((thresh*2) + IPMI_GOING_HIGH)) & assert_events) ipmi_sensor_set_threshold_assertion_event_supported (*sensor, thresh, IPMI_GOING_HIGH, 1); if ((1 << ((thresh*2) + IPMI_GOING_LOW)) & deassert_events) ipmi_sensor_set_threshold_deassertion_event_supported (*sensor, thresh, IPMI_GOING_LOW, 1); if ((1 << ((thresh*2) + IPMI_GOING_HIGH)) & deassert_events) ipmi_sensor_set_threshold_deassertion_event_supported (*sensor, thresh, IPMI_GOING_HIGH, 1); /* No thresholds are readable, they are all fixed. */ ipmi_sensor_threshold_set_readable(*sensor, thresh, 0); ipmi_sensor_threshold_set_settable(*sensor, thresh, 0); } for (i=0; i<256; i++) { ipmi_sensor_set_raw_m(*sensor, i, m); ipmi_sensor_set_raw_b(*sensor, i, b); ipmi_sensor_set_raw_b_exp(*sensor, i, b_exp); ipmi_sensor_set_raw_r_exp(*sensor, i, r_exp); ipmi_sensor_set_raw_accuracy(*sensor, i, m); ipmi_sensor_set_raw_accuracy_exp(*sensor, i, r_exp); } /* Create all the callbacks in the data structure. */ memset(&cbs, 0, sizeof(cbs)); cbs.ipmi_sensor_events_enable_set = oem_events_enable_set; cbs.ipmi_sensor_events_enable_get = oem_events_enable_get; cbs.ipmi_sensor_convert_from_raw = ipmi_standard_sensor_cb.ipmi_sensor_convert_from_raw; cbs.ipmi_sensor_convert_to_raw = ipmi_standard_sensor_cb.ipmi_sensor_convert_to_raw; cbs.ipmi_sensor_get_accuracy = oem_sensor_get_accuracy; cbs.ipmi_sensor_get_tolerance = oem_sensor_get_tolerance; cbs.ipmi_sensor_get_hysteresis = oem_sensor_get_hysteresis; cbs.ipmi_sensor_set_hysteresis = oem_sensor_set_hysteresis; cbs.ipmi_thresholds_set = oem_thresholds_set; cbs.ipmi_thresholds_get = oem_thresholds_get; cbs.ipmi_reading_get = reading_get; ipmi_sensor_set_callbacks(*sensor, &cbs); rv = oem_finish_sensor(mc, *sensor, num, entity); return rv; } /* * This is used for controls, the handling for the set_done is common * for controls, so just do it in one place. */ static void oem_control_set_done(ipmi_control_t *control, int err, ipmi_msg_t *rsp, void *cb_data) { oem_control_info_t *control_info = cb_data; if (err) { if (control_info->done_set) control_info->done_set(control, err, control_info->cb_data); goto out; } if (rsp->data[0] != 0) { ipmi_log(IPMI_LOG_ERR_INFO, "oem_control_set_done: Received IPMI error: %x", rsp->data[0]); if (control_info->done_set) control_info->done_set(control, IPMI_IPMI_ERR_VAL(rsp->data[0]), control_info->cb_data); goto out; } if (control_info->done_set) control_info->done_set(control, 0, control_info->cb_data); out: ipmi_control_opq_done(control); ipmi_mem_free(control_info); } /* * This is used for controls, the handling for the get_done is usually * common for controls, so just do it in one place. Note that this * only handles controls with one value, multi-valued controls need * their own custom handler. */ static void oem_control_get_done(ipmi_control_t *control, int err, ipmi_msg_t *rsp, void *cb_data) { oem_control_info_t *control_info = cb_data; int val; if (err) { if (control_info->done_get) control_info->done_get(control, err, 0, control_info->cb_data); goto out; } if (rsp->data[0] != 0) { ipmi_log(IPMI_LOG_ERR_INFO, "oem_control_get_done: Received IPMI error: %x", rsp->data[0]); if (control_info->done_get) control_info->done_get(control, IPMI_IPMI_ERR_VAL(rsp->data[0]), NULL, control_info->cb_data); goto out; } val = control_info->get_val(control, control_info, rsp->data); if (control_info->done_get) control_info->done_get(control, 0, &val, control_info->cb_data); out: ipmi_control_opq_done(control); ipmi_mem_free(control_info); } /* Called to free the OEM data we attach to the control. */ static void oem_cleanup_control_oem_info(ipmi_control_t *control, void *oem_info) { oem_sensor_header_t *hdr = oem_info; if (hdr) { ipmi_mem_free(hdr); } } /* * Allocate a control. The parms are: * mc - The MC the control sits on. * entity - The entity the control belongs to. * num - The number of the control in the MC. This must be unique * for the given MC. * data - generic data for the specific control. * control_type - The type of control (from ipmiif.h). * id - The string name of the control. * set_val - The function to set the value of the control. * get_val - The function to get the current value of the control. */ static int oem_alloc_control(ipmi_mc_t *mc, ipmi_entity_t *entity, unsigned int num, void *data, unsigned int control_type, char *id, ipmi_control_set_val_cb set_val, ipmi_control_get_val_cb get_val, ipmi_control_t **control) { int rv; ipmi_control_cbs_t cbs; oem_control_header_t *hdr; hdr = ipmi_mem_alloc(sizeof(*hdr)); if (!hdr) return ENOMEM; hdr->data = data; /* Allocate the sensor. */ rv = ipmi_control_alloc_nonstandard(control); if (rv) { ipmi_mem_free(hdr); return rv; } /* Fill out default values. */ ipmi_control_set_oem_info(*control, hdr, oem_cleanup_control_oem_info); ipmi_control_set_type(*control, control_type); ipmi_control_set_id(*control, id); ipmi_control_set_ignore_for_presence(*control, 1); /* Assume we can read and set the value. */ ipmi_control_set_settable(*control, 1); ipmi_control_set_readable(*control, 1); /* Create all the callbacks in the data structure. */ memset(&cbs, 0, sizeof(cbs)); cbs.set_val = set_val; cbs.get_val = get_val; ipmi_control_set_callbacks(*control, &cbs); /* Add it to the MC and entity. */ rv = ipmi_control_add_nonstandard(mc, *control, num, entity, NULL, NULL); if (rv) { ipmi_control_destroy(*control); ipmi_mem_free(hdr); *control = NULL; } return rv; } typedef struct oem_info_s { int dummy; /* No OEM info for now. */ } oem_info_t; /* These are the sensor numbers for our board. */ #define OEM_SLOT_SENSOR_NUM 0 /* These are the control numbers for our board. */ #define OEM_BOARD_RESET_NUM 0 #define OEM_BOARD_BLUE_LED_NUM 1 /* These are the message definitions for doing some OEM operations on a board. */ #define OEM_NETFN_OEM1 0x30 #define OEM_SET_SLOT_RESET_CMD 1 #define OEM_GET_SLOT_EJECT_CMD 2 #define OEM_SET_BLUE_LED_CMD 3 #define OEM_GET_BLUE_LED_CMD 4 /* * Some events are system-specific, and need special handling. The * following is an example, because we have a special sensor for the * ejector handle, we need to handle it's events, too. */ /* Structure passed around to handle events. */ typedef struct mc_event_info_s { oem_info_t *info; ipmi_mc_t *mc; ipmi_event_t *event; ipmi_event_t event_copy; int handled; } mc_event_info_t; static void oem_board_ejector_changed_event(ipmi_sensor_t *sensor, void *cb_data) { mc_event_info_t *einfo = cb_data; ipmi_sensor_discrete_event_handler_cb handler; void *h_cb_data; enum ipmi_event_dir_e assertion; ipmi_event_t *event = &(einfo->event_copy); if (event->data[9] & 0x80) assertion = IPMI_DEASSERTION; else assertion = IPMI_ASSERTION; ipmi_sensor_discrete_get_event_handler(sensor, &handler, &h_cb_data); if (handler) { handler(sensor, assertion, 6, /* Offset 6 is the ejector offset. */ -1, -1, h_cb_data, einfo->event); einfo->event = NULL; } } static int oem_event_handler(ipmi_mc_t *mc, ipmi_event_t *event, void *cb_data) { int rv; ipmi_sensor_id_t id; mc_event_info_t einfo; unsigned long timestamp; ipmi_mc_id_t mc_id; ipmi_mc_t *bmc = ipmi_mc_get_bmc(mc); if ((event->type != 2) && (event->type != 3)) /* Not a system event record or OEM event. */ return 0; if (event->data[6] != 3) /* Not a 1.5 event version */ return 0; timestamp = ipmi_get_uint32(&(event->data[0])); if (timestamp < ipmi_bmc_get_startup_SEL_time(bmc)) /* It's an old event, ignore it. */ return 0; einfo.info = ipmi_mc_get_oem_data(mc); einfo.mc = mc; einfo.event = event; memcpy(&einfo.event_copy, event, sizeof(einfo.event_copy)); einfo.handled = 0; /* We have to do a sensor callback so we hold the sensor lock when we operate on it. */ mc_id = ipmi_mc_convert_to_id(mc); id.bmc = mc_id.bmc; id.channel = mc_id.channel; id.mc_num = mc_id.mc_num; id.lun = 4; switch (event->data[8]) { case 1: id.sensor_num = OEM_SLOT_SENSOR_NUM; rv = ipmi_sensor_pointer_cb(id, oem_board_ejector_changed_event, &einfo); break; } /* If the event was handled but not delivered to the user, then deliver it to the unhandled handler. */ if (einfo.handled && (einfo.event != NULL)) ipmi_handle_unhandled_event(bmc, event); return einfo.handled; } /* Start a reset operation for the board. */ static void board_reset_set_start(ipmi_control_t *control, int err, void *cb_data) { oem_control_info_t *control_info = cb_data; int rv; ipmi_msg_t msg; unsigned char data[4]; if (err) { if (control_info->done_set) control_info->done_set(control, err, control_info->cb_data); ipmi_control_opq_done(control); ipmi_mem_free(control_info); return; } msg.netfn = OEM_NETFN_OEM1; msg.cmd = OEM_SET_SLOT_RESET_CMD; msg.data_len = 1; msg.data = data; data[0] = control_info->vals[0]; rv = ipmi_control_send_command(control, ipmi_control_get_mc(control), 0, &msg, oem_control_set_done, &(control_info->sdata), control_info); if (rv) { if (control_info->done_set) control_info->done_set(control, rv, control_info->cb_data); ipmi_control_opq_done(control); ipmi_mem_free(control_info); } } /* * This is the startup operation for setting the board's reset value. */ static int board_reset_set(ipmi_control_t *control, int *val, ipmi_control_op_cb handler, void *cb_data) { oem_control_info_t *control_info; int rv; control_info = ipmi_mem_alloc(sizeof(*control_info)); if (!control_info) return ENOMEM; control_info->done_set = handler; control_info->cb_data = cb_data; control_info->vals[0] = *val; /* We use the control's operation queue to serialize operations to the control. Basically, for each control, only one operation a time is allowed. */ rv = ipmi_control_add_opq(control, board_reset_set_start, &(control_info->sdata), control_info); if (rv) ipmi_mem_free(control_info); return rv; } /* * Get the reset value. This is not supported. */ static int board_reset_get(ipmi_control_t *control, ipmi_control_val_cb handler, void *cb_data) { return ENOSYS; } /* * This is for the board slot sensor, we set the states properly from * the response to the OEM_GET_SLOT_EJECT_CMD we sent earlier. */ static void board_slot_get_cb(ipmi_sensor_t *sensor, oem_sens_info_t *sens_info, unsigned char *data, ipmi_states_t *states) { if (data[1]) ipmi_set_state(states, 6, 1); /* Ejector extraction request */ else ipmi_set_state(states, 6, 0); /* Ejector is closed */ } /* * Actually start the slot get operation, once the opq runs us. This * will send the message to get the ejector handle's current state. */ static void board_slot_get_start(ipmi_sensor_t *sensor, int err, void *cb_data) { oem_sens_info_t *get_info = cb_data; ipmi_msg_t msg; int rv; ipmi_states_t states; ipmi_init_states(&states); ipmi_set_sensor_scanning_enabled(&states, 1); if (err) { if (get_info->done) get_info->done(sensor, err, &states, get_info->cb_data); ipmi_sensor_opq_done(sensor); ipmi_mem_free(get_info); return; } msg.netfn = OEM_NETFN_OEM1; msg.cmd = OEM_GET_SLOT_EJECT_CMD; msg.data_len = 0; msg.data = NULL; rv = ipmi_sensor_send_command(sensor, ipmi_sensor_get_mc(sensor), 0, &msg, oem_discrete_sensor_get_done, &(get_info->sdata), get_info); if (rv) { if (get_info->done) get_info->done(sensor, rv, &states, get_info->cb_data); ipmi_sensor_opq_done(sensor); ipmi_mem_free(get_info); } } /* * Called to get the board's ejector handle state. This will allocate * some info and schedule an operation to happen. */ static int board_slot_get(ipmi_sensor_t *sensor, ipmi_states_read_cb done, void *cb_data) { int rv; oem_sens_info_t *get_info; get_info = alloc_sens_info(NULL, done, cb_data); if (!get_info) return ENOMEM; get_info->get_states = board_slot_get_cb; rv = ipmi_sensor_add_opq(sensor, board_slot_get_start, &(get_info->sdata), get_info); if (rv) ipmi_mem_free(get_info); return rv; } /* * Send the message to set the blue led value. */ static void board_blue_led_set_start(ipmi_control_t *control, int err, void *cb_data) { oem_control_info_t *control_info = cb_data; int rv; ipmi_msg_t msg; unsigned char data[4]; if (err) { if (control_info->done_set) control_info->done_set(control, err, control_info->cb_data); ipmi_control_opq_done(control); ipmi_mem_free(control_info); return; } msg.netfn = OEM_NETFN_OEM1; msg.cmd = OEM_SET_BLUE_LED_CMD; msg.data_len = 1; data[0] = control_info->vals[0]; rv = ipmi_control_send_command(control, ipmi_control_get_mc(control), 0, &msg, oem_control_set_done, &(control_info->sdata), control_info); if (rv) { if (control_info->done_set) control_info->done_set(control, rv, control_info->cb_data); ipmi_control_opq_done(control); ipmi_mem_free(control_info); } } /* * Allocate info an schedule us to set the blue led info. */ static int board_blue_led_set(ipmi_control_t *control, int *val, ipmi_control_op_cb handler, void *cb_data) { oem_control_info_t *control_info; int rv; control_info = ipmi_mem_alloc(sizeof(*control_info)); if (!control_info) return ENOMEM; control_info->done_set = handler; control_info->cb_data = cb_data; control_info->vals[0] = *val; rv = ipmi_control_add_opq(control, board_blue_led_set_start, &(control_info->sdata), control_info); if (rv) ipmi_mem_free(control_info); return rv; } /* * Get the value of the blue led from the response to * OEM_GET_BLUE_LED_CMD. */ static int board_blue_led_get_cb(ipmi_control_t *control, oem_control_info_t *control_info, unsigned char *data) { return data[1]; } /* Start the operation to get the blue LED's value. */ static void board_blue_led_get_start(ipmi_control_t *control, int err, void *cb_data) { oem_control_info_t *control_info = cb_data; int rv; ipmi_msg_t msg; if (err) { if (control_info->done_get) control_info->done_get(control, err, NULL, control_info->cb_data); ipmi_control_opq_done(control); ipmi_mem_free(control_info); return; } msg.netfn = OEM_NETFN_OEM1; msg.cmd = OEM_GET_BLUE_LED_CMD; msg.data_len = 0; msg.data = NULL; rv = ipmi_control_send_command(control, ipmi_control_get_mc(control), 0, &msg, oem_control_get_done, &(control_info->sdata), control_info); if (rv) { if (control_info->done_get) control_info->done_get(control, rv, NULL, control_info->cb_data); ipmi_control_opq_done(control); ipmi_mem_free(control_info); } } /* * Allocate info and schedule an operation to get the blue LED's * value. */ static int board_blue_led_get(ipmi_control_t *control, ipmi_control_val_cb handler, void *cb_data) { oem_control_info_t *control_info; int rv; control_info = ipmi_mem_alloc(sizeof(*control_info)); if (!control_info) return ENOMEM; control_info->done_get = handler; control_info->cb_data = cb_data; control_info->get_val = board_blue_led_get_cb; rv = ipmi_control_add_opq(control, board_blue_led_get_start, &(control_info->sdata), control_info); if (rv) ipmi_mem_free(control_info); return rv; } /* * Allocate new general board sensors for the board. */ static int new_board_sensors(ipmi_mc_t *mc, ipmi_entity_t *ent, oem_info_t *info) { int rv; ipmi_sensor_t *sensor; ipmi_control_t *control; /* The slot sensor */ rv = oem_alloc_discrete_sensor( mc, ent, OEM_SLOT_SENSOR_NUM, info, NULL, IPMI_SENSOR_TYPE_SLOT_CONNECTOR, IPMI_EVENT_READING_TYPE_SENSOR_SPECIFIC, "slot", 0x40, 0x40, /* offset 6 is supported (hot-swap requester). */ board_slot_get, NULL, &sensor); if (rv) goto out_err; ipmi_sensor_set_hot_swap_requester(sensor, 6, 1); /* offset 6 is for hot-swap */ /* Reset control */ rv = oem_alloc_control(mc, ent, OEM_BOARD_RESET_NUM, info, IPMI_CONTROL_RESET, "reset", board_reset_set, board_reset_get, &control); if (rv) goto out_err; ipmi_control_set_num_elements(control, 1); /* The reset control is not readable. */ ipmi_control_set_readable(control, 0); /* Blue LED control */ rv = oem_alloc_control(mc, ent, OEM_BOARD_BLUE_LED_NUM, info, IPMI_CONTROL_LIGHT, "blue led", board_blue_led_set, board_blue_led_get, &control); if (rv) goto out_err; ipmi_control_light_set_lights(control, 1, blue_blinking_led); ipmi_control_set_hot_swap_indicator(control, 1); out_err: return rv; } /* Write some I2C data on an MC. */ static void i2c_write(ipmi_mc_t *mc, unsigned int bus, unsigned int addr, unsigned int offset, unsigned int val) { ipmi_msg_t msg; unsigned char data[5]; int rv; msg.netfn = IPMI_APP_NETFN; msg.cmd = IPMI_MASTER_READ_WRITE_CMD; msg.data_len = 4; msg.data = data; data[0] = bus; data[1] = addr; data[2] = 0; /* Read no bytes */ data[3] = offset; data[4] = val; rv = ipmi_send_command(mc, 0, &msg, NULL, NULL); if (rv) ipmi_log(IPMI_LOG_WARNING, "Could not to I2C write to %x.%x.%x, error %x\n", bus, addr, offset, rv); } typedef struct i2c_sens_s { unsigned int bus; unsigned int addr; unsigned int offset; } i2c_sens_t; /* * Handle data read back from the I2C. Convert it and present it * as the sensor's data. */ static void i2c_sens_reading_cb(ipmi_sensor_t *sensor, int err, ipmi_msg_t *rsp, void *cb_data) { oem_reading_done_t *get_info = cb_data; ipmi_states_t states; unsigned int raw_val; double val; enum ipmi_value_present_e present; int rv; ipmi_init_states(&states); ipmi_set_sensor_scanning_enabled(&states, 1); if (err) { if (get_info->done) get_info->done(sensor, err, IPMI_NO_VALUES_PRESENT, 0, 0.0, &states, get_info->cb_data); ipmi_sensor_opq_done(sensor); ipmi_mem_free(get_info); return; } if (rsp->data[0] != 0) { ipmi_log(IPMI_LOG_ERR_INFO, "i2c_sens_reading_cb: Received IPMI error: %x", rsp->data[0]); if (get_info->done) get_info->done(sensor, IPMI_IPMI_ERR_VAL(rsp->data[0]), IPMI_NO_VALUES_PRESENT, 0, 0.0, &states, get_info->cb_data); goto out; } raw_val = rsp->data[1]; rv = ipmi_sensor_convert_from_raw(sensor, raw_val, &val); if (rv) present = IPMI_RAW_VALUE_PRESENT; else present = IPMI_BOTH_VALUES_PRESENT; if (get_info->done) get_info->done(sensor, 0, present, raw_val, val, &states, get_info->cb_data); out: ipmi_sensor_opq_done(sensor); ipmi_mem_free(get_info); } /* * Send the master read/write command to read a byte from the * I2C bus to be reported as the sensor reading. */ static void i2c_sens_get_reading_start(ipmi_sensor_t *sensor, int err, void *cb_data) { oem_reading_done_t *get_info = cb_data; i2c_sens_t *info = get_info->sdinfo; ipmi_msg_t msg; unsigned char data[4]; int rv; ipmi_states_t states; ipmi_init_states(&states); ipmi_set_sensor_scanning_enabled(&states, 1); if (err) { if (get_info->done) get_info->done(sensor, err, IPMI_NO_VALUES_PRESENT, 0, 0.0, &states, get_info->cb_data); ipmi_sensor_opq_done(sensor); ipmi_mem_free(get_info); return; } msg.netfn = IPMI_APP_NETFN; msg.cmd = IPMI_MASTER_READ_WRITE_CMD; msg.data_len = 4; msg.data = data; data[0] = info->bus; data[1] = info->addr; data[2] = 1; /* Read one byte */ data[3] = info->offset; /* Offset to read from. */ rv = ipmi_sensor_send_command(sensor, ipmi_sensor_get_mc(sensor), 0, &msg, i2c_sens_reading_cb, &(get_info->sdata), get_info); if (rv) { if (get_info->done) get_info->done(sensor, rv, IPMI_NO_VALUES_PRESENT, 0, 0.0, &states, get_info->cb_data); ipmi_sensor_opq_done(sensor); ipmi_mem_free(get_info); } } /* * Allocate some info and schedule an operation to read some data * from I2C to report as the sensor's reading. */ static int i2c_sens_get_reading(ipmi_sensor_t *sensor, ipmi_reading_done_cb done, void *cb_data) { oem_sensor_header_t *hdr = ipmi_sensor_get_oem_info(sensor); i2c_sens_t *info = hdr->data; int rv; oem_reading_done_t *get_info; get_info = ipmi_mem_alloc(sizeof(*get_info)); if (!get_info) return ENOMEM; get_info->sdinfo = info; get_info->done = done; get_info->cb_data = cb_data; rv = ipmi_sensor_add_opq(sensor, i2c_sens_get_reading_start, &(get_info->sdata), get_info); if (rv) ipmi_mem_free(get_info); return rv; } /* * Allocate a sensor for an ADM 1021 temperature sensor. */ static int alloc_adm1021_sensor(ipmi_mc_t *mc, ipmi_entity_t *ent, unsigned int num, unsigned int bus, unsigned int addr, char *id) { int rv; i2c_sens_t *info; ipmi_sensor_t *sensor; info = ipmi_mem_alloc(sizeof(*info)); if (!info) return ENOMEM; info->bus = bus; info->addr = addr; info->offset = 1; /* Offset 1 is the remote temp sens. */ i2c_write(mc, bus, addr, 0xa, 4); /* Do 1 conversion a second. */ i2c_write(mc, bus, addr, 0x9, 0); /* Enable conversion. */ rv = oem_alloc_semi_stand_threshold_sensor(mc, ent, num, info, ipmi_mem_free, IPMI_SENSOR_TYPE_TEMPERATURE, IPMI_UNIT_TYPE_DEGREES_C, id, 0, 0, i2c_sens_get_reading, -1, -1, 105, 1, 0, 0, 0, &sensor); if (rv) { ipmi_mem_free(info); goto out; } ipmi_sensor_set_analog_data_format(sensor, IPMI_ANALOG_DATA_FORMAT_2_COMPL); ipmi_sensor_set_raw_sensor_max(sensor, 0x7f); ipmi_sensor_set_raw_sensor_min(sensor, 0x80); out: return rv; } /* * Called to add the entity to the SDR info. We don't support this. */ static int oem_entity_sdr_add(ipmi_entity_t *ent, ipmi_sdr_info_t *sdrs, void *cb_data) { /* Don't put the entities into an SDR */ return 0; } /* * Called when the MC is removed from the system. */ static void oem_mc_removed(ipmi_mc_t *bmc, ipmi_mc_t *mc, void *cb_data) { free(cb_data); } /* We convert addresses to instances by taking the actual I2C address (the upper 7 bits of the IPMB address) and subtracting 58 from it. Boards start at 0x58, so this makes the instance numbers for boards start at zero. */ static unsigned int oem_addr_to_instance(unsigned int slave_addr) { slave_addr /= 2; if (slave_addr >= 0x58) { if (slave_addr >= 0x61) slave_addr--; return slave_addr - 0x58; } else return slave_addr; } /* * Called when an MC with the matching manufacturer and product id * are detected. */ static int oem_handler(ipmi_mc_t *mc, void *cb_data) { unsigned int slave_addr = ipmi_mc_get_address(mc); ipmi_entity_info_t *ents; ipmi_entity_t *ent; int rv; oem_info_t *info; ipmi_mc_t *bmc = ipmi_mc_get_bmc(mc); info = malloc(sizeof(*info)); if (!info) return ENOMEM; ipmi_mc_entity_lock(bmc); ents = ipmi_mc_get_entities(bmc); rv = ipmi_entity_add(ents, bmc, 0, IPMI_ENTITY_ID_PROCESSING_BLADE, oem_addr_to_instance(slave_addr), "my-name", oem_entity_sdr_add, NULL, &ent); if (rv) { ipmi_log(IPMI_LOG_WARNING, "oem_handler: could not add entity"); goto out; } rv = ipmi_mc_set_oem_new_sensor_handler(mc, oem_new_sensor, info); if (rv) { ipmi_log(IPMI_LOG_WARNING, "oem_handler: could not register new sensor handler"); goto out; } rv = ipmi_mc_set_oem_removed_handler(mc, oem_mc_removed, info); if (rv) { ipmi_log(IPMI_LOG_WARNING, "oem_handler: could not set OEM removal handler"); goto out; } ipmi_mc_set_oem_data(mc, info); rv = new_board_sensors(mc, ent, info); if (rv) goto out; rv = alloc_adm1021_sensor(mc, ent, 0x80, 0x01, 0x9c, "Proc Temp"); if (rv) goto out; rv = ipmi_mc_set_oem_event_handler(mc, oem_event_handler, info); out: ipmi_mc_entity_unlock(bmc); return rv; } /* * The user calls this to set up handling for this OEM MC. This should * be the only non-static function in this file. */ int my_oem_init(void) { int rv; rv = ipmi_register_oem_handler(OEM_MANUFACTURER_ID, OEM_PRODUCT_ID, oem_handler, NULL, NULL); return rv; } openipmi-2.0.18/sample/Makefile.am0000644000175000017500000000425311365671565015736 0ustar chuckchuck AM_CFLAGS = -Wall -Wsign-compare -I$(top_srcdir)/include -DIPMI_CHECK_LOCKS bin_PROGRAMS = openipmicmd solterm rmcp_ping noinst_PROGRAMS = ipmisample ipmisample2 ipmisample3 ipmi_serial_bmc_emu \ ipmi_dump_sensors waiter_sample ipmisample_SOURCES = sample.c ipmisample_LDADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la \ $(OPENSSLLIBS) ipmisample2_SOURCES = sample2.c ipmisample2_LDADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIpthread.la \ -lpthread $(OPENSSLLIBS) ipmisample3_SOURCES = sample3.c ipmisample3_LDADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la \ $(OPENSSLLIBS) waiter_sample_SOURCES = waiter_sample.c waiter_sample_LDADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la \ $(OPENSSLLIBS) ipmi_dump_sensors_SOURCES = dump_sensors.c ipmi_dump_sensors_LDADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la \ $(OPENSSLLIBS) openipmicmd_SOURCES = ipmicmd.c openipmicmd_LDADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la \ $(OPENSSLLIBS) openipmicmd_LDFLAGS = -rdynamic solterm_SOURCES = solterm.c solterm_LDADD = $(POPTLIBS) $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la \ $(OPENSSLLIBS) rmcp_ping_SOURCES = rmcp_ping.c ipmi_serial_bmc_emu_SOURCES = ipmi_serial_bmc_emu.c ipmi_serial_bmc_emu_LDADD = $(top_builddir)/libedit/libedit.a $(TERM_LIBS) ipmi_serial_bmc_emu_CFLAGS = -I $(top_srcdir)/libedit EXTRA_DIST = example_oem.c # We need to make a link from ipmicmd to openipmicmd for backwards # compatability. install-data-local: rm -f $(DESTDIR)$(bindir)/ipmicmd $(LN_S) openipmicmd $(DESTDIR)$(bindir)/ipmicmd uninstall-local: rm -f $(DESTDIR)$(bindir)/ipmicmdopenipmi-2.0.18/sample/Makefile.in0000644000175000017500000006225611367554427015755 0ustar chuckchuck# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = openipmicmd$(EXEEXT) solterm$(EXEEXT) \ rmcp_ping$(EXEEXT) noinst_PROGRAMS = ipmisample$(EXEEXT) ipmisample2$(EXEEXT) \ ipmisample3$(EXEEXT) ipmi_serial_bmc_emu$(EXEEXT) \ ipmi_dump_sensors$(EXEEXT) waiter_sample$(EXEEXT) subdir = sample DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_ipmi_dump_sensors_OBJECTS = dump_sensors.$(OBJEXT) ipmi_dump_sensors_OBJECTS = $(am_ipmi_dump_sensors_OBJECTS) am__DEPENDENCIES_1 = ipmi_dump_sensors_DEPENDENCIES = \ $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la $(am__DEPENDENCIES_1) am_ipmi_serial_bmc_emu_OBJECTS = \ ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.$(OBJEXT) ipmi_serial_bmc_emu_OBJECTS = $(am_ipmi_serial_bmc_emu_OBJECTS) ipmi_serial_bmc_emu_DEPENDENCIES = $(top_builddir)/libedit/libedit.a \ $(am__DEPENDENCIES_1) am_ipmisample_OBJECTS = sample.$(OBJEXT) ipmisample_OBJECTS = $(am_ipmisample_OBJECTS) ipmisample_DEPENDENCIES = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la $(am__DEPENDENCIES_1) am_ipmisample2_OBJECTS = sample2.$(OBJEXT) ipmisample2_OBJECTS = $(am_ipmisample2_OBJECTS) ipmisample2_DEPENDENCIES = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIpthread.la \ $(am__DEPENDENCIES_1) am_ipmisample3_OBJECTS = sample3.$(OBJEXT) ipmisample3_OBJECTS = $(am_ipmisample3_OBJECTS) ipmisample3_DEPENDENCIES = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la $(am__DEPENDENCIES_1) am_openipmicmd_OBJECTS = ipmicmd.$(OBJEXT) openipmicmd_OBJECTS = $(am_openipmicmd_OBJECTS) openipmicmd_DEPENDENCIES = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la $(am__DEPENDENCIES_1) am_rmcp_ping_OBJECTS = rmcp_ping.$(OBJEXT) rmcp_ping_OBJECTS = $(am_rmcp_ping_OBJECTS) rmcp_ping_LDADD = $(LDADD) am_solterm_OBJECTS = solterm.$(OBJEXT) solterm_OBJECTS = $(am_solterm_OBJECTS) solterm_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la $(am__DEPENDENCIES_1) am_waiter_sample_OBJECTS = waiter_sample.$(OBJEXT) waiter_sample_OBJECTS = $(am_waiter_sample_OBJECTS) waiter_sample_DEPENDENCIES = \ $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(ipmi_dump_sensors_SOURCES) $(ipmi_serial_bmc_emu_SOURCES) \ $(ipmisample_SOURCES) $(ipmisample2_SOURCES) \ $(ipmisample3_SOURCES) $(openipmicmd_SOURCES) \ $(rmcp_ping_SOURCES) $(solterm_SOURCES) \ $(waiter_sample_SOURCES) DIST_SOURCES = $(ipmi_dump_sensors_SOURCES) \ $(ipmi_serial_bmc_emu_SOURCES) $(ipmisample_SOURCES) \ $(ipmisample2_SOURCES) $(ipmisample3_SOURCES) \ $(openipmicmd_SOURCES) $(rmcp_ping_SOURCES) $(solterm_SOURCES) \ $(waiter_sample_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BIBTEX = @BIBTEX@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIA = @DIA@ DIA_FILTER_NAME = @DIA_FILTER_NAME@ DSYMUTIL = @DSYMUTIL@ DVIPDF = @DVIPDF@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GDBM_LIB = @GDBM_LIB@ GLIB12_CFLAGS = @GLIB12_CFLAGS@ GLIB12_LIB = @GLIB12_LIB@ GLIB12_LIBS = @GLIB12_LIBS@ GLIB12_PKGCONF = @GLIB12_PKGCONF@ GLIB12_SO = @GLIB12_SO@ GLIB12_TARGET = @GLIB12_TARGET@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_DIR = @GLIB_DIR@ GLIB_LIB = @GLIB_LIB@ GLIB_LIBS = @GLIB_LIBS@ GLIB_PKGCONF = @GLIB_PKGCONF@ GLIB_SINGLE_LIB = @GLIB_SINGLE_LIB@ GLIB_SINGLE_SO = @GLIB_SINGLE_SO@ GLIB_SO = @GLIB_SO@ GLIB_TARGET = @GLIB_TARGET@ GLIB_VERSION = @GLIB_VERSION@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NMEDIT = @NMEDIT@ OBJEXT = @OBJEXT@ OPENIPMI_SMI = @OPENIPMI_SMI@ OPENIPMI_SWIG_LIBS = @OPENIPMI_SWIG_LIBS@ OPENIPMI_SWIG_SO = @OPENIPMI_SWIG_SO@ OPENIPMI_VERSION_EXTRA = @OPENIPMI_VERSION_EXTRA@ OPENIPMI_VERSION_MAJOR = @OPENIPMI_VERSION_MAJOR@ OPENIPMI_VERSION_MINOR = @OPENIPMI_VERSION_MINOR@ OPENIPMI_VERSION_RELEASE = @OPENIPMI_VERSION_RELEASE@ OPENSSLINCS = @OPENSSLINCS@ OPENSSLLIBS = @OPENSSLLIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_DIR = @PERL_DIR@ PERL_HAS_POSIX_THREADS = @PERL_HAS_POSIX_THREADS@ PERL_INSTALL_DIR = @PERL_INSTALL_DIR@ PERL_POSIX_LIB = @PERL_POSIX_LIB@ PERL_POSIX_SO = @PERL_POSIX_SO@ POPTLIBS = @POPTLIBS@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_DIR = @PYTHON_DIR@ PYTHON_GUI_DIR = @PYTHON_GUI_DIR@ PYTHON_HAS_POSIX_THREADS = @PYTHON_HAS_POSIX_THREADS@ PYTHON_INSTALL_DIR = @PYTHON_INSTALL_DIR@ PYTHON_INSTALL_LIB_DIR = @PYTHON_INSTALL_LIB_DIR@ PYTHON_POSIX_LIB = @PYTHON_POSIX_LIB@ PYTHON_POSIX_SO = @PYTHON_POSIX_SO@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNMPLIBS = @SNMPLIBS@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_DIR = @SWIG_DIR@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_DIR = @TCL_DIR@ TCL_LIB = @TCL_LIB@ TCL_LIBS = @TCL_LIBS@ TCL_PKGCONF = @TCL_PKGCONF@ TCL_SO = @TCL_SO@ TCL_TARGET = @TCL_TARGET@ TERM_LIBS = @TERM_LIBS@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ diaprog = @diaprog@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ glibprog = @glibprog@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlprog = @perlprog@ pkgprog = @pkgprog@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pythonprog = @pythonprog@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ swigprog = @swigprog@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ AM_CFLAGS = -Wall -Wsign-compare -I$(top_srcdir)/include -DIPMI_CHECK_LOCKS ipmisample_SOURCES = sample.c ipmisample_LDADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la \ $(OPENSSLLIBS) ipmisample2_SOURCES = sample2.c ipmisample2_LDADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIpthread.la \ -lpthread $(OPENSSLLIBS) ipmisample3_SOURCES = sample3.c ipmisample3_LDADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la \ $(OPENSSLLIBS) waiter_sample_SOURCES = waiter_sample.c waiter_sample_LDADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la \ $(OPENSSLLIBS) ipmi_dump_sensors_SOURCES = dump_sensors.c ipmi_dump_sensors_LDADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la \ $(OPENSSLLIBS) openipmicmd_SOURCES = ipmicmd.c openipmicmd_LDADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la \ $(OPENSSLLIBS) openipmicmd_LDFLAGS = -rdynamic solterm_SOURCES = solterm.c solterm_LDADD = $(POPTLIBS) $(top_builddir)/utils/libOpenIPMIutils.la \ $(top_builddir)/lib/libOpenIPMI.la \ $(top_builddir)/unix/libOpenIPMIposix.la \ $(OPENSSLLIBS) rmcp_ping_SOURCES = rmcp_ping.c ipmi_serial_bmc_emu_SOURCES = ipmi_serial_bmc_emu.c ipmi_serial_bmc_emu_LDADD = $(top_builddir)/libedit/libedit.a $(TERM_LIBS) ipmi_serial_bmc_emu_CFLAGS = -I $(top_srcdir)/libedit EXTRA_DIST = example_oem.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sample/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu sample/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ || test -f $$p1 \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done ipmi_dump_sensors$(EXEEXT): $(ipmi_dump_sensors_OBJECTS) $(ipmi_dump_sensors_DEPENDENCIES) @rm -f ipmi_dump_sensors$(EXEEXT) $(LINK) $(ipmi_dump_sensors_LDFLAGS) $(ipmi_dump_sensors_OBJECTS) $(ipmi_dump_sensors_LDADD) $(LIBS) ipmi_serial_bmc_emu$(EXEEXT): $(ipmi_serial_bmc_emu_OBJECTS) $(ipmi_serial_bmc_emu_DEPENDENCIES) @rm -f ipmi_serial_bmc_emu$(EXEEXT) $(LINK) $(ipmi_serial_bmc_emu_LDFLAGS) $(ipmi_serial_bmc_emu_OBJECTS) $(ipmi_serial_bmc_emu_LDADD) $(LIBS) ipmisample$(EXEEXT): $(ipmisample_OBJECTS) $(ipmisample_DEPENDENCIES) @rm -f ipmisample$(EXEEXT) $(LINK) $(ipmisample_LDFLAGS) $(ipmisample_OBJECTS) $(ipmisample_LDADD) $(LIBS) ipmisample2$(EXEEXT): $(ipmisample2_OBJECTS) $(ipmisample2_DEPENDENCIES) @rm -f ipmisample2$(EXEEXT) $(LINK) $(ipmisample2_LDFLAGS) $(ipmisample2_OBJECTS) $(ipmisample2_LDADD) $(LIBS) ipmisample3$(EXEEXT): $(ipmisample3_OBJECTS) $(ipmisample3_DEPENDENCIES) @rm -f ipmisample3$(EXEEXT) $(LINK) $(ipmisample3_LDFLAGS) $(ipmisample3_OBJECTS) $(ipmisample3_LDADD) $(LIBS) openipmicmd$(EXEEXT): $(openipmicmd_OBJECTS) $(openipmicmd_DEPENDENCIES) @rm -f openipmicmd$(EXEEXT) $(LINK) $(openipmicmd_LDFLAGS) $(openipmicmd_OBJECTS) $(openipmicmd_LDADD) $(LIBS) rmcp_ping$(EXEEXT): $(rmcp_ping_OBJECTS) $(rmcp_ping_DEPENDENCIES) @rm -f rmcp_ping$(EXEEXT) $(LINK) $(rmcp_ping_LDFLAGS) $(rmcp_ping_OBJECTS) $(rmcp_ping_LDADD) $(LIBS) solterm$(EXEEXT): $(solterm_OBJECTS) $(solterm_DEPENDENCIES) @rm -f solterm$(EXEEXT) $(LINK) $(solterm_LDFLAGS) $(solterm_OBJECTS) $(solterm_LDADD) $(LIBS) waiter_sample$(EXEEXT): $(waiter_sample_OBJECTS) $(waiter_sample_DEPENDENCIES) @rm -f waiter_sample$(EXEEXT) $(LINK) $(waiter_sample_LDFLAGS) $(waiter_sample_OBJECTS) $(waiter_sample_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump_sensors.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipmicmd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmcp_ping.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample3.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/solterm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/waiter_sample.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.o: ipmi_serial_bmc_emu.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ipmi_serial_bmc_emu_CFLAGS) $(CFLAGS) -MT ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.o -MD -MP -MF "$(DEPDIR)/ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.Tpo" -c -o ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.o `test -f 'ipmi_serial_bmc_emu.c' || echo '$(srcdir)/'`ipmi_serial_bmc_emu.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.Tpo" "$(DEPDIR)/ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.Po"; else rm -f "$(DEPDIR)/ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ipmi_serial_bmc_emu.c' object='ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ipmi_serial_bmc_emu_CFLAGS) $(CFLAGS) -c -o ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.o `test -f 'ipmi_serial_bmc_emu.c' || echo '$(srcdir)/'`ipmi_serial_bmc_emu.c ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.obj: ipmi_serial_bmc_emu.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ipmi_serial_bmc_emu_CFLAGS) $(CFLAGS) -MT ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.obj -MD -MP -MF "$(DEPDIR)/ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.Tpo" -c -o ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.obj `if test -f 'ipmi_serial_bmc_emu.c'; then $(CYGPATH_W) 'ipmi_serial_bmc_emu.c'; else $(CYGPATH_W) '$(srcdir)/ipmi_serial_bmc_emu.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.Tpo" "$(DEPDIR)/ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.Po"; else rm -f "$(DEPDIR)/ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ipmi_serial_bmc_emu.c' object='ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ipmi_serial_bmc_emu_CFLAGS) $(CFLAGS) -c -o ipmi_serial_bmc_emu-ipmi_serial_bmc_emu.obj `if test -f 'ipmi_serial_bmc_emu.c'; then $(CYGPATH_W) 'ipmi_serial_bmc_emu.c'; else $(CYGPATH_W) '$(srcdir)/ipmi_serial_bmc_emu.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-data-local install-exec-am: install-binPROGRAMS install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-local .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-data-local install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-info-am uninstall-local # We need to make a link from ipmicmd to openipmicmd for backwards # compatability. install-data-local: rm -f $(DESTDIR)$(bindir)/ipmicmd $(LN_S) openipmicmd $(DESTDIR)$(bindir)/ipmicmd uninstall-local: rm -f $(DESTDIR)$(bindir)/ipmicmd # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: openipmi-2.0.18/sample/sample.c0000644000175000017500000003204711363572740015322 0ustar chuckchuck/* * test1.c * * OpenIPMI test code * * Author: Intel Corporation * Jeff Zheng * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* This sample application demostrates a very simple method to use OpenIPMI. It just search all sensors in the system. From this application, you can find that there is only 4 lines code in main() function if you use the SMI-only interface, and several simple callback functions in all cases. */ static const char *progname; static void con_usage(const char *name, const char *help, void *cb_data) { printf("\n%s%s", name, help); } static void usage(void) { printf("Usage:\n"); printf(" %s \n", progname); printf(" Where is one of:"); ipmi_parse_args_iter_help(con_usage, NULL); } static int sensor_threshold_event_handler(ipmi_sensor_t *sensor, enum ipmi_event_dir_e dir, enum ipmi_thresh_e threshold, enum ipmi_event_value_dir_e high_low, enum ipmi_value_present_e value_present, unsigned int raw_value, double value, void *cb_data, ipmi_event_t *event) { ipmi_entity_t *ent = ipmi_sensor_get_entity(sensor); int id, instance; char name[33]; id = ipmi_entity_get_entity_id(ent); instance = ipmi_entity_get_entity_instance(ent); ipmi_sensor_get_id(sensor, name, 32); printf("Event from sensor %d.%d.%s: %s %s %s\n", id, instance, name, ipmi_get_threshold_string(threshold), ipmi_get_value_dir_string(high_low), ipmi_get_event_dir_string(dir)); if (value_present == IPMI_BOTH_VALUES_PRESENT) { printf(" value is %f (%2.2x)\n", value, raw_value); } else if (value_present == IPMI_RAW_VALUE_PRESENT) { printf(" raw value is 0x%x\n", raw_value); } if (event) printf("Due to event 0x%4.4x\n", ipmi_event_get_record_id(event)); /* This passes the event on to the main event handler, which does not exist in this program. */ return IPMI_EVENT_NOT_HANDLED; } static int sensor_discrete_event_handler(ipmi_sensor_t *sensor, enum ipmi_event_dir_e dir, int offset, int severity, int prev_severity, void *cb_data, ipmi_event_t *event) { ipmi_entity_t *ent = ipmi_sensor_get_entity(sensor); int id, instance; char name[33]; id = ipmi_entity_get_entity_id(ent); instance = ipmi_entity_get_entity_instance(ent); ipmi_sensor_get_id(sensor, name, 32); printf("Event from sensor %d.%d.%s: %d %s\n", id, instance, name, offset, ipmi_get_event_dir_string(dir)); if (severity != -1) printf(" severity is %d\n", severity); if (prev_severity != -1) printf(" prev severity is %d\n", prev_severity); if (event) printf("Due to event 0x%4.4x\n", ipmi_event_get_record_id(event)); /* This passes the event on to the main event handler, which does not exist in this program. */ return IPMI_EVENT_NOT_HANDLED; } /* Whenever the status of a sensor changes, the function is called We display the information of the sensor if we find a new sensor */ static void sensor_change(enum ipmi_update_e op, ipmi_entity_t *ent, ipmi_sensor_t *sensor, void *cb_data) { int id, instance; char name[33]; int rv; id = ipmi_entity_get_entity_id(ent); instance = ipmi_entity_get_entity_instance(ent); ipmi_sensor_get_id(sensor, name, 32); if (op == IPMI_ADDED) { printf("Sensor added: %d.%d.%s\n", id, instance, name); if (ipmi_sensor_get_event_reading_type(sensor) == IPMI_EVENT_READING_TYPE_THRESHOLD) rv = ipmi_sensor_add_threshold_event_handler (sensor, sensor_threshold_event_handler, NULL); else rv = ipmi_sensor_add_discrete_event_handler (sensor, sensor_discrete_event_handler, NULL); if (rv) printf("Unable to add the sensor event handler: %x\n", rv); } } static int traverse_fru_node_tree(int indent, ipmi_fru_node_t *node) { const char *name; unsigned int i, j; enum ipmi_fru_data_type_e dtype; int intval, rv; time_t time; double floatval; char *data; unsigned int data_len; ipmi_fru_node_t *sub_node; for (i=0; ; i++) { data = NULL; rv = ipmi_fru_node_get_field(node, i, &name, &dtype, &intval, &time, &floatval, &data, &data_len, &sub_node); if (rv == EINVAL) break; else if (rv) continue; if (name) printf("%*s%s: ", indent, "", name); else printf("%*s[%d]: ", indent, "", i); switch (dtype) { case IPMI_FRU_DATA_INT: printf("(integer) %d\n", intval); break; case IPMI_FRU_DATA_TIME: printf("(integer) %ld\n", (long) time); break; case IPMI_FRU_DATA_BINARY: printf("(binary)"); for (j=0; jset_log_handler(os_hnd, my_vlog); /* Initialize the OpenIPMI library. Do a double one to look for init/shutdown bugs. */ rv = ipmi_init(os_hnd); if (rv) { fprintf(stderr, "Error in ipmi initialization %d: %s\n", curr_arg, strerror(rv)); exit(1); } ipmi_shutdown(); rv = ipmi_init(os_hnd); if (rv) { fprintf(stderr, "Error in ipmi initialization(2) %d: %s\n", curr_arg, strerror(rv)); exit(1); } #if 0 /* If all you need is an SMI connection, this is all the code you need. */ /* Establish connections to domain through system interface. This function connect domain, selector and OS handler together. When there is response message from domain, the status of file descriptor in selector is changed and predefined callback is called. After the connection is established, setup_done will be called. */ rv = ipmi_smi_setup_con(0, os_hnd, NULL, &con); if (rv) { printf("ipmi_smi_setup_con: %s", strerror(rv)); exit(1); } #endif #if 1 rv = ipmi_parse_args2(&curr_arg, argc, argv, &args); if (rv) { fprintf(stderr, "Error parsing command arguments, argument %d: %s\n", curr_arg, strerror(rv)); usage(); exit(1); } rv = ipmi_args_setup_con(args, os_hnd, NULL, &con); if (rv) { fprintf(stderr, "ipmi_ip_setup_con: %s", strerror(rv)); exit(1); } #endif rv = ipmi_open_domain("", &con, 1, setup_done, NULL, NULL, NULL, NULL, 0, NULL); if (rv) { fprintf(stderr, "ipmi_init_domain: %s\n", strerror(rv)); exit(1); } /* This is the main loop of the event-driven program. Try to exit the program */ #if 1 /* We run the select loop here, this shows how you can use sel_select. You could add your own processing in this loop. */ while (1) { os_hnd->perform_one_op(os_hnd, NULL); } #else /* Let the selector code run the select loop. */ os_hnd->operation_loop(os_hnd); #endif /* Technically, we can't get here, but this is an example. */ os_hnd->free_os_handler(os_hnd); } openipmi-2.0.18/sample/ipmi_serial_bmc_emu.c0000644000175000017500000010110211363572740020012 0ustar chuckchuck/* * ipmi_serial_bmc_emu.c * * An emulator for various IPMI BMCs that sit on a serial port * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2006 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #define _GNU_SOURCE #include typedef struct sockaddr_ip_s { union { struct sockaddr s_addr; struct sockaddr_in s_addr4; #ifdef PF_INET6 struct sockaddr_in6 s_addr6; #endif } s_ipsock; } sockaddr_ip_t; #define IPMB_MAX_MSG_LENGTH 32 #define IPMI_MAX_MSG_LENGTH 36 struct msg { unsigned char data[IPMB_MAX_MSG_LENGTH]; unsigned int data_len; struct msg *next; }; struct msg_info; struct codec { char *name; void (*handle_char)(unsigned char ch, struct msg_info *mi); void (*send)(unsigned char *msg, unsigned int msg_len, struct msg_info *mi); void *(*setup)(void); void (*handle_event)(struct msg *emsg, struct msg_info *mi); void (*handle_ipmb)(struct msg *emsg, struct msg_info *mi); }; struct oem_handler { char *name; int (*handler)(const unsigned char *msg, unsigned int len, struct msg_info *mi, unsigned char *rsp, unsigned int *rsp_len); void (*init)(struct msg_info *mi); }; #define EVENT_BUFFER_GLOBAL_ENABLE (1 << 2) #define EVENT_LOG_GLOBAL_ENABLE (1 << 3) #define SUPPORTED_GLOBAL_ENABLES (EVENT_BUFFER_GLOBAL_ENABLE | \ EVENT_LOG_GLOBAL_ENABLE) struct msg_info { /* General info, set by main code, not formatters. */ void *info; int sock; struct codec *codec; struct oem_handler *oem; /* Queues for events and IPMB messages. */ struct msg *ipmb_q, *ipmb_q_tail; struct msg *event_q, *event_q_tail; void *oem_info; /* Settings */ int echo; unsigned char my_ipmb; int debug; int do_attn; unsigned char attn_chars[8]; int attn_chars_len; char global_enables; /* Info from the recv message. */ unsigned char netfn; unsigned char dest; unsigned char seq; unsigned char rsAddr; unsigned char rqAddr; unsigned char rqLUN; unsigned char rsLUN; unsigned char cmd; }; static void socket_send(const unsigned char *data, unsigned int len, struct msg_info *mi); static void handle_msg(const unsigned char *msg, unsigned int len, struct msg_info *mi); static void handle_ipmb_msg(const unsigned char *msg, unsigned int len, struct msg_info *mi, struct msg_info *top_mi); static unsigned char hex2char[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; static int fromhex(unsigned char c) { if (isdigit(c)) return c - '0'; else if (isxdigit(c)) return tolower(c) - 'a' + 10; else return -EINVAL; } static unsigned char ipmb_checksum(const unsigned char *data, int size) { unsigned char csum = 0; for (; size > 0; size--, data++) csum += *data; return -csum; } static int unformat_ipmb_msg(const unsigned char *msg, unsigned int *pos, unsigned int *len, struct msg_info *mi) { msg += *pos; if (*len < 7) { fprintf(stderr, "Message too short\n"); return -EINVAL; } if (ipmb_checksum(msg, *len) != 0) { fprintf(stderr, "Message checksum failure\n"); return -EINVAL; } (*len)--; mi->rsAddr = msg[0]; mi->netfn = msg[1] >> 2; mi->rsLUN = msg[1] & 3; mi->rqAddr = msg[3]; mi->seq = msg[4] >> 2; mi->rqLUN = msg[4] & 3; mi->cmd = msg[5]; *pos += 6; *len -= 6; return 0; } static unsigned int format_ipmb_rsp(unsigned char *msg, const unsigned char *omsg, unsigned int omsg_len, struct msg_info *mi) { unsigned int msg_len; msg[0] = mi->rqAddr; msg[1] = (mi->netfn << 2) | mi->rqLUN; msg[2] = ipmb_checksum(msg, 2); msg[3] = mi->rsAddr; msg[4] = (mi->seq << 2) | mi->rsLUN; msg[5] = mi->cmd; memcpy(msg+6, omsg, omsg_len); msg_len = omsg_len + 6; msg[msg_len] = ipmb_checksum(msg + 3, msg_len - 3); msg_len++; return msg_len; } static void queue_ipmb(struct msg *imsg, struct msg_info *mi) { imsg->next = NULL; if (mi->ipmb_q_tail) mi->ipmb_q_tail->next = imsg; else mi->ipmb_q = imsg; mi->ipmb_q_tail = imsg; if (mi->do_attn) socket_send(mi->attn_chars, mi->attn_chars_len, mi); } static void queue_event(struct msg *emsg, struct msg_info *mi) { emsg->next = NULL; if (mi->event_q_tail) mi->event_q_tail->next = emsg; else mi->event_q = emsg; mi->event_q_tail = emsg; if (mi->do_attn) socket_send(mi->attn_chars, mi->attn_chars_len, mi); } /*********************************************************************** * * Radisys ASCII codec. * ***********************************************************************/ #define RA_MAX_CHARS_SIZE (((IPMI_MAX_MSG_LENGTH + 1) * 3) + 4) struct ra_data { unsigned char recv_chars[RA_MAX_CHARS_SIZE]; unsigned int recv_chars_len; int recv_chars_too_many; }; static void ra_format_msg(const unsigned char *msg, unsigned int msg_len, struct msg_info *mi) { int i; int len; unsigned char c[RA_MAX_CHARS_SIZE]; len = 0; for (i = 0; i < msg_len; i++) { c[len] = hex2char[msg[i] >> 4]; len++; c[len] = hex2char[msg[i] & 0xf]; len++; } c[len] = 0x0d; len++; socket_send(c, len, mi); } static void ra_ipmb_handler(struct msg *imsg, struct msg_info *mi) { ra_format_msg(imsg->data, imsg->data_len, mi); free(imsg); } /* * Called when the '0x0d' is seen. */ static int ra_unformat_msg(unsigned char *r, unsigned int len, struct msg_info *mi) { unsigned char o[IPMI_MAX_MSG_LENGTH]; unsigned int p = 0; unsigned int i = 0; int rv; while (p < len) { rv = fromhex(r[p]); if (rv < 0) return rv; o[i] = rv << 4; p++; if (p >= len) return -EINVAL; rv = fromhex(r[p]); if (rv < 0) return rv; o[i] |= rv; p++; i++; } p = 0; rv = unformat_ipmb_msg(o, &p, &i, mi); if (rv) return rv; if ((mi->rsAddr == mi->my_ipmb) || (mi->rsAddr == 1)) handle_msg(o + p, i, mi); else handle_ipmb_msg(o + p, i, mi, mi); return 0; } static void ra_handle_char(unsigned char ch, struct msg_info *mi) { struct ra_data *info = mi->info; unsigned int len = info->recv_chars_len; unsigned char *r; int rv; if (ch == 0x0d) { /* End of command, handle it. */ if (info->recv_chars_too_many) { /* Input data overrun. */ fprintf(stderr, "Data overrun\n"); info->recv_chars_too_many = 0; info->recv_chars_len = 0; return; } rv = ra_unformat_msg(info->recv_chars, info->recv_chars_len, mi); info->recv_chars_too_many = 0; info->recv_chars_len = 0; if (rv) { /* Bad input data. */ fprintf(stderr, "Bad input data\n"); return; } return; } if (info->recv_chars_too_many) return; r = info->recv_chars; if (len >= sizeof(info->recv_chars)) { info->recv_chars_too_many = 1; } else if ((len > 0) && isspace(r[len-1]) && isspace(ch)) { /* Ignore multiple spaces together. */ } else { r[len] = ch; info->recv_chars_len++; } } static void ra_send(unsigned char *omsg, unsigned int omsg_len, struct msg_info *mi) { unsigned char msg[IPMI_MAX_MSG_LENGTH + 7]; unsigned int msg_len; msg_len = format_ipmb_rsp(msg, omsg, omsg_len, mi); ra_format_msg(msg, msg_len, mi); } static void * ra_setup(void) { struct ra_data *info; info = malloc(sizeof(*info)); if (!info) return NULL; info->recv_chars_len = 0; info->recv_chars_too_many = 0; return info; } /*********************************************************************** * * Direct Mode codec. * ***********************************************************************/ #define DM_START_CHAR 0xA0 #define DM_STOP_CHAR 0xA5 #define DM_PACKET_HANDSHAKE 0xA6 #define DM_DATA_ESCAPE_CHAR 0xAA struct dm_data { unsigned char recv_msg[IPMI_MAX_MSG_LENGTH + 4]; unsigned int recv_msg_len; int recv_msg_too_many; int in_recv_msg; int in_escape; }; static void dm_handle_msg(unsigned char *msg, unsigned int len, struct msg_info *mi) { int rv; unsigned int pos; pos = 0; rv = unformat_ipmb_msg(msg, &pos, &len, mi); if (rv) return; handle_msg(msg + pos, len, mi); } static void dm_handle_char(unsigned char ch, struct msg_info *mi) { struct dm_data *info = mi->info; unsigned int len = info->recv_msg_len; unsigned char c; switch (ch) { case DM_START_CHAR: if (info->in_recv_msg) fprintf(stderr, "Msg started in the middle of another\n"); info->in_recv_msg = 1; info->recv_msg_len = 0; info->recv_msg_too_many = 0; info->in_escape = 0; break; case DM_STOP_CHAR: if (!info->in_recv_msg) fprintf(stderr, "Empty message\n"); else if (info->in_escape) { info->in_recv_msg = 0; fprintf(stderr, "Message ended in escape\n"); } else if (info->recv_msg_too_many) { fprintf(stderr, "Message too long\n"); info->in_recv_msg = 0; } else { dm_handle_msg(info->recv_msg, info->recv_msg_len, mi); info->in_recv_msg = 0; } info->in_escape = 0; c = DM_PACKET_HANDSHAKE; socket_send(&c, 1, mi); break; case DM_PACKET_HANDSHAKE: info->in_escape = 0; break; case DM_DATA_ESCAPE_CHAR: if (!info->recv_msg_too_many) info->in_escape = 1; break; default: if (!info->in_recv_msg) /* Ignore characters outside of messages. */ break; if (info->in_escape) { info->in_escape = 0; switch (ch) { case 0xB0: ch = DM_START_CHAR; break; case 0xB5: ch = DM_STOP_CHAR; break; case 0xB6: ch = DM_PACKET_HANDSHAKE; break; case 0xBA: ch = DM_DATA_ESCAPE_CHAR; break; case 0x3B: ch = 0x1b; break; default: fprintf(stderr, "Invalid escape char: 0x%x\n", ch); info->recv_msg_too_many = 1; return; } } if (!info->recv_msg_too_many) { if (len >= sizeof(info->recv_msg)) { info->recv_msg_too_many = 1; break; } info->recv_msg[len] = ch; info->recv_msg_len++; } break; } } static void dm_send(unsigned char *omsg, unsigned int omsg_len, struct msg_info *mi) { unsigned int i; unsigned int len = 0; unsigned char c[(IPMI_MAX_MSG_LENGTH + 7) * 2]; unsigned char msg[IPMI_MAX_MSG_LENGTH + 7]; unsigned int msg_len; msg_len = format_ipmb_rsp(msg, omsg, omsg_len, mi); c[len++] = 0xA0; for (i = 0; i < msg_len; i++) { switch (msg[i]) { case 0xA0: c[len++] = 0xAA; c[len++] = 0xB0; break; case 0xA5: c[len++] = 0xAA; c[len++] = 0xB5; break; case 0xA6: c[len++] = 0xAA; c[len++] = 0xB6; break; case 0xAA: c[len++] = 0xAA; c[len++] = 0xBA; break; case 0x1B: c[len++] = 0xAA; c[len++] = 0x3B; break; default: c[len++] = msg[i]; } } c[len++] = 0xA5; socket_send(c, len, mi); } static void * dm_setup(void) { struct dm_data *info; info = malloc(sizeof(*info)); if (!info) return NULL; memset(info, 0, sizeof(*info)); return info; } /*********************************************************************** * * Terminal Mode codec. * ***********************************************************************/ #define TM_MAX_CHARS_SIZE (((IPMI_MAX_MSG_LENGTH + 1) * 3) + 4) struct tm_data { unsigned char recv_chars[TM_MAX_CHARS_SIZE]; unsigned int recv_chars_len; int recv_chars_too_many; }; static void tm_format_msg(const unsigned char *msg, unsigned int msg_len, struct msg_info *mi) { int i; int len; unsigned char c[TM_MAX_CHARS_SIZE]; unsigned char t; len = 0; c[len] = '['; len++; t = mi->netfn << 2 | mi->rqLUN; c[len] = hex2char[t >> 4]; len++; c[len] = hex2char[t & 0xf]; len++; /* * Insert the sequence number and bridge bits. Bridge bits * are always zero. */ t = mi->seq << 2; c[len] = hex2char[t >> 4]; len++; c[len] = hex2char[t & 0xf]; len++; c[len] = hex2char[mi->cmd >> 4]; len++; c[len] = hex2char[mi->cmd & 0xf]; len++; /* Now the rest of the message. */ for (i = 0; ; ) { c[len] = hex2char[msg[i] >> 4]; len++; c[len] = hex2char[msg[i] & 0xf]; len++; i++; if (i == msg_len) break; c[len] = ' '; len++; } c[len] = ']'; len++; c[len] = 0x0a; len++; socket_send(c, len, mi); } /* * Called when the ']' is seen, the leading '[' is removed, too. We * get this with a leading space and no more than one space between * items. */ static int tm_unformat_msg(unsigned char *r, unsigned int len, struct msg_info *mi) { unsigned char o[IPMI_MAX_MSG_LENGTH]; unsigned int p = 0; unsigned int i = 0; int rv; #define SKIP_SPACE if (isspace(r[p])) p++ #define ENSURE_MORE if (p >= len) return -EINVAL SKIP_SPACE; while (p < len) { if (i >= sizeof(o)) return -EFBIG; ENSURE_MORE; rv = fromhex(r[p]); if (rv < 0) return rv; o[i] = rv << 4; p++; ENSURE_MORE; rv = fromhex(r[p]); if (rv < 0) return rv; o[i] |= rv; p++; i++; SKIP_SPACE; } if (i < 3) return -EINVAL; mi->netfn = o[0] >> 2; mi->rqLUN = o[0] & 3; mi->seq = o[1] >> 2; mi->cmd = o[2]; handle_msg(o+3, i-3, mi); return 0; #undef SKIP_SPACE #undef ENSURE_MORE } static void tm_handle_char(unsigned char ch, struct msg_info *mi) { struct tm_data *info = mi->info; unsigned int len = info->recv_chars_len; unsigned char *r; int rv; if (ch == '[') { /* * Start of a command. Note that if a command is * already in progress (len != 0) we abort it. */ if (len != 0) fprintf(stderr, "Msg started in the middle of another\n"); /* Convert the leading '[' to a space, that's innocuous. */ info->recv_chars[0] = ' '; info->recv_chars_len = 1; info->recv_chars_too_many = 0; return; } if (len == 0) /* Ignore everything outside [ ]. */ return; if (ch == ']') { /* End of command, handle it. */ if (info->recv_chars_too_many) { /* Input data overrun. */ fprintf(stderr, "Data overrun\n"); info->recv_chars_too_many = 0; info->recv_chars_len = 0; return; } rv = tm_unformat_msg(info->recv_chars, info->recv_chars_len, mi); info->recv_chars_too_many = 0; info->recv_chars_len = 0; if (rv) { /* Bad input data. */ fprintf(stderr, "Bad input data\n"); return; } return; } if (info->recv_chars_too_many) return; r = info->recv_chars; if (len >= sizeof(info->recv_chars)) { info->recv_chars_too_many = 1; } else if ((len > 0) && isspace(r[len-1]) && isspace(ch)) { /* Ignore multiple spaces together. */ } else { r[len] = ch; info->recv_chars_len++; } } static void tm_send(unsigned char *msg, unsigned int msg_len, struct msg_info *mi) { tm_format_msg(msg, msg_len, mi); } static void * tm_setup(void) { struct tm_data *info; info = malloc(sizeof(*info)); if (!info) return NULL; info->recv_chars_len = 0; info->recv_chars_too_many = 0; return info; } /*********************************************************************** * * codec structure * ***********************************************************************/ struct codec codecs[] = { { "TerminalMode", tm_handle_char, tm_send, tm_setup, queue_event, queue_ipmb }, { "Direct", dm_handle_char, dm_send, dm_setup, queue_event, queue_ipmb }, { "RadisysAscii", ra_handle_char, ra_send, ra_setup, NULL, ra_ipmb_handler }, { NULL } }; static void socket_send(const unsigned char *data, unsigned int len, struct msg_info *mi) { int rv; int i; if (mi->debug > 0) { printf("Sock send:"); for (i=0; isock, data, len); if (rv < 0) { perror("write"); return; } else if (rv < len) { len -= rv; data += rv; goto restart; } } #define IPMI_APP_NETFN 6 #define IPMI_GET_DEV_ID_CMD 0x01 #define IPMI_GET_DEVICE_GUID_CMD 0x08 #define IPMI_SET_BMC_GLOBAL_ENABLES_CMD 0x2e #define IPMI_GET_BMC_GLOBAL_ENABLES_CMD 0x2f #define IPMI_GET_MSG_FLAGS_CMD 0x31 #define IPMI_GET_MSG_CMD 0x33 #define IPMI_SEND_MSG_CMD 0x34 #define IPMI_READ_EVENT_MSG_CMD 0x35 #define IPMI_OEM_NETFN 0x2e static unsigned char ipmb_devid_data[] = { 0x00, 0x01, 0x00, 0x48, 0x02, 0x9f, 0xaa, 0x01, 0x00, 0x23, 0x00, 0x00, 0x11, 0x00, 0x04 }; static void handle_ipmb_msg(const unsigned char *msg, unsigned int len, struct msg_info *mi, struct msg_info *top_mi) { struct msg *imsg; unsigned char rsp[IPMI_MAX_MSG_LENGTH]; unsigned int rsp_len; int i; imsg = malloc(sizeof(*imsg)); if (!imsg) return; if (top_mi->debug > 0) { printf("Recv IPMB Msg (%x:%x):", mi->netfn, mi->cmd); for (i=0; inetfn == IPMI_APP_NETFN) { switch (mi->cmd) { case IPMI_GET_DEV_ID_CMD: rsp[0] = 0; memcpy(rsp+1, ipmb_devid_data, sizeof(ipmb_devid_data)); rsp_len = sizeof(ipmb_devid_data) + 1; break; default: goto invalid_msg; } } else goto invalid_msg; send_rsp: /* Convert to response. */ mi->netfn |= 1; imsg->data_len = format_ipmb_rsp(imsg->data, rsp, rsp_len, mi); top_mi->codec->handle_ipmb(imsg, top_mi); return; invalid_msg: rsp[0] = 0xc1; rsp_len = 1; goto send_rsp; } static unsigned char devid_data[] = { 0x20, 0x01, 0x00, 0x48, 0x02, 0x9f, 0x22, 0x03, 0x00, 0x11, 0x43, 0x00, 0x11, 0x00, 0x04 }; static unsigned char guid_data[] = { 0x00, 0x01, 0x00, 0x48, 0x02, 0x9f, 0xaa, 0x01, 0x00, 0x23, 0x00, 0x00, 0x11, 0x00, 0x04, 0x99 }; static void handle_msg(const unsigned char *msg, unsigned int len, struct msg_info *mi) { int i; unsigned char rsp[IPMI_MAX_MSG_LENGTH]; unsigned int rsp_len; struct msg *m; int rv; struct msg_info nmi; unsigned int p; if (mi->debug > 0) { printf("Recv Msg (%x:%x):", mi->netfn, mi->cmd); for (i=0; ioem) { rv = mi->oem->handler(msg, len, mi, rsp, &rsp_len); if (!rv) goto send_rsp; } if (mi->netfn == IPMI_APP_NETFN) { switch (mi->cmd) { case IPMI_GET_DEV_ID_CMD: rsp[0] = 0; memcpy(rsp+1, devid_data, sizeof(devid_data)); rsp_len = sizeof(devid_data) + 1; break; case IPMI_GET_DEVICE_GUID_CMD: rsp[0] = 0; memcpy(rsp+1, guid_data, sizeof(guid_data)); rsp_len = sizeof(guid_data) + 1; break; case IPMI_GET_MSG_FLAGS_CMD: rsp[0] = 0; rsp[1] = 0; if (mi->event_q) rsp[1] |= 2; if (mi->ipmb_q) rsp[1] |= 1; rsp_len = 2; break; case IPMI_GET_MSG_CMD: if (!mi->ipmb_q) { rsp[0] = 0x80; rsp_len = 1; break; } m = mi->ipmb_q; mi->ipmb_q = m->next; if (!mi->ipmb_q) mi->ipmb_q_tail = NULL; rsp[0] = 0; rsp[1] = 0; /* Channel # */ /* Note we don't put our slave address in the response, as that is what get smg expects. */ memcpy(rsp + 2, m->data + 1, m->data_len - 1); rsp_len = 2 + m->data_len - 1; free(m); break; case IPMI_SEND_MSG_CMD: if (msg[0] != 0) { rsp[0] = 0xcc; rsp_len = 1; break; } p = 1; len -= 1; rv = unformat_ipmb_msg(msg, &p, &len, &nmi); if (rv) { rsp[0] = 0xcc; rsp_len = 1; break; } if (nmi.netfn & 1) { /* Ignore responses */ rsp[0] = 0; rsp_len = 1; break; } handle_ipmb_msg(msg+p, len, &nmi, mi); rsp[0] = 0; rsp_len = 1; break; case IPMI_SET_BMC_GLOBAL_ENABLES_CMD: if (len < 1) { rsp[0] = 0xcc; rsp_len = 1; break; } if ((msg[0] & ~SUPPORTED_GLOBAL_ENABLES) != 0) { rsp[0] = 0xcc; rsp_len = 1; break; } mi->global_enables = msg[0]; rsp[0] = 0; rsp_len = 1; break; case IPMI_GET_BMC_GLOBAL_ENABLES_CMD: rsp[0] = 0; rsp[1] = mi->global_enables; rsp_len = 2; break; case IPMI_READ_EVENT_MSG_CMD: if (!mi->event_q) { rsp[0] = 0x80; rsp_len = 1; break; } m = mi->event_q; mi->event_q = m->next; if (!mi->event_q) mi->event_q_tail = NULL; rsp[0] = 0; memcpy(rsp + 1, m->data, m->data_len); rsp_len = 1 + m->data_len; free(m); break; default: goto invalid_msg; } } else goto invalid_msg; send_rsp: /* Convert to response. */ mi->netfn |= 1; mi->codec->send(rsp, rsp_len, mi); return; invalid_msg: rsp[0] = 0xc1; rsp_len = 1; goto send_rsp; } #define PP_GET_SERIAL_INTF_CMD 0x01 #define PP_SET_SERIAL_INTF_CMD 0x02 static unsigned char pp_oem_chars[] = { 0x00, 0x40, 0x0a }; static int pp_oem_handler(const unsigned char *msg, unsigned int len, struct msg_info *mi, unsigned char *rsp, unsigned int *rsp_len) { if ((len < 3) || (memcmp(msg, pp_oem_chars, 3) != 0)) return -ENOSYS; msg += 3; len -= 3; if (mi->netfn == IPMI_OEM_NETFN) { switch (mi->cmd) { case PP_GET_SERIAL_INTF_CMD: rsp[0] = 0; memcpy(rsp+1, pp_oem_chars, 3); rsp[4] = 0; if (msg[0] == 1) rsp[4] |= mi->echo; *rsp_len = 5; break; case PP_SET_SERIAL_INTF_CMD: if (len < 2) rsp[0] = 0xcc; else if (msg[0] == 1) { mi->echo = msg[1] & 1; rsp[0] = 0; } memcpy(rsp+1, pp_oem_chars, 3); *rsp_len = 4; break; default: return -ENOSYS; } } else return -ENOSYS; return 0; } static void pp_oem_init(struct msg_info *mi) { mi->echo = 1; } #define RA_CONTROLLER_OEM_NETFN 0x3e #define RA_GET_IPMB_ADDR_CMD 0x12 static int ra_oem_handler(const unsigned char *msg, unsigned int len, struct msg_info *mi, unsigned char *rsp, unsigned int *rsp_len) { if (mi->netfn == RA_CONTROLLER_OEM_NETFN) { switch (mi->cmd) { case RA_GET_IPMB_ADDR_CMD: rsp[0] = 0; rsp[1] = mi->my_ipmb; *rsp_len = 2; break; default: return -ENOSYS; } } else if (mi->netfn == IPMI_APP_NETFN) { switch (mi->cmd) { case IPMI_GET_MSG_FLAGS_CMD: /* No message flag support. */ rsp[0] = 0xc1; *rsp_len = 1; break; default: return -ENOSYS; } } else return -ENOSYS; return 0; } static void ra_oem_init(struct msg_info *mi) { } static struct oem_handler oem_handlers[] = { { "PigeonPoint", pp_oem_handler, pp_oem_init }, { "Radisys", ra_oem_handler, ra_oem_init }, { NULL } }; static char * next_tok(char **str) { char *rv; char *s = *str; while (isspace(*s)) s++; rv = s; while (*s && (!isspace(*s))) s++; if (*s) { *s = '\0'; s++; } *str = s; if (*rv) return rv; else return NULL; } static void exit_handler(char *line, struct msg_info *mi) { close(mi->sock); exit(0); } static void inc_debug_handler(char *line, struct msg_info *mi) { mi->debug++; } static void dec_debug_handler(char *line, struct msg_info *mi) { if (mi->debug > 0) mi->debug--; } static void event_handler(char *line, struct msg_info *mi) { struct msg *emsg; int i, p; unsigned char *m; if (!mi->codec->handle_event) { printf("This codec does not support event messages\n"); return; } emsg = malloc(sizeof(*emsg)); if (!emsg) { printf("Could not allocate event message\n"); return; } p = 0; m = emsg->data; for (i=0; i<16; i++) { char *s, *e; s = next_tok(&line); if (!s) { printf("Events need 16 bytes of data\n"); free(emsg); return; } m[p++] = strtoul(s, &e, 16); if (*e != '\0') { printf("Byte %d was invalid\n", i+1); free(emsg); return; } } emsg->data_len = 16; mi->codec->handle_event(emsg, mi); } static void help_handler(char *line, struct msg_info *mi); static const char help_help[] = "This command."; static const char exit_help[] = "Quit the program."; static const char quit_help[] = "Quit the program."; static const char event_help[] = "Put an event into the event queue. Takes 16 bytes of data like:\n" " event 10 20 30 40 50 60 70 80 90 a0 b0 c0 d0 e0 f0 f1"; static const char inc_debug_help[] = "Increment the debugging flag."; static const char dec_debug_help[] = "Decrement the debugging flag."; static struct { const char *cmd; void (*handler)(char *line, struct msg_info *mi); const char *help; } cmds[] = { { "help", help_handler, help_help }, { "exit", exit_handler, exit_help }, { "quit", exit_handler, quit_help }, { "event", event_handler, event_help }, { "debug+", inc_debug_handler, inc_debug_help }, { "debug-", dec_debug_handler, dec_debug_help }, { NULL } }; static void help_handler(char *line, struct msg_info *mi) { int i; printf("Valid commands:"); for (i=0; cmds[i].cmd; i++) printf(" %s - %s\n", cmds[i].cmd, cmds[i].help); } static struct msg_info main_mi; static void command_string_handler(char *cmdline) { char *expansion = NULL; int result; int i; char *s, *cmd; if (cmdline == NULL) { printf("\n"); exit_handler(NULL, &main_mi); } result = history_expand(cmdline, &expansion); if (result < 0 || result == 2) { fprintf(stderr, "%s\n", expansion); } else if (expansion && strlen(expansion)){ add_history(expansion); s = expansion; cmd = next_tok(&s); if (cmd) { /* Extract the command. */ for (i=0; cmds[i].cmd != NULL; i++) { if (strcmp(cmd, cmds[i].cmd) == 0) break; } if (cmds[i].cmd) { cmds[i].handler(s, &main_mi); } else { printf("Unknown command: '%s'\n", cmd); } } } if (expansion) free(expansion); } struct option options[] = { { "codec", 1, NULL, 'c' }, { "ipmb_addr", 1, NULL, 'a' }, { "oem_setup", 1, NULL, 'o' }, { "debug", 0, NULL, 'd' }, { "attn", 2, NULL, 't' }, { 0 } }; static char *usage_str = "%s [options] \n" " Emulate various IPMI serial port BMCs, primarily for testing the\n" " IPMI driver.\n" " Options are:\n" " -c , --codec - Set the codec to use. Valid codecs\n" " are:\n" " TerminalMode - Standard terminal mode\n" " Direct - standard serial direct mode\n" " RadisysAscii - Radisys defined ASCII\n" " -a , --ipmb_addr - Set the IPMB address for the emulated\n" " BMC.\n" " -o , --oem_setup - Emulate certain OEM commands:\n" " PigeonPoint - Emulate echo handling per the PigeonPoint IPMCs,\n" " primarily for terminal mode.\n" " Radisys - Emulate the Radisys method for fetching the IPMB address.\n" " --attn[=[,[,...]]] - Set the attention characters to\n" " the given value. This is sent whenever something is added to the\n" " event or receive message queue. It defaults to one BELL character,\n" " which is 0x07. The specified values are numbers, like 0x07.\n" " For direct mode using the ASCII escape, this would be 0x1b. For\n" " direct mode on the Sun CPxxxx, this would be 0xAA,0x47.\n" " -d, --debug - Increment the debug setting\n" " This program connects to a remote TCP port, so you need to have a\n" " terminal server (in raw mode, not telnet mode) to use this program.\n" " I use ser2net, get that if you need it.\n"; char *cmdname; static void usage(void) { printf(usage_str, cmdname); exit(1); } int main(int argc, char *argv[]) { int i; struct addrinfo hints, *res0; sockaddr_ip_t addr; struct msg_info *mi = &main_mi; int rv; char *s, *e; cmdname = argv[0]; memset(mi, 0, sizeof(*mi)); mi->my_ipmb = 0x20; mi->codec = &(codecs[0]); for (;;) { int f; f = getopt_long(argc, argv, "c:o:a:d", options, NULL); if (f == -1) break; switch (f) { case 'c': for (i=0; codecs[i].name; i++) { if (strcmp(codecs[i].name, optarg) == 0) break; } if (codecs[i].name) mi->codec = &(codecs[i]); else { fprintf(stderr, "Invalid codec: %s\n", optarg); usage(); } break; case 'd': mi->debug++; break; case 'a': mi->my_ipmb = strtoul(optarg, NULL, 0); break; case 't': mi->do_attn = 1; if (optarg) { s = optarg; for (i=0; ; i++) { if (i >= sizeof(mi->attn_chars)) { fprintf(stderr, "Too many attention characters\n"); usage(); } mi->attn_chars[i] = strtoul(s, &e, 0); mi->attn_chars_len++; if (*e == '\0') break; else if (*e == ',') s = e + 1; else { fprintf(stderr, "Invalid attention characters\n"); usage(); } } } else { mi->attn_chars[0] = 0x07; mi->attn_chars_len = 1; } break; case 'o': for (i=0; oem_handlers[i].name != NULL; i++) { if (strcmp(optarg, oem_handlers[i].name) == 0) break; } if (oem_handlers[i].name) { mi->oem = &(oem_handlers[i]); mi->oem->init(mi); } else { fprintf(stderr, "Invalid OEM handler '%s'\n", optarg); usage(); } break; default: fprintf(stderr, "Invalid flag: '%c'\n", optopt); usage(); } } i = optind; if (i+2 < argc) { fprintf(stderr, "Host and/or port not supplied\n"); usage(); } memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; rv = getaddrinfo(argv[i], argv[i+1], &hints, &res0); if (rv) { perror("getaddrinfo"); usage(); } /* Only get the first choices */ memcpy(&addr, res0->ai_addr, res0->ai_addrlen); freeaddrinfo(res0); mi->sock = socket(PF_INET, SOCK_STREAM, 0); if (mi->sock < 0) { perror("socket"); usage(); } rv = connect(mi->sock, (struct sockaddr *) &addr, sizeof(addr)); if (rv < 0) { perror("connect"); usage(); } i = 1; if (setsockopt(mi->sock, IPPROTO_TCP, TCP_NODELAY, (char *) &i, sizeof(i)) == -1) { perror("setsockopt TCP_NODELAY"); usage(); } mi->info = mi->codec->setup(); if (!mi->info) { fprintf(stderr, "Out of memory\n"); usage(); } printf("Starting IPMI serial BMC emulator with:\n %s codec" "\n %s OEM emulation\n", mi->codec->name, mi->oem ? mi->oem->name : "no"); if (mi->do_attn) { printf(" attention chars:"); for (i=0; iattn_chars_len; i++) printf(" %2.2x", mi->attn_chars[i]); printf("\n"); } stifle_history(500); rl_callback_handler_install("> ", command_string_handler); for (;;) { unsigned char buf[128]; int i; fd_set readfds; FD_ZERO(&readfds); FD_SET(0, &readfds); FD_SET(mi->sock, &readfds); rv = select(mi->sock+1, &readfds, NULL, NULL, NULL); if (rv < 0) { if (errno != EINTR) { perror("select"); usage(); } continue; } if (FD_ISSET(mi->sock, &readfds)) { rv = read(mi->sock, buf, sizeof(buf)); if (rv < 0) { perror("read"); usage(); } if (mi->debug > 1) { printf("recv:"); for (i=0; iecho) write(mi->sock, buf+i, 1); mi->codec->handle_char(buf[i], mi); } } if (FD_ISSET(0, &readfds)) rl_callback_read_char(); } } openipmi-2.0.18/ChangeLog0000644000175000017500000077225711367554400014201 0ustar chuckchuck2010-05-03 Corey Minyard * swig/python/Makefile.am, swig/perl/Makefile.am: The swig command could possibly get the wrong target, and the OpenIPMI_wrap.c file was being included in the distribution, which could cause the OpenIPMI.py and OpenIPMI.pm files to not be properly generated. Fix those problems. * configure.in: Move to version 2.0.18. 2010-04-29 Corey Minyard * configure.in: Move to version 2.0.17. 2010-04-28 Corey Minyard * include/OpenIPMI/ipmiif.h, lib/ipmi.c: Add a cache option to allow using the local cache to be enabled or disabled. * include/OpenIPMI/internal/ipmi_domain.h, lib/domain.c, include/OpenIPMI/ipmiif.h.in: Add support for the cache option. Also rearrange the handling of options to parse them before the domain is setup, otherwise the SDR allocation would be done before the cache option is processed. * lib/sdr.c: Add support for the cache option. 2010-04-27 Alex Deiter * configure.in, cmdlang/Makefile.am, sample/Makefile.am: Properly handle the terminal library. * swig/perl/Makefile.am: Clean up compile issues. * swig/python/Makefile.i, swig/OpenIPMI.i, swig/python/openipmigui/Makefile.am: Clean up various compile issues with the python sources. 2010-04-27 Corey Minyard * lib/sensor.c: Use unsigned int, not double, to hold the raw sensor value. * lib/ipmi_lan.c: Pass in the correct socket length to sendto, not just the maximum possible size. 2010-04-21 Alex Deiter * cmdlang/ipmish.c, cmdlang/out_fru.c, configure.in, lanserv/OpenIPMI/lanserv.h, lanserv/emu.h, lanserv/lanserv.c, lanserv/lanserv_emu.c, lib/fru_spd_decode.c, lib/oem_intel.c, sample/dump_sensors.c, sample/ipmi_serial_bmc_emu.c, sample/sample.c, sample/sample2.c, sample/sample3.c sample/solterm.c, unix/selector.c, unix/test_heap.c: Get OpenIPMI to compile under FreeBSD. 2010-03-24 Corey Minyard * swig/python/sample.py, swig/python/Makefile.am: Added a python sample program, converted from the perl sample program. * swig/perl/sample: Fixed a few bugs notices in the conversion to python. 2010-01-04 Corey Minyard * lib/ipmi_smi.c: Fix a bug noticed by a user who filed Sourceforge bug 2924182 on this, error cleanup in the case of an SMI setup failure would crash in some cases, and I noticed a use of freed data in the same routine and fixed that, too. 2009-10-19 Corey Minyard * cmdlang/os_debug.c, glib/glib_os_hnd.c, tcl/tcl_os_hnd.c, unix/posix_os_hnd.c, unix/posix_thread_os_hnd.c: Fix a bug filed by dcb on SourceForce, modify set_gdbm_filename() in all these files to properly use the allocated name instead of the passed in name. 2009-09-14 Jan Safranek * ipmi.init: On certain HW (e.g. IBM HS20 blade) the /dev/watchdog is created by kernel during boot (provided by i6300esb driver). /etc/init.d/ipmi script then does not recognize the device is already there and tries to configure new one, which obviously fails. The init script does not show any error and pretends everything is OK. So modify the init script to detect that another watchdog is registered and print a failure message. 2009-06-17 Eric J. Bowersox * lib/ipmi_lan.c: Two more null-pointer fixes to ipmi_lan.c, found in 2.0.16. The first is in a debugging message in rmcpp_find_ipmi, which was using the IPMI_CONN_NAME(ipmi) macro in a scenario in which the pointer it was passing would always be NULL, causing a segfault. I modified the debug message to remove the connection name, as none of the other debug messages in that function use the connection name anyway. The second is in lan_oem_done, which may be called with a NULL "ipmi" parameter (such as, indirectly, via lan_cleanup at line 4030). It contains recovery code for that purpose, but the initialization of "lan" at line 4308 causes a segfault before the code gets to that point. I moved the initialization to after the test for NULL. 2009-06-15 Corey Minyard * lib/oem_atca_conn.c: Fix a logic problem in the disabling of ATCA address checking. 2009-06-13 Corey Minyard * lib/oem_atca_conn.c: Fix a problem where the ATCA address checking code could be called even if it was disabled. 2009-03-16 Corey Minyard * configure.in: Move to version 2.0.16. It's been a while and a release is a good idea, I think. 2009-01-16 Corey Minyard * lib/normal_fru.c: An Intel document (IPMI 0.9 to IPMI 1.0 Change Summary and Porting Considerations from October 1, 1998) mentioned the FRU version was updated from 1 to 2. Nothing else really changed this, but some systems used the version 2. So account for this change. 2009-01-09 Jan Safranek * sample/rmcp_ping.c: I know, it's just a library sample, but people find rmcp_ping useful and it should report something when user provides wrong command line arguments. 2008-12-09 Corey Minyard * lib/ipmi_lan.c, lib/oem_atca.c, sample/dump_sensors.c: Fix some compiler warnings. 2008-12-08 Dann Frazier * doc/IPMI.ltx: Fix some typos. 2008-11-19 Corey Minyard * lib/domain.c: Allow scanning IPMB address 0x20 even if the the channel medium is not IPMB. This helps fake out things where there is no IPMB channel but an MC at 0x20 is still reported in the SDRs. 2008-11-07 Corey Minyard * lib/ipmi_lan.c: Fix some bugs notices by Stephane Blain (stblain at users.sourceforge.net) dealing with the hash function for ipmi lan objects. 2008-09-07 Corey Minyard * unix/selector.c: Fixed a problem with a missing NULL check on sending a signal. * sample/Makefile.am, sample/waiter_sample.c: Add a sample that does waiting using the OS handler waiter. 2008-09-05 Corey Minyard * lib/ipmi_payload.c: Work around a bug in some systems that switch the request and response address in IPMI LAN messages. 2008-07-14 Corey Minyard * unix/selector.c: Fixed handling of waking up threads. 2008-07-02 Corey Minyard * utils/os_handler.c: Fixed a messed up refcount when a waiter times out. * lib/strings.c: Fixed another typo noticed by Nancy Nichols. 2008-06-29 Corey Minyard * lib/hmac.c: Someone named "Sia" reported on Sourceforge that OpenIPMI was using the wrong key for HMAC-MD5-128. And they were right. Problem is now fixed. 2008-06-26 Corey Minyard * lib/strings.c: Fix a typo noticed by Nancy Nichols. * configure.in: Fixed the dia test to work with 3-level version. * lib/hmac.c: A variable in the SHA1 init function was declared static instead of const. This means that in a multi-threaded program, it is possibly (though quite unlikely) that the data could get corrupted. * swig/python/openipmiguid/gui_domainDialog.py: Improve the error handling to make it easier to track down problems. 2008-05-21 Corey Minyard * lib/domain.c: Don't remove everything from the IPMB scan if all the get channel commands fail. There may still be something on IPMB 0. * lib/domain.c: Fix an overflow problem dealing with IPMB addresses. If the IPMB ignores list covered all addresses, the scan code would go into an infinite loop. * lib/domain.c, include/OpenIPMI/ipmi_mc.h: Cleaned up the defaulting of the channel to IPMB, including using defines instead of constants. * configure.in: Move to version 2.0.15. 2008-04-21 Corey Minyard * sample/sample.c: Fixed some array index errors that Nancy Nichols noticed. 2008-04-12 Corey Minyard * include/OpenIPMI/ipmiif.h.in, include/OpenIPMI/ipmi_mc.h: Added handlers that can be called when a registered handlers is removed (cleaned up) automatically (usually when an object is destroyed). This sounds kind of weird, perhaps, but object referenced as callback data can be refcounted by perl and Python (and maybe other things). If an object gets destroyed, there was no easy way (besides keeping a list yourself and watching for object destruction) to detect this. To avoid burdening the user with having to watch that stuff, provide an easy way for them to know when a callback handler is automatically removed. * include/OpenIPMI/internal/ipmi_entity.h: Added helper functions for the callback cleanup. * lib/control.c, lib/domain.c, lib/entity.c, lib/mc.c, lib/sensor.c: Actually implement the callback cleanup handlers. * swig/OpenIPMI.i: Use the callback cleanup handlers to clean things up properly and avoid memory leaks. * swig/perl/test_pet: Remove the now-unneeded cleanup of the update handlers. 2008-04-10 Corey Minyard * lib/ipmi_lan.c: Don't mark a connection as started unless it starts up completely. * lib/ipmi.c: Fixed a log race that was caused by the shutdown changes. * lib/pet.c: Fix some refcounting problems, make sure the pet object exists while callbacks are in progress. * swig/OpenIPMI.i: Clean up refcount handling for PEF, PET, and LANPARM objects to avoid race conditions and problems on errors. * swig/perl/Makefile.am: Set the proper glib patch so that perl can pick it up when running tests. * lib/pef.c: Make sure the PEF object stays around during the capabilities check. 2008-04-04 Corey Minyard * lib/domain.c: The send_command_option function of a connection is optional, only use it if it is present. 2008-04-03 Corey Minyard * include/OpenIPMI/ipmiif.h.in, lib/domain.c: Made the "name" field in ipmi_open_domain a const. * lib/fru_spd_decode.c: Made the initialization reentrant. * lib/ipmi_lan.c: Use IPMI_CON_OPTION_LIST_END instead of "0". Also add -M to the option list * include/OpenIPMI/ipmi_conn.h, lib/ipmi_lan.c: Added a connection option specifying that a message has side effects. For messages with side effects, increase the retry timeout to 5 seconds. This is for reservation messages; on a slow link a reservation would be resent, then the first response would be received and the old reservation was being returned. * include/OpenIPMI/ipmi_mc.h, lib/mc.c: Added a side-effect send command function. * include/OpenIPMI/ipmiif.h.in, lib/domain.c: ditto * lib/sel.c, lib/sdr.c: Switch over to using the side effect functions for doing reservations. * man/ipmi_cmdlang.7: Add the -M option. * lib/ipmi.c: Fix init/shutdown problems to allow init to be called after a shutdown. * lib/aes_cbc.c: ditto * lib/hmac.c: ditto * lib/md5.c: ditto * lib/rakp.c: ditto * lib/normal_fru.c: ditto * lib/fru_spd_decode.c: ditto * lib/fru.c: ditto * lib/oem_atca.c: ditto * lib/oem_atca_conn.c: ditto * sample/sample.c: Add test code for multiple init/shutdown. 2008-03-27 Corey Minyard * lib/mc.c: Fixed a rather serious bug in event handling, in some cases it would never properly deliver events. * configure.in: Move to version 2.0.14. 2008-03-12 Corey Minyard * include/OpenIPMI/lanserv.h, lanserv/OpenIPMI/lanserv.h: Move lanserv.h into the lanserv directory. It still installs in OpenIPMI as before. * configure.in, lanserv/Makefile.am, lanserv/OpenIPMI/Makefile.am: Required changes to move lanserv.h. * include/OpenIPMI/Makefile.am: ditto * lanserve/Makefile.am: Remove the dependency on OpenIPMIutils by directly handling the source files from that directory and not linking the utils library. 2008-01-22 Serkan Çalış * libedit/makelist: When we try to compile OpenIMPI (2.0.11 or previous versions) under Turkish locale, we get some erors like chared.c:442: error: 'ED_UNASSIGNED' undeclared (first use in this function) This is because Turkish character i. Using ASCII could solve the problem. I am attaching a patch for makelist, so we can compile it. 2007-12-20 Corey Minyard * swig/python/openipmigui/_sel.py, swig/python/openipmigui/gui_list.py: Fine-tune some GUI settings. * lib/entity.c: Fix a possible race condition in the entity code. * lib/domain.c: Make the localonly option actually work. 2007-10-16 Corey Minyard * swig/python/openipmigui/gui_domainDialog.py: Insert the default value into string and integer values, primarily so the "Max Outstanding Msgs" field has a proper default value. * include/OpenIPMI/internal/ipmi_fru.h: One of the changes for problems with older compilers had bad side effects; it resulted in corrupt data in some cases. Change it back. * tcl/Makefile.am, glib/Makefile.am: I was instructed by the Debian maintainer that -rpath is a bad idea, and Debian had a writeup. However, the automake documentation says that if you use EXTRA_LTLIBRARIES for optional libraries, you must use -rpath. So change the files back that use EXTRA_LTLIBRARIES. * glib/Makefile.am: Add an pythoninstalllib option to instruct where to install the shared libraries for python. Also install the library directly in the install location and not in lib-dynload. * swig/OpenIPMI.i: Fixed a refcounting problem with parse_args_iter_help(). * configure.in: Since one of the changes fixed a critical bug, move to version 2.0.13. 2007-10-02 Corey Minyard * include/OpenIPMI/internal/ipmi_fru.h, lib/normal_fru.c: Fix problems compiling with older compilers. * lib/oem_atca_fru.c: ditto * lib/ipmi_lan.c: Fixed a problem where the LAN code would pick rmcp+ defaults that might not be available. Instead, pick the most secure available default. * lib/domain.c: Free mc_oem_handlers when shutting down. * */Makefile.am: Removed -R and -rpath from everything, per a bug report from Debian. * swig/python/Makefile.am, swig/python/openipmigui/Makefile.am: Use INSTALL_DATA, not INSTALL_PROGRAM, to install python code. * man/rmcp_ping.1: Some minor manpage fixups. * configure.in: Move to version 2.0.12. 2007-09-15 Corey Minyard * ui/ui_os.c: This file shouldn't use the ipmi_mem_alloc and ipmi_mem_free calls, as that introduces a circular dependency. Only use malloc and free here. 2007-09-12 Corey Minyard * cmdlang/cmd_mc.c: Fix an unsigned problem pointed out by Phil Estes. 2007-09-11 Corey Minyard * lib/ipmi_lan.c, include/OpenIPMI/ipmi_lan.h: Add support for a parameter to set the maximum number of outstanding messages on a LAN connection. This used to be fixed to 2, but now can range from 1 to 63. * swig/python/openipmigui/gui_domainDialog.py: Remove some unused definitions. Add support for "int" types of parameters, like the new maximum outstanding message count. Fix a bug if the parm type is not supported. * lanserv/emu.c: Enable support for the reserve SDR commands. Not having this confuses ipmitool. 2007-09-06 Corey Minyard * lib/sensor.c, lib/entity.c: Don't abort SDR handling if the device string is invalid. Just go on and set the id to "**INVALID**" 2007-08-17 Corey Minyard * sample/dump_sensors.c, sample/Makefile.am: Added a little program to just dump all the sensors. 2007-07-23 Corey Minyard * lib/conn.c: Fix a possible race if an OEM check fails. 2007-07-11 Corey Minyard * lib/domain.c, include/OpenIPMI/internal/ipmi_oem.h: Added infrastructure for fixups for main SDRs. * lib/oem_intel.c: Add main SDR fixups for Intel SE7520 motherboards. 2007-05-25 Corey Minyard * lib/mc.c: Fix the domain fully up get/put operations to work properly. Before, the fully up could come early in some situations. 2007-05-24 Corey Minyard * ui/ui.c: Move the call to ipmi_init() to before where things may be allocated. Thanks to Bruce Rosenkrantz for pointing this out. 2007-05-22 Corey Minyard * swig/python/openipmigui/gui_SoL.py: Add dumping useful information if data processing for terminal input raises an exception. * swig/python/openipmigui/_term.py: Add some missed range checking to make sure Y values are within range with vt100 H and f commands. * swig/python/OpenIPMI_lang.i: If a method raises an exception, print the method name. 2006-07-21 Gerhard Obrecht * lib/oem_kontron_conn.c: Add more board support. 2007-03-05 Corey Minyard * lib/sensor.c, include/OpenIPMI/internal/ipmi_sensor.h: Added a new function to get/set whether the sensor should be used for presence. This is a replacement for the ignore_if_no_entity, whose use is vague, and abstracts this operation a little better. * lib/control.c, include/OpenIPMI/internal/ipmi_control.h: ditto for controls. * lib/entity.c, lib/oem_atca.c, lib/oem_motorola_mxp.c: Switch over to the new presence ignore functions. * lib/oem_test.c, sample/example_oem.c: ditto * lib/entity.c: Other presence handling fixes. * cmdlang/Makefile.am: Remove the -L$(DESTDIR)$libdir, it was broken to add it. * glib/Makefile.am: ditto * lanserv/Makefile.am: ditto * lib/Makefile.am: ditto * swig/perl/Makefile.am: ditto * swig/python/Makefile.am: ditto * tcl/Makefile.am: ditto * ui/Makefile.am: ditto * unix/Makefile.am: ditto * lib/domain.c, lib/entity.c: Found some minor bugs pointed out by new compilers. * swig/python/Makefile.am: Create lib-dynload before installing into it. 2007-03-05 David Greigo * sample/ipmicmd.c: Fix problems with handling errors in non-interactive mode. 2007-02-25 Corey Minyard * configure.in, OpenIPMI.spec.in: Improve the handling of perl installation. Also improve the tcl and glib12 handling to make it more automatic. * configure.in: Move to version 2.0.11 2007-02-09 Corey Minyard * tcl/Makefile.am: Add $(TCL_LIBS) to the test programs ld flags. 2007-01-10 Michael Chu * sdr.c: Fix ipmi_sdr_save related issues: use standard fetch size, correct offset and record id values, parameter checking and passing, do sdr reservation and check status after sdr clear. 2006-12-28 Corey Minyard * swig/python/openipmigui/gui_cmdwin.py: Fix a problem 2006-12-06 Corey Minyard * lanserv/Makefile.am: Added the utils library to the applications. 2006-12-04 Corey Minyard * swig/python/openipmigui/gui.py: Made more reasonable defaults for the initial window settings. * doc/IPMI.ltx, doc/SimpleMonitoring.dia, doc/ipmi.bib: Add some more docs and some use cases. 2006-11-30 Corey Minyard * lib/sensor.c, include/OpenIPMI/ipmiif.h.in: Some sensors are not readable, specifically event-only sensors and sensors with system software IDs as the owner. Add a readable field to the sensor object and check on read operations to make sure it is readable. Technically, for SDRs with a system software ID owner, it might be better to make sure that threadhold and event enables are not done, but hopefully the SDRs are right. Yeah, right, I know. * include/OpenIPMI/internal/ipmi_sensor.h: Add a function to set the readable field for a sensor. * swig/OpenIPMI.i: Add the readable method to the sensor object. * swig/python/openipmigui/_sensor.py: Don't read the value for unreadable sensors, instead put "(not readable)" in the value. * lib/sensor.c: Fix some problems parsing type 3 SDRs. Also added some error logs and cleaned things up a bit. * configure.in: Move to version 2.0.10 2006-11-29 Corey Minyard * include/OpenIPMI/ipmi_types.h: Increase the value of MAX_IPMI_USED_CHANNELS to 14. It was increased to 12 in the Feb 2006 markup of the spec, but just go all the way to 14; it doesn't really matter. We don't want to include 14, and 15, though, those are special channels. 2006-11-20 Pierre Sangouard * include/OpenIPMI/ipmi_picmg.h: I've found a small issue in ipmi_picmg.h: Get Shelf Power Allocation command uses a wrong code (0x19), it should be 0x22 instead. This was changed at the very last minute before ECN-002 release since it conflicted with AMC.0 defined commands. The attached patch fixes this issue. 2006-11-16 Corey Minyard * lib/entity.c: ipmi_entity_fetch_frus_cb() violated the rule of returning an error and still calling the done handler (and it didn't check the done handler for NULL). Fix this problem. * lib/domain.c: Fixed a problem when a shutdown occurred during startup. * swig/python/openipmigui/_saveprefs.py: Make sure that the startup file is only accessible by the user and refuse to start up if it is world orgroup accessible. * swig/python/openipmigui/_gui_cmdwin.py: Ditto for the history file. * configure.in: Move to version 2.0.9 2006-11-15 Corey Minyard * lib/domain: Fix a problem with active/standby connections; now force command rerouting when a connection goes inactive, as well as when a connection goes active. * lib/domain.c: Modified command rerouting a little more. The send sequences are now per-connection instead of per-domain and the routing is only done when a connection goes inactive or down. This is more reliable and will make multiple active connections work better. 2006-11-14 Corey Minyard * swig/python/openipmigui/gui.py: Rework the mouse wheel stuff so it works on older version of tk. * swig/python/openipmigui/gui_list.py: ditto * swig/python/openipmigui/gui_treelist.py: ditto * Makefile.am, swig/python/Makefile.am: "make rungui" wouldn't work on systems that could dynamically choose the glib library. Add an LD_LIBRARY_PATH back in for that directory only. * lib/fru.c, include/OpenIPMI/internal/ipmi_fru.h: Exported a function to reference the FRU structure without claiming the lock. * lib/normal_fru.c: Removed a deadlock where a FRU was referenced while the lock was held. * lib/fru.c: If the FRU fetch start fails, return an error. * lib/mc.c: Fixed a deadlock in certain error cases. * lib/oem_atca.c: Make sure the entity is gotten before creating the FRU controls with it. * cmdlang/os_debug.c: Can't use ipmi_mem_alloc any more to allocate a lock, the locks are claimed too early. * lib/ipmi_lan.c: Fixed a missing shutdown check that could cause a race at shutdown and a possible segv. * lib/oem_atca.c: Fixed a possible memory leak in the LEDs if an ATCA domain is shut down while it is coming up. * lib/sdr.c: Fix a problem with the fetch retry count being reset to zero sometimes on a restart. * lib/sdr.c, lib/mc.c: Added a way to stop the SDR timer operations during cleanup of an MC. 2006-11-13 Corey Minyard * lib/control.c, lib/sensor.c: Change the shutdown order of OEM controls so the OEM data is freed last, after the control is removed from the entity. * lib/control.c, lib/sensor.c: Don't fail freeing an OEM control or sensor if the index is reused. The control is still valid to free. * lib/oem_atca.c: Free all the FRUs for an entity when the entity is freed at domain shutdown. * lib/sdr.c: Fix a race where if the SDR data is asked for the first time and then again immediately after, the DB will be fetched twice and the second time will overwrite the first data. Only fetch DB data if the SDR fetch state is idle. Also, when fetching from the DB, free the SDR data if it is allocated. * lib/control.c, lib/sensor.c: Modified the addition of nonstandard sensor and controls so that the next unused number is picked instead of having to supply the number. * lib/oem_atca.c: Modified the controls for the IPMCs to let the control code pick the control number. This handles a problem controls not being handled correctly for ATCA blades with multiple FRUs. 2006-11-10 Corey Minyard * lib/domain.c: Don't set a connection inactive if it goes down, let the active-reporting interface handle that. Otherwise systems without inactive links will report inactive if the connection goes down. 2006-11-09 Corey Minyard * swig/python/openipmigui/gui_list.py: Added a way to set the style of a column entry. * swig/python/openipmigui/gui.py: Added a "watch list" to the GUI. You can put controls, entities, and sensors you want to watch into this list and monitor them. * swig/python/openipmigui/_sensor.py: Add support for the watch list. * swig/python/openipmigui/_control.py: ditto * swig/python/openipmigui/_entity.py: ditto 2006-11-08 Corey Minyard * Makefile.am, configure.in: Rework the setting up of the library environment for Perl and Python. The code would, by default, pick up the libraries from the installed directory instead of the local directories. For lack of a better option, the modifications LD_PRELOAD the libraries that are required. Also make the setting of the libs required by swig cleaner and put it in a common place. * swig/perl/Makefile.am: ditto * swig/python/Makefile.am: ditto * swig/python/openipmigui/Makefile.am: ditto 2006-11-07 Corey Minyard * swig/python/openipmigui/_fru.py: Added a refresh button to re-read the whole FRU contents. This allows you to change multi-record data and see what happens. * swig/python/openipmigui/gui.py: Got wheel mouse scrolling working. * swig/python/openipmigui/gui_list.py: ditto * swig/python/openipmigui/gui_treelist.py: ditto * swig/python/openipmigui/gui_setdialog.py: Added an option to allow using a Text widget for multi-line input (for multi-record data). * swig/python/openipmigui/_fru.py: Use the long option to gui_setdialog for binary or unicode data. * include/OpenIPMI/ipmi_fru.c, lib/fru.c, include/OpenIPMI/ipmi_fru.h: Added infrastructure for getting enumeration values from FRU nodes. * lib/normal_fru.c: Added enumeration support for multirecord FRU nodes. * lib/oem_atca_fru.c: Added enumeration stuff for the few items that need it. * swig/OpenIPMI.i: Added the enumeration interface. * swig/python/openipmigui/_fru.py: Added support for the new FRU enumerations. 2006-11-06 Corey Minyard * include/OpenIPMI/internal/ipmi_fru.h, lib/normal_fru.c: Redid the adjustment of offsets and lengths to work properly with nested arrays. * swig/python/openipmigui/gui_cmdwin.py: Fixed some problems dealing with backspace and delete. 2006-11-05 Corey Minyard * include/OpenIPMI/internal/ipmi_fru.h, lib/normal_fru.c: Reworked the way writing to arrays is done so it is cleaner and allows insertion at arbitrary points and elements that are other arrays or basic items. * include/OpenIPMI/ipmi_fru.h: Worked on docs for the changes. * swig/python/openipmigui/_fru.py, lib/oem_atca_fru.c: Adjusted for the previous changes. * swig/OpenIPMI.i: Make sure the string on an empty binary array is terminated. 2006-11-03 Corey Minyard * lib/oem_atca_fru.c: Massive rewrite to make this table-driven and add setting capability. * swig/python/openipmigui/gui_treelist.py: Add the ability to insert items before a list element. * swig/python/openipmigui/_fru.py: Add the ability to insert items before an array element. Fix boolean handling. * lib/normal_fru.c, include/OpenIPMI/internal/ipmi_fru.h: Move the FRU decoding from the ATCA code into here and make it generic. Convert the standard FRU multirecord handling to the new code. * lib/oem_atca_fru.c: Convert multirecord handling over to the generic version. * configure.in: Move to version 2.0.9-rc1 2006-11-01 Corey Minyard * lib/entity.c: Fixed a problem with scanning entity association records. * include/OpenIPMI/ipmi_fru.h, lib/normal_fru.c: Added multi-record helper functions for modifying multirecord data. * lib/normal_fru.c: Fixed some problems dealing with multirecord lengths. * lib/oem_atca_fru.c: Added writing FRU data for the address table. * swig/python/openipmigui/_fru.py: Adjustment to improve the way this works. 2006-10-31 Corey Minyard * include/OpenIPMI/ipmi_fru.h, lib/normal_fru.c: Added some better handling of multirecord modification. * lib/fru.c: Warn and recover on zero-length FRU writes. * lib/normal_fru.c: Added better setup handling for new FRU areas. * lib/normal_fru.c: Added FRU area data to the FRU information. * swig/python/openipmigui/_fru.py: Added support for re-displaying the FRU data if FRU area offset data changes. * swig/python/openipmigui/gui_treelist.py: Added support for clearing all the data in the list. 2006-10-30 Corey Minyard * include/OpenIPMI/ipmi_fru.h, include/OpenIPMI/internal/ipmi_fru.h: Added functions for getting a FRU array's subtype. * lib/fru.c: ditto * swig/OpenIPMI.i: ditto * swig/OpenIPMI.i: Modify fetching a subtype to return the array length (or -1 for non-arrays) in the value of get_field() on sub nodes. * lib/normal_fru.c: Added subtype handling for custom string arrays. * lib/normal_fru.c: Fixed reporting of arrays in custom strings so that it is possible to tell an empty array from a non-existent field. * swig/python/openipmigui/gui_treelist.py: Added the ability to remove items from the tree and added better cleanup facilities. * swig/python/openipmigui/_fru.py: Added the ability to remove array items. 2006-10-28 Corey Minyard * include/OpenIPMI/ipmi_fru.h, include/OpenIPMI/internal/ipmi_fru.h: Added basic function interfaces for setting values in FRU nodes. * lib/fru.c: Added infrastructure for setting FRU nodes. * lib/normal_fru.c: Added support for setting the basic FRU item through the FRU nodes. * lib/oem_atca.c, lib/oem_atca_fru.c: Modified for new multirecord handling for setting, though no set support yet. * swig/OpenIPMI.i: Added support for the new FRU node set field and settable functions. * swig/python/openipmigui/_fru.py: Added support for setting FRU items. 2006-10-27 Corey Minyard * lib/oem_atca.c, doc/IPMI.ltx: Created a power feed control for ATCA shelfs. 2006-10-26 Corey Minyard * lib/entity.c, include/OpenIPMI/internal/ipmi_entity.h: Added a function to refetch entity FRU information and report when it is done. * lib/entity.c, include/OpenIPMI/ipmiif.h.in: Added a way to know when an entity that is reported present has all its data (FRU information) fetched. * cmdlang/cmd_entity.c: Added reporting of entities being fully up. 2006-10-25 Corey Minyard * lib/oem_atca_fru.c: Added all the current ATCA-defined FRU information multirecord descriptors. * cmdlang/out_fru.c: Only parse the given number of array elements, don't rely an an error return to finish the array. * lib/entity.c: Fix a small problem where there was a remote chance that a FRU fetch would occur before the entity was reported present. * lib/normal_fru.c: Fix a memory leak with multirecords that don't have decoders. * swig/python/openipmigui/_domain.py: Added a way to dump arbitrary FRU info in a domain. * swig/python/openipmigui/gui_treelist.py: Added a way to expand the entire tree. * swig/python/openipmigui/_fru.py: Expand the entire tree when displaying FRU information. 2006-10-24 Corey Minyard * include/OpenIPMI/ipmi_domain.h, lib/fru.c: More work on the special FRU handling. * lanserv/emu.c, lanserv/emu.h, lanserv/lanserv_emu.c: Added support for ATCA FRU locking. * lib/oem_atca.c: Added FRU data handling for reading/writing FRU inventory device 254 on the shelf manager. * swig/python/openipmigui/_fru.py: Make sure FRU data gets freed. 2006-10-23 Corey Minyard * include/OpenIPMI/ipmi_bits.h, lib/strings.c: Add some new sensor types from IPMI 2.0. * lib/oem_atca.c: Added support for detecting version changes with a version change sensor event. * include/OpenIPMI/ipmi_domain.h, lib/domain.c, lib/fru.c: Added infrastructure for handling special FRU characteristics for a domain. 2006-10-22 Corey Minyard * lib/oem_atca_conn.c: Fixed a few glitches with the new ATCA auxiliary connection facility. * doc/IPMI.ltx: Added info on the new ATCA capabilities. 2006-10-21 Corey Minyard * lanserv/emu.c, lanserv/emu.h, lanserv/lanserv_emu.c: Added support for the PICMG get IP addresses and get FRU control capabilities commands. * lib/domain.c: Interpret ENOENT from a low-level connection change to mean the connection no longer exists. * lib/oem_atca.c: Free the new FRU control capabilities controls. * lib/oem_atca_conn.c: Clean up the ATCA IP address pinging stuff to work properly. * sample/rmcp_ping.c: Fix a problem with specifying the port. * swig/python/openipmigui/gui.py: Add a port removal function. * swig/python/openipmigui/_domain.py: Pass some more parameters to the port up function. * swig/python/openipmigui/_conn.py: Allow dynamic changes to the ports. 2006-10-20 Corey Minyard * include/OpenIPMI/ipmiif.h.in, lib/domain.c: Added a function to get port information. * include/OpenIPMI/ipmi_conn.h, lib/ipmi_lan.c: ditto * cmdlang/cmd_conn.c, man/ipmi_cmdlang.7: Added support for the new port information. * swig/OpenIPMI.i: ditto * swig/python/openipmi/_conn.py: ditto * include/OpenIPMI/ipmi_lan.h, lib/ipmi_lan.c: Exposed some internals for use by the OEM ATCA handler dealing with RMCP ping sockets. * include/OpenIPMI/ipmi_picmg.h: Added the new PICMG messages from the new ATCA spec. * lib/oem_atca_conn.c: Added support for ATCA RMCP ping sockets so that the auxiliary IP connections on ATCA chassis can be monitored. 2006-10-16 Corey Minyard * doc/IPMI.ltx: Added some docs on redundant connections and on ATCA. * man/openipmicmd.1: Added information about the proper handling of response messages. * swig/python/openipmigui/gui.py: Fix a problem where sensor settings would get greyed 2006-10-12 Philipp Hahn * man/ipmi_cmdlang.7: Various cleanups * man/openipmi_conparms.7: ditto * man/openipmigui.1: ditto * man/openipmish.1 ditto * man/rmcp_ping.1 ditto 2006-10-13 Corey Minyard * swig/python/openipmigui/_mc_lanparm.py: Fix a problem in a pulldown. 2006-10-11 Corey Minyard * swig/python/openipmigui/_misc.py: Added an int array to hex string converter. * swig/python/gui_cmdwin.py: Print command output in hex. * swig/python/_sel.py: Print event data in hex. 2006-10-06 Corey Minyard * lib/ipmi_smi.c: Fix the IPMB address setting code to only set the channels that are reported to it. * lib/oem_atca_conn.c: Properly initialize the ipmb array that is passed to the other code. 2006-10-05 Corey Minyard * sample/ipmi_serial_bmc_emu.c, sample/Makefile.am: Added a serial BMC emulator. 2006-09-22 Corey Minyard * swig/python/openipmigui.py: Fixed a problem dealing with different python/TCL thread models in the GUI. Major ugliness. See the code for details. * configure.in: Move to version 2.0.8 2006-09-21 Coly Li * swig/python/Makefile.am: Fix the path mistake for install handling. 2006-09-21 Coly Li * swig/OpenIPMI.i: add the missed IPMI_SWIG_C_CB_EXIT to add_domain_change_handler and remove_domain_change_handler. 2006-09-20 Corey Minyard * cmdlang/Makefile.am: Add proper uninstall handling * include/OpenIPMI/Makefile.am: ditto * include/OpenIPMI/internal/Makefile.am: ditto * sample/Makefile.am: ditto * swig/perl/Makefile.am: ditto * swig/python/Makefile.am: ditto * swig/python/openipmigui/Makefile.am: ditto * swig/OpenIPMI.i: Fix a misnamed #ifdef that caused cleanup_lang() to not be called. 2006-09-19 Corey Minyard * swig/python/openipmigui/_mc_solparm.py: Use the proper data object for a SOL parameter window. 2006-09-15 * man/openipmicmd.1: Fix the man page number in the header. 2006-09-13 Corey Minyard * lib/mc.c: Don't set the event receiver in the MC recheck if the user has asked it to not be set. 2006-08-24 Corey Minyard * swig/python/openipmigui/gui_list.py: Split up the list processing into two parts, one for a standalone toplevel list, and one for a list that can be contained in something else. 2006-08-01 Corey Minyard * configure.in, doc/Makefile.am: Autodetect the dia version and use the right command-line arguments depending on version. * Makefile.am, swig/Makefile.am: Add DIST_SUBDIRS so "make dist" will work even if you don't have all the tools present. * Makefile.am, include/OpenIPMI/Makefile.am: Added proper files to DISTCLEANFILES. 2006-07-31 Corey Minyard * lib/entity.c: Fixed a problem with error handling for bad SDRs. 2006-07-24 Corey Minyard * FAQ - Added info on interpreting errors. 2006-07-22 Corey Minyard * lib/rakp.c: Fix a problem that causes a crash in RMCP+ if the IPMI interface is deleted between the RAKP1 and RAKP3 messages. * swig/python/openipmigui/_mc_chan.py: Fix a shutdown problem that could cause wierd things to happen if you delete the channel window while it was being fetched. 2006-07-21 Gerhard Obrecht * lib/oem_kontron_conn.c: Add more board support and fix some IPMB addressing problems. 2006-07-18 Corey Minyard * swig/python/openipmigui.py, swig/python/openipmigui/gui.py: Fix some problems with shutdown, gets rid of an annoying failure at shutdown and fixes a lockup problem if there are no domains. 2006-07-16 Corey Minyard * sample/sample.c: Change over to use ipmi_parse_args2() so we are setting a good example for the users. * sample/sample2.c: ditto * sample/sample3.c: ditto 2006-06-27 Corey Minyard * swig/python/openipmigui/gui.py: Fix cleanup of items to clear out parents properly. 2006-06-23 Gerhard Obrecht * lib/oem_kontron_conn.c: Add new board support. 2006-06-18 Corey Minyard * FAQ, README: Add info about the encryption used by OpenIPMI. 2006-06-08 Corey Minyard * configure.in: Convert wxpython into Tkinter. * configure.in: Older version of Tcl don't have Tcl_GetTime, they have an equivalent TclpGetTime (that was private, but everyone still used it). * README - Update some information, including adding all the required and optional packages. * OpenIPMI.spec.in: Added the Tcl stuff. * Makefile.am: Added CONFIGURING_FOR_LAN * configure.in: Move to version 2.0.7. 2006-06-07 Corey Minyard * swig/python/openipmigui/*: Get SoL and the command window working with Tix, the GUI conversion is complete except for testing. * doc/Makefile.am: Convert the export option for dia from --export-to-format to --filter. 2006-06-02 Corey Minyard * lib/pefc.c: Only call the set_done() callback if it is non-NULL. * lib/mc.c: If a set_user() call is done with nothing changed in the user, make sure the handler is not NULL before calling and call the right free function. * swig/python/openipmigui*: Rewrote the GUI using Tk. The SOL terminal is not done yet, but I think everything else works. Still needs testing, but most stuff should work ok. 2006-06-01 Corey Minyard * swig/OpenIPMI.i: Fix some problems with TCL not doing logs correctly. 2006-05-31 Corey Minyard * configure.in: For gdbm, make sure to check for the library and not just the header file. 2006-05-30 Corey Minyard * configure.in: Fix the TCL_LIBS value when --with-tcllibs is hand-specified. 2006-05-26 Corey Minyard * lib/mc.c, lib/ipmi_lan.c: Fix a couple of more signed/unsigned comparison warning. * swig/OpenIPMI.i: Fix the TCL init code. 2006-05-12 Corey Minyard * include/OpenIPMI/ipmi_posix.h: Remove selector interface. * unix/posix_os_hnd.c: Remove selector interface and make sset_log_handler static. * unix/posix_thread_os_hnd.c: ditto * cmdlang/os_debug.c: Make sset_log_handler static. * unix/selector.c: Rework the mutex code to use the os handler, not some special interfaces that break static compiles. 2006-05-02 Corey Minyard * include/Makefile.am, include/net, lib/ipmi_smi.c, lanserv/lanserv.c: Remove include/net, as the socket interface is not used any more. * README: Improved the code structure information. 2006-04-18 Corey Minyard * configure.in, lanserv/lanserv.c: Add detection for syslog. 2006-04-06 Corey Minyard * tcl/tcl_os_hnd.c, tcl/test_handlers.c: Get these working. * cmdlang/ipmish.c: Add TCL support. * swig/OpenIPMI.i: ditto * swig/perl/Makefile.am: ditto * swig/python/Makefile.am: ditto 2006-04-05 Corey Minyard * tcl/*, include/OpenIPMI/ipmi_tcl.h, configure.in, Makefile.am: Start adding TCL support. * OpenIPMItcl.pc.in: ditto 2006-03-31 Corey Minyard * */Makefile.am: Add -Wsign-compare to find signed/unsigned comparison problems. * practically everything: Fixed signed/unsigned comparison problems. 2006-03-18 Corey Minyard * lib/sel.c: There were some subtle problems with deletes of large SEL contents with per-event deletion. This cleans those up to make deleting large numbers of SEL entries more efficient. * swig/python/openipmigui/_sel.py: Call DeleteAllItems, not ClearAll, to remove all the elements of the list. ClearAll cleared the columns, too. 2006-03-17 Corey Minyard * lib/ipmi.c: Fix a bug, the input length for binary/unicode data wasn't being checked in device string parsing. * lib/ipmi.c, include/OpenIPMI/internal/ipmi_int.h: Modify ipmi_get_device_string() to return an error instead of the length, so that errors can be handled properly in device strings. * lib/normal_fru.c: Adjust for previous change. * lib/oem_atca.c: ditto * lib/oem_atca_fru.c: ditto * lib/entity.c: ditto * lib/sensor.c: ditto * swig/python/openipmigui/_sel.py: Cleaned up this file. 2006-03-14 Corey Minyard * lib/domain.c: If the ipmi connections received in ll_event_handler is invalid, ignore the event. * lib/oem_atca_conn.c: Fix the passing of the ipmb array in an error path. * include/OpenIPMI/ipmi_conn.h, lib/conn.c: The statistics interface for connections was broken for supporting multiple domains with the same connection. Add a new interface that is capable of this. * lib/lan.c: Add the new statistic interface support. * lib/domain.c: ditto 2006-03-01 Corey Minyard * lib/oem_atca_conn.c: Need to pass an entire channel set's worth of IPMB addresses to the IPMB address change handlers. * lib/oem_kontron_conn.c: ditto * lib/oem_force_conn.c: ditto * lib/oem_motorola_conn.c: ditto * util/ipmi_malloc.c: Fixed some problems with some memory debugging handling. With memory debugging on, it would leak memory! * lib/sdr.c: Added some trace debugging stuff. * lib/ipmi_lan.c, lib/ipmi_smi.c: Added printing of connection names in debug output (where possible). * lib/mc.c: Don't start operations unless the MC is in the proper state. * lib/entity.c: Make sure only one presence check is running at a time. * swig/python/openipmigui/gui.py: Fixed some ordering problems, make sure things are not used after deletion. * swig/python/openipmigui/fru.py: Handle some problems dealing with certain FRU data combinations. * lib/sel.c, lib/mc.c: Fix the SEL name string. * configure.in: Move to version 2.0.6. 2006-02-28 Corey Minyard * lib/chassis.c: Make sure to remove the active handler from the list when deleting the control. * lib/mc.c: If the timer was stopped due to a not running condition, mark the timer as stopped. * swig/python/openipmigui/_domain.py: Fix the interpretation of the "connected" parameter is the connection reporting. It means that any connection to the domain is up, not that the particular connection is up. * libedit/read.c: Don't beep on el_push, that causes way too much beeping for my taste. * lib/ipmi_lan.c, lib/ipmi_payload.c, include/OpenIPMI/ipmi_lan.h: Make sure ipmi->handle_send_rsp_err is called outside of the sequence lock. * lib/sensor.c, include/OpenIPMI/internal/ipmi_sensor.h: Removed the internal sensors wait queue (part of ipmi_sensors_t). This was only used to serialized SDR access, but the sdr has it's own wait queue, so this was kind of pointless. * lib/mc.c: Removed the use of the sensor wait queue. It caused problems handling failure conditions and was pointless. Also added some debug tracing stuff. 2006-02-27 Corey Minyard * lib/ipmi_lan.c: Make sure use_orig_addr is handled in all cases, including timeouts and shutdown. * lib/domain.c: Set the connection name to something more useful. * swig/python/openipmigui.py: Add a log to stdout option. * lib/mc.c: Rework the startup code to properly handle all types of failures. Some failure cases were not handled correctly and could leave things hanging. * lib/sdr.c: Add a useful name and proper handling of shutdown situations to avoid leaks. 2006-02-26 Corey Minyard * lib/domain.c, lib/ipmi.c: Don't copy address information for system interface address responses, use the address the sender supplied. This fixes problem with system interface MC scanning. * cmdlang/cmd_sensor.c: Fixed some misnamed comments. * lib/entity.c: Make sure the domain exists before calling _ipmi_put_domain_fully_up(). * lib/ipmi_lan.c: Don't call the LAN close_done call until all the messages have been returned as errors. * lib/mc.c: Fix some accounting problems with errors and startup_count. * lib/oem_motorola_mxp.c: Don't add an AMC is the removal handler can't be registered. * lib/sensor.c, lib/control.c: Add some missing MC gets and puts. * swig/python/openipmigui/*: Fix a lot of little problems with handling certain failure cases, removal and adding of sensors, and a host of other things. 2006-02-25 Corey Minyard * swig/python/openipmigui.py, man/openipmigui.1: Add the ability to send log output to stderr as well as the command window. * lib/entity.c: Fixed some possible deadlocks dealing with the built-in hot-swap state machine and presence handling. 2006-02-24 Corey Minyard * swig/python/openipmigui.py, man/openipmigui.1: Added some command-line parameters to control some thing about the GUI. * sample/rmcp_ping.c, sample/Makefile.am, man/rmcp_ping.1: Add a command to do RMCP pinging. * OpenIPMI.spec.in: Add the rmcp_ping program. * lib/sel.c: Fix some possible deadlocks. * include/OpenIPMI/ipmi_conn.h: Added a way to discover how many ports the connection supports. * lib/ipmi_lan.c: Add the function to return the number of ports. * lib/domain.c: Set the enabled ports right at startup to avoid invalid readings of the number of ports. * lib/entity.c: Fix a memory leak in certain error conditions using the internal hot-swap state machine. * lib/ipmi_lan.c: Fix some locking problems that could lead to deadlock. Don't call connection handlers in certain timeout cases with the sequence lock held. * lib/oem_motorola_mxp.c: Add some missing entity puts. * swig/python/openipmigui/*: Fixed problems with entities that need to be re-parented. 2006-02-14 Corey Minyard * utils/os_handler.c, include/OpenIPMI/os_handler.h: Add an interface to allow easier waiting for IPMI things to complete. * utils/Makefile.am: Add the new os_handler.c file. * unix/test_handlers.c, unix/Makefile.am: Add some OS handler tests and tests for the wait operations. 2006-02-13 Radisys * lib/ipmi_smi.c: Fix the IPMB address setting code to actually use the right types when interacting with the driver. 2006-02-12 Corey Minyard * OpenIPMI.spec.in: Added some missing files. * configure.in: Move to version 2.0.5. 2006-02-11 Corey Minyard * lib/lanparm.c: Added a hack for non-compliant systems that return 0xcc for unsupported LANPARM parameters instead of the proper 0x80 return code. 2006-02-10 Corey Minyard * cmdlang/Makefile.am: Fix so it will install into any random directory. * glib/Makefile.am: ditto * lanserv/Makefile.am: ditto * lib/Makefile.am: ditto * sample/Makefile.am: ditto * ui/Makefile.am: ditto * unix/Makefile.am: ditto * lib/lanparm.c: Fixed a data overrun in ipmi_lanparm_set_config. * lib/solparm.c: ditto * swig/python/openipmigui/*: Fixed a bunch of problems dealing with wxPython 2.4 issues. Ugly... * lib/normal_fru.c: Fix a cleanup order problem. * lib/domain.c, include/OpenIPMI/ipmiif.h.in: Added a way to get the connection type string. * swig/OpenIPMI.i: Added the connection type string. * swig/python/openipmigui/_conn.py: Print the connection type. * cmdlang/cmd_control.c: Don't return that we handles the event, pass it on. * cmdlang/cmd_entity.c: ditto * cmdlang/cmd_sensor.c: ditto * cmdlang/cmd_sel.c: ditto * swig/python/openipmigui/_entity.py: ditto * swig/python/openipmigui/_sensor.py: ditto * swig/python/openipmigui/errstr.py: Only do a clear in 2.4 * swig/python/openipmigui/_sel.py: Fix problems deleting single events. 2006-02-10 Coly , Corey Minyard * libedit: Add this directory * cmdlang/ipmish.c, cmdlang/Makefile.am: Add support for libedit into ipmish. 2006-02-10 Corey Minyard * configure.in: Convert over to use config.h instead of passing everything on the command line for the compiler. * cmdlang/ipmish.c, cmdlang/os_debug.c: ditto * glib/glib_os_hnd.c: ditto * lanserv/lanserv_config.c, lanserv/lanserv_ipmi.c: ditto * lib/aes_cbc.c, lib/hmac.c, lib/md5.c, lib/rakp.c: ditto * lib/ipmi.c, lib/ipmi_lan.c, lib/ipmi_smi.c: ditto * swig/OpenIPMI.i: ditto * swig/perl/Makefile.am: ditto * swig/python/Makefile.am: ditto * ui/basic_ui.c: ditto * unix/posix_os_hnd.c, unix/posix_thread_os_hnd.c: ditto * utils/ipmi_malloc.c: ditto 2006-02-09 Corey Minyard * configure.in: Added more support for handling dual glib libraries (1.2 and 2.0) in the swig stuff. * glib/Makefile.am, glib/glib_os_hnd.c: Added more support for handling dual glib libraries. * include/OpenIPMI/ipmi_glib.h: ditto * swig/Makefile.am: Removed glib shim, as it was not going to work. * swig/OpenIPMI.i: Fixed the glib stuff so it works properly with dual glib libraries. * swig/perl/Makefile.am, swig/python/Makefile.am: ditto * swig/python/openipmigui/_SoL.py: Fixed to work with wxPython 2.4. * swig/OpenIPMI.i: Added missing callback entry and exit markers for SoL. * swig/python/openipmigui/gui.py: Fixed getting boolean attributes so it works with older versions of python. 2006-02-08 Corey Minyard * swig/perl/OpenIPMI_perl.c, swig/python/OpenIPMI_lang.i: Added a new return value type that will take an empty return and not modify the return value. * swig/OpenIPMI.i: Allow event handlers to take return values from the handler, but preserve current semantics. * swig/python/openipmigui/_entity.py: Cleanup and set return values from event handlers. * swig/python/openipmigui/_sensor.py: ditto * include/OpenIPMI/ipmiif.h.in, include/OpenIPMI/ipmi_bits.h: Added a way for an event handler to "handle" the event (not send it to the unhandled event handler) but still pass the event data on to other handlers. * lib/sensor.c, lib/control.c, lib/entity.c: ditto * lib/entity.c: Changed the internal presence handling to never pass an event (since one is never really available, and shouldn't matter). The API is still there, though, and should be handled as before. * lib/oem_atca.c: Fixed a missing event handled initialization. * swig/OpenIPMI.i: Added the new IPMI_EVENT_HANDLED_PASS return value. * swig/python/openipmigui/_entity.py: Switched to the pass event handler return. * swig/python/openipmigui/_sensor.py: ditto * cmdlang/cmd_control.c: ditto * cmdlang/cmd_entity.c: ditto * cmdlang/cmd_control.c: ditto * configure.in, glib/Makefile.am, glib/glib_os_hnd.c: Add support for a separate glib 1.2 library, so we can build with either. * OpenIPMIglib.pc.in: Fix some linking problems, don't need the glib libs or cflags. * OpenIPMIglib12.pc.in: Add this for the new glib 1.2 library. * swig/Makefile.am, swig/glibshim.c, swig/OpenIPMI.i: Add a glib shim so we can do both glib-2.0 and glib-1.2 at the same time. * swig/python/openipmigui.py: Add some parameter handling * swig/python/openipmigui/_domain.py: Fix some problems with handling python 2.2. * swig/python/openipmigui/_term.py: ditto 2006-02-07 Corey Minyard * lib/lanparm.c, include/OpenIPMI/ipmi_lanparm.h: Add a way to detect if a parm is an enum and get the enum string and index values. * lib/solparm.c, include/OpenIPMI/ipmi_solparm.h: ditto * lib/pef.c, include/OpenIPMI/ipmi_pef.h: ditto * swig/OpenIPMI.i: Add the new enum interfaces for lanparm and solparm and pef. * swig/python/openipmigui/_SoL.py: Add an error report if SoL won't work on an interface. * swig/python/openipmigui/_mc_chan.py: Add support for detecting if an MC supports SoL before offering solparm configuration. * swig/python/openipmigui/_mc_lanparm.py: Add support for handling enum values. * swig/python/openipmigui/_mc_lanparm.py: ditto * lib/pef.c: Return EAGAIN if the lock could not be claimed on the PEF config fetch. * swig/python/openipmigui/_mc.py: Add support for detecting if an MC supports PEF and offser PEF configuration menu items for it if so. * swig/python/openipmigui/_mc_pef.py: Add support for PEF configuration. * swig/python/openipmigui/Makefile.am: Add solparm and pef configuration files. * Makefile.am: Added the ability to run the GUI from the main makefile. * man/openipmigui.1: Added docs on SOL, pefparms, solparms, and fixed up a few things. * lib/cmd_mc.c: Added the ability to dump all channels easily, and added useful string names to the channel info. 2006-02-06 Corey Minyard * lib/solparm.c, include/OpenIPMI/ipmi_solparm.c: Added configuration of SoL parameters. * lib/Makefile.am, include/OpenIPMI/Makefile.am: Added new solparm files. * cmdlang/cmd_solparm.c, cmdlang/cmdlang.c, cmdlang/Makefile.am: Added support for solparms. * swig/OpenIPMI.i: Added support for solparms. * swig/OpenIPMI.i: Fixed bugs in lanparm and pef config and parm set handling, they were referencing a possibly uninitialized variable. * swig/python/openipmigui/_mc_solparm.py: Added solparm support in the GUI. * swig/python/openipmigui/_mc_chan.py: Tie-ins for solparm support are here. * swig/python/openipmigui/Makefile.am: Add the new solparm file. 2006-02-03 Corey Minyard * lib/ipmi_sol.c: Fixed some problem with nack handling. * swig/OpenIPMI.i: The nack_release function had an invalid parameter. * swig/python/openipmigui/_term.py: Finished out a lot of the ANSI handling and added color support. 2006-02-02 Corey Minyard * swig/python/openipmigui/_SoL.py: Add in all the SoL handling. 2006-02-01 Corey Minyard * swig/python/openipmigui/_term.py: Lots of work on terminal emulation and improving performance. 2006-01-28 Corey Minyard * swig/perl/OpenIPMI_perl.c, swig/perl/OpenIPMI.h: Added the ability to return a return value from a function. * swig/python/OpenIPMI_lang.i: ditto * swig/OpenIPMI.i: Modified sol_data_received_cb to handle the return value properly. * include/OpenIPMI/ipmi_sol.h, lib/ipmi_sol.c: Added a function to release a SOL NACK situation. * swig/OpenIPMI.i: Added the SOL NACK release function. * swig/python/openipmigui/_term.c: Fixed a problem with character handling. 2006-01-27 Corey Minyard * lib/domain.c: If the BMC returned a completely bogus response to a get device id during connection startup, the domain would remain in a perpetually messed up state. This adds something to the normal domain audit to detect this situation and try again. * lib/ipmi_sol.c: Worked on the packet and state locking to make sure that a lock was held during state changes, locks were not held in callbacks, and callbacks are done in the right order. * lib/ipmi_sol.c: Added code to do packet processing in order and not hold locks in callbacks. This required some complicated additions of wait lists, but should guarantee to the user that all callbacks will be in order and will occur one at a time from a SoL connection. * lib/entity.c: Modified MC refcounts to not be held over a message. Bad idea. * lib/ipmi_lan.c: The OEM finished callback could return a NULL connection if shutdown was occurring, handle that. * swig/python/openipmigui/_cmdwin.py: Added history saving for the command window. * swig/python/openipmigui.py: ditto * swig/python/openipmigui/_saveprefs.py: Clean up error handling. * swig/python/openipmigui/gui.py: Clean up shutdown so that domains are cleaned up no matter how the shutdown occurs. * swig/python/openipmigui/Makefile.am: Modify python path to allow building and execution in alternate object directories. * swig/perl/Makefile.am: Modify paths to allow make check to work in alternate object directories. 2006-01-26 Corey Minyard * lib/normal_fru.c: Clear out the FRU settings if the FRU decode fails, to avoid a crash at FRU destruction time. 2006-01-25 Corey Minyard * lib/strings.c: Added some sensor code strings specified by errata to the spec. * lib/ipmi_sol.c: Replaced the callback_lists used for reporting status with locked lists. The locked-lists are race-free and handle all the deletion while in use type cases. * lib/ipmi_sol.c: Make logging consistent with the rest of OpenIPMI, add the filename and function to all logs. * lib/ipmi_sol.c: Add locking for OOB handling, as it was racy. * lib/ipmi_sol.c, lib/ipmi.c: Moved SOL payload registration to initialization routines so it is only done once. * lib/ipmi_sol.c: Added locks for the SoL connection list and reworked the list so the memory allocation is not required. * lib/ipmi_sol.c: Consolidated the callback list handling into the one place it was left in use. Converted all the fatal logs into severe ones since fatal means the logger should termintate the program. * lib/ipmi_sol.c: Added refcounting to make sure the sol connection is not in use when it is deleted. * lib/ipmi_sol.c: Reworked the timer code to handle shutdown races properly. 2006-01-24 Corey Minyard * lib/ipmi_sol.c: Modified formatting to conform with the OpenIPMI standard formatting. Make a few minor fixes (marked with FIXMEs for now). * lib/ipmi_sol.c: Fixed a bunch of memory leaks. Still some left with the callback lists, but those need to be replaced with locked lists, so they are not worth fixing right now. * swig/python/openipmigui/_term.py: Started working on a terminal emulator for SoL. * swig/python/openipmigui/_SoL.py: Started working on SoL interface code for the GUI. * swig/pythong/openipmigui/Makefile.am: Added the above two files. 2006-01-20 Corey Minyard * include/OpenIPMI/ipmi_conn.h: Added a way to send messages with options; primarily for supporting per-packet authentication and encryption settings. * include/OpenIPMI/ipmi_sol.h: Added C++ handling. * lib/ipmi_lan.c: Added the ability to support per-packet encryption and authentication for asynchronous packets (primarily for SOL) using the previous change to the connection interface. * lib/ipmi_sol.c: Added the ability to support separate authentication and encryption on the interfaces. Also, default the values to use encryption. * sample/solterm.c: Modify to use encryption and authentication by default. Also modify the way connection parameters are specified so that it is standard (the "lan" is required") and get the connection help via the standard interface. Also removed all the DOS newlines and converted them to *nix. * man/Makefile.am, man/openipmi_conparms.7: Added a man page on the standard connection parms, so it doesn't have to be in every man page. * man/openipmicmd.1: Swith over to use the new conparms manpage. * man/solterm.1: Added docs for solterm. * lib/domain.c: Fixed a shutdown problem if a shutdown occurred during a bus scan that detected an MC. * swig/python/openipmigui/_domain.py: Fix a problem with shutting down in startup. conn_change_cb could be called after the connections were brought down (due to a race). * swig/OpenIPMI.i: Finish out the SoL interface. * swig/perl/OpenIPMI_perl.c: Add a "*b" format to the callback caller to allow sizes arrays of characters (including nils) to be passed. * swig/python/OpenIPMI_lang.i: ditto 2006-01-19 Corey Minyard * include/OpenIPMI/ipmi_sol.h, lib/ipmi_sol.c: Modified one interface a little to pass the state as the correct type. * include/OpenIPMI/ipmi_con.h: Added a way to increment the usecount for a connection. Right now this is only available on LAN, so that a domain connection can be reused for something else. * lib/ipmi_lan.c: Added the usecount function. * include/OpenIPMI/ipmiif.h.in, lib/domain.c: Added a way to fetch the connections used by a domain. 2006-01-16 Corey Minyard * swig/OpenIPMI.i: Fix a bug in getting some event fields. 2006-01-15 Corey Minyard * man/ipmish.1, man/openipmish.1: Rename ipmish to openipmish. * man/ipmicmd.1, man/openipmicmd.1: Rename ipmicmd to openipmicmd. * OpenIPMI.spec.in: Modify for renames and and the GUI. * swig/OpenIPMI.i: Added some missing docs. * configure.in: Move to version 2.0.4. 2006-01-13 Corey Minyard * cmdlang/Makefile.am: Add os_debug.c into the openipmish build, and remove it from the main library build, to allow the command language to be used elsewhere. * swig/OpenIPMI.i: Add command language interfaces for the swig interfaces. * swig/perl/Makefile.am, swig/python/Makefile.am: Now we need to link with libOpenIPMIcmdlang. * swig/perl/OpenIPMI_lang.i, swig/python/OpenIPMI_lang.i: Add defines for a generic callback (assuming we have already checked it for valid functions). * swig/python/openipmigui/*.py, swig/python/openipmigui.py: Add a command line interface to the GUI. * lib/mc.c: Fixed a memory leak that occurred in certain situations when a shutdown occurs during startup. 2006-01-12 Corey Minyard * lib/ipmi.c, include/OpenIPMI/internal/ipmi_int.h: Massive restructure of the way connections done. All the connection-type specific code was moved out of ipmi.c and into the individual connection code. A way to register connections was added, and ways to query argument fields from connection types was added. Basically, it completely abstract connection type information so new connections can be seamlessly added to OpenIPMI without changing the core code, GUI, or anything else like that. * include/OpenIPMI/ipmi_conn.h, lib/domain.c, lib/ipmiif.h.in: Added a way to get the arguments for a connections. * lib/ipmi_lan.c, lib/ipmi_smi.c: Adjusted for the previous changes. * include/OpenIPMI/ipmiif.h.in, swig/OpenIPMI.i: Added interfaces for the connection abstraction. * swig/perl/OpenIPMI_lang.i, swig/python/OpenIPMI_lang.i: Added types necessary for the new connection abstractions. * swig/perl/test_lanparm, swig/perl/test_pet: Modified due to a previous renumbering of the LAN parameters. * swig/python/openipmigui.py, swig/python/openipmigui/*.py: Massive restructure to use all the previous changes to support dynamically determining connection type content for saving parameters and for querying the user for new connections. Also switched over to using domain watching to detect new domains. 2006-01-10 Corey Minyard * include/OpenIPMI/internal/ipmi_int.h, lib/ipmi.c: Add support for connection-type registration for parsing, to remove all the connection-specific code from ipmi.c. This is very important because it allows OEM connection handlers to register themselves fully and interact with standard mechanisms for connection setup/teardown. Also add a help interface. * lib/ipmi.c: Added handling for multiple calls to ipmi_init() and ipmi_shutdown(). * lib/ipmi_lan.c: Add support for the new parsing interface, basically moving stuff from ipmi.c. * lib/ipmi_smi.c: ditto * lib/ipm_lan.c: Remove _ipmi_lan_handle_connected, as it is not needed any more as MXP is gone. * swig/python/openipmigui/_conn.py: Add support for connection handling in domains. * swig/python/openipmigui/_domain.py: ditto * swig/python/openipmigui/gui.py: ditto * swig/python/openipmigui/Makefile.am: Add the _conn.py file. * sample/ipmicmd.c, sample/Makefile.am: Remove the popt parsing code, it could not properly handle the new-style arguments (that had "-" after popt finished parsing the options. It's a lot shorter without popt, anyway. * include/OpenIPMI/ipmiif.h.in: Added parse args and option help interfaces. * swig/OpenIPMI.i: Added parse args and option help interfaces. * cmdlang/cmdlang.c, include/OpenIPMI/ipmi_cmdlang.h: Add a "help_finish" function to commands to allow dynamic help content. * cmdlang/ipmish.c: Adjust for previous changes. * cmdlang/cmd_domain.c: Make the "domain open" help dynamic based upon the new help interfaces. * include/OpenIPMI/ipmi_conn.h: Add an interface to the connection for returning the current arguments that could be fed to a new connection. 2006-01-09 Corey Minyard * man/openipmigui.1, man/Makefile.am: Started a man page for the GUI. * lib/domain.c, include/OpenIPMI/ipmiif.h: Added a way to rescan all IPMB busses known by the domain. * swig/OpenIPMI.i: Added the rescan all IPMB busses function. * lib/lanparm.c: Moved the num_alert_destinations field to a location that makes more sense. * swig/python/openipmigui.py: Renamed "~/.ipmigui.startup" to "~/.openipmigui.startup" * swig/python/openipmigui/*.py: Finish up user handling, clean up a bunch of other things. 2006-01-08 Corey Minyard * lib/mc.c: Added handling of checking if the channel support RMCP+ before allowing setting of 20-bit passwords. Also allow a null handler for ipmi_mc_set_user(). * swig/python/openipmigui/*.py: Work on IPMI user handling. 2006-01-06 Corey Minyard * swig/OpenIPMI.i: Need a separate blocking and callback setup define, as we might need to handle these differently. * swig/python/OpenIPMI_lang.i: Add defines for the previous change. * swig/perl/OpenIPMI_lang.i: ditto * swig/python/openipmigui/*.py, swig/python/openipmigui.py: More work on getting the 2.4 version of wxPython working. * swig/OpenIPMI.i: Fix a comment, change the users callback and object list reference to pass the proper value. * swig/perl/OpenIPMI_perl.c: Adjust for the previous change. * lib/mc.c: Allow a NULL callback in ipmi_mc_channel_set_access(). * swig/python/openipmigui/*.py: Work on getting the lanparm values and channel values settable. 2006-01-05 Corey Minyard * swig/OpenIPMI.i: Add a way for the languages to plug-in code at the beginning and end of a function that handles callbacks or may block. This allows Python to release the GIL lock in older versions of Python. * swig/python/OpenIPMI_lang.i: Add defines for the previous change. * swig/perl/OpenIPMI_lang.i: ditto * swig/OpenIPMI.i: Only initialize gthreads if it is not already initialized. * swig/python/openipmigui.py: Fix the GUI startup to use the proper OnInit structure for wxPython. * unix/posix_thread_os_hnd.c, unix/posix_os_hnd.c: Fix the get_random() function to fill in all the data. * swig/python/openipmigui/*.py: Convert over from the wxPython 2.6 Bind() functions to the older EVT_xxx() bind functions. 2005-12-30 Corey Minyard * swig/OpenIPMI.i: Fix problems with the channel info and channel access data structures provided in callbacks; make copies of those so the use can keep them around in the swig languages. Also add copy operations on the channel access and user data structures and fix some problems with references on various set operations. * swig/python/OpenIPMI_lang.i: Create references for objects passed to Python parameters, since Python doesn't do that automatically. * swig/python/openipmigui/Makefile.am: Add _mc_chan.py and _mc_lanparm.py. * swig/python/openipmigui/_mc_chan.py: Add MC channel info handling * swig/python/openipmigui/_mc_lanparm.py: Add MC lanparm handling. * swig/python/openipmigui/_domain.py: Fix some formatting * swig/python/openipmigui/_mc.py: Add support for the MC channel and lanparm handling. 2005-12-29 Corey Minyard * lib/ipmi_payload.c: Fix things so send message commands can be routed through a LAN channel. This allows ATCA AMCs to be directly communicated with. 2005-12-28 Corey Minyard * cmdlang/cmd_domain.c, man/ipmi_cmdlang.7: Add doc info about the authtype and privilege fields. * lib/rakp.c: Fix a comment error about the message the rolem hack applies to. * swig/python/Makefile.am: Add a way to run the gui from the makefile, to avoid having to set the paths by hand. 2005-12-20 Corey Minyard * doc/IPMI.ltx: Fixed a cross reference. * doc/Makefile.am: Fixed the latex build to run bibtex and latex the apropriate number of times. 2005-12-14 Corey Minyard * swig/OpenIPMI.i, swig/python/OpenIPMI_lang.i: Added support for older versions of Python. * OpenIPMI.spec.in: Cleaned up some GUI stuff. * swig/python/openipmigui: Lots of work in this directory, have a mostly complete GUI now. * include/OpenIPMI/ipmi_posix.h; Added posix_vlog() back so openhpi will compile. posix_vlog() is still considered deprecated, though. * unix/posix_thread_os_hnd.c, unix/posix_os_hnd.c: ditto * cmdlang/cmd_domain.c, man/ipmi_cmdlang.7: Fixed some problems with the "domain open" documentation. * cmdlang/cmd_domain.c: Fixed a problem with a possible memory leak in one failure scenario. * swig/OpenIPMI.i, samples/solterm.c: Switch over to the new log handler. * unix/posix_thread_os_hnd.c: Fix a problem where a wrong function was being called for logging. * swig/OpenIPMI.i, configure.in: Modified things to use the right threads library for perl and python. * swig/perl/Makefile.am, swig/perl/OpenIPMI_lang.i: ditto * swig/python/Makefile.am, swig/python/OpenIPMI_lang.i: ditto * configure.in: Move to version 2.0.3. 2005-12-13 Corey Minyard * lib/rakp.c: Add a proper error handler for timeouts. * lanserv/lanserv_ipmi.c: return an error on invalid auth to rakp3. * cmdlang/ipmish.c, cmdlang/cmd_domain.c: Add useful error reporting. * include/OpenIPMI/ipmi_err.h, lib/strings.h: Added a way to get the length of an error string so it can be dynamically allocated to the right size. * swig/OpenIPMI.i: Added an error string fetcher. 2005-12-08 Corey Minyard * swig/OpenIPMI.i: Added the event method call_handlers that allow an event to be interpreted after the fact. 2005-12-06 Corey Minyard * swig/OpenIPMI.i: Fix wrong name of set_event_log_enable for the MC class. 2005-12-05 Corey Minyard * swig/OpenIPMI.i: Added compare functions for all entity ids. * swig/OpenIPMI.i: Redid all constants to use %constant. Also renamed some misnamed ones, they are not supposed to begin with IPMI_. * swig/OpenIPMI.i: Fixed the hot-swap comments for the auto-activate/deactivate settings. * include/OpenIPMI/ipmiif.h.in, lib/entity.c, swig/OpenIPMI.i: Added a function that returns if the entity supports auto activate or auto deactivate time. * lib/fru.c: Make sure to return an error instead of crashing if a root node fetcher is not installed. * lib/oem_atca.c: Set the auto activate/deactivate function to NULL instead of real functions that return value. That lets the upper level code detect that this is not supported. * swig/python/OpenIPMI_lang.i: Fixes problems with returning NULL char ** and other ** objects. 2005-12-03 Corey Minyard * swig/OpenIPMI.i: Added a method to get the MC id for an entity. 2005-12-02 Corey Minyard * swig/OpenIPMI.i: There was a critical error in the convert_to_xxx methods; they returned a string instead of an error and were inconsistent (A NULL return might mean success or an error). Make them consistently return an int and remove the "convert_" prefix since it seems unnecessary. This is, unfortunately, not backwards compatible, but needs to be fixed. And hopefully there are not too many perl/python users yet. * swig/perl/*, swig/python/*: Adjusted for the previous change. * swig/OpenIPMI.i: Fixed problems dealing with threshold and event strings. * swig/OpenIPMI.i: Have the discrete event handle call the proper callback. * swig/OpenIPMI.i: Add an event delete capability. * swig/python/OpenIPMI_lang.i: Fix a hidden (in a macro) vague else clase. 2005-12-01 Corey Minyard * include/OpenIPMI/ipmi_mc.h, include/OpenIPMI/internal/ipmi_sensor.h: Move the ipmi_sensor_get_mc() call to a more public interface, primarily to give the GUI access to it. * swig/OpenIPMI.i: Add get_mc() to the sensor class. * swig/OpenIPMI.i: Added function to conver the various threshold and event values into strings. 2005-11-30 Corey Minyard * lib/mc.c: Got something wrong in the new MC state machine. Need to call mc_startup without any locks held. * lib/entity.c: Fixed some problems with detecting presence from children. Also fixed some bugs dealing with entity containment SDR records. * swig/OpenIPMI.i: Fix threshold printing 2005-11-29 Corey Minyard * lib/entity.c: Keep the entity key around (channel, IPMB, id, instance) even if the entity's SDR is destroyed. * lib/mc.c: Added a callback when the MC is completely up. This was a major undertaking, the basic operation of MCs had to change substantialy. Before, MCs could go active and inactve any number of times and the transitions were counted and reported appropriately. This no longer happens; the MC will go through a state machine and active/inactive/fully up will only happen in order. * swig/OpenIPMI.i: Add the MC fully up handler methods. * lib/oem_atca.c: Make sure the MC is scanned when the entity is newly present (as well as when it goes away, which was already there). Also some code cleanups. * lib/ipmi_smi.c: Fix a "memory use while free" problem at shutdown. * cmdlang/cmd_domain.c: Remove the code and requirement for including internal/ipmi_event.h * lib/domain.c: Restart the domain audit timer immediately when the timeout is set. * glib/glib_os_hnd.c: Clear the running flag when timer is stopped. 2005-11-28 Corey Minyard * lib/oem_atca.c: Make sure the main entities I create hang around after devices have been removed, so the configured data from the address table stays valid. 2005-11-27 Corey Minyard * swig/python/ipmigui.py: removed * swig/python/openipmigui.py, swig/pythong/openipmigui/*: Started work on a real GUI. * OpenIPMI.spec.in, configure.in: Added GUI directories. 2005-11-26 Corey Minyard * lib/oem_atca.c: Set the number of values properly on non-identifier controls. * swig/OpenIPMI.i: Properly name get_light and set_light (remove the ipmi_control_ from in front of them). Fix a doc error. * include/OpenIPMI/ipmiif.h.in: The setting light information about local control and color support didn't have per-light values, which was a problem. A new interface was added, the old one only works for the first light. * include/OpenIPMI/internal/ipmi_control.h: ditto * lib/control.c: ditto * cmdlang/cmd_control: ditto * lib/oem_atca.c: ditto * swig/OpenIPMI.i: ditto * swig/OpenIPMI.i: Fix a problem setting light parms 2005-11-25 Corey Minyard * lib/aes_cbc.c: Make sure we don't coredump if the connection doesn't get set up. * lib/domain.c: Don't iterate the domain list if it is NULL. * lib/ipmi_lan.c: Allow RMCP+ to be specified explicitly as a connection type. * swig/OpenIPMI.i: On an error, pass in a valid dummy array when delivering control value lists, since they may be NULL on an error. * swig/OpenIPMI.i: Add entity SDR id and entity id string fetch methods. 2005-11-24 Corey Minyard * lib/mc.c, lib/domain.c: Make sure certain things don't run when the object is being destroyed. * lib/opq.c: Fix an opq destroy error. 2005-11-23 Corey Minyard * lib/sensor.c: Remove the check for the MC being active when allowing the sensor to perform operations. It's not always accurate and shouldn't matter. * lib/control.c: ditto * swig/OpenIPMI.i: Fix some string handling errors. * swig/OpenIPMI.i: Fix the threshold_reading_cb to pass the error as a parameter * swig/python/OpenIPMI_lang.i: Handle generating exception information from callbacks. 2005-11-22 Corey Minyard * swig/python/OpenIPMI_lang.i: Fixed all the calls to grab/release the lock state so things will always work properly no matter where the calls come from. 2005-11-21 Corey Minyard * lib/entity.c: call _ipmi_mc_put() at the end of ipmi_entity_get_mc_id(). 2005-11-17 Corey Minyard * lib/sensor.c: Make sure to handle all cases of partial data in a set sensor event enables response. Also be sure to mask off reserved bits. * cmdlang/cmd_sensor.c: Fix an error report function location. * include/OpenIPMI/ipmi_mc.h: Add ipmi_event_alloc() to this file so you can allocate events to add to the SEL. Otherwise you would have to include internal include files. * cmdlang/cmd_sel.c: No longer need the event.h include. * lanserv/lanserv_ipmi.h, include/OpenIPMI/lanserv.h: Change the "idx" of a session to its handle (since the index is something else) and rework the "Get Session" handling code in the lan server to actually be correct. 2005-11-16 Corey Minyard * swig/perl/Lanserv.pm: Removed the need for threads, use fork() instead, for the perl tests. * swig/perl/test_chan: ditto * swig/perl/test_fru: ditto * swig/perl/test_lanparm: ditto * swig/perl/test_pef: ditto * swig/perl/test_pet: ditto * swig/perl/OpenIPMI_lang.i: Added unsigned in typemaps for swig. * unix/heap.h: Fix a test so an unsigned value doesn't go negative in a test. * swig/perl/Makefile.am: Add test_pef, since it was missing. * lib/pef.c: Fix a problem writing PEF alert strings. 2005-11-13 Corey Minyard * lib/ipmi.c: Remove some bogus additions of string nil characters and fix an incorrect index for setting the second port of a LAN address. 2005-11-09 Corey Minyard * lib/sel.c: Don't set startup_SEL_time if the user hand-sets the SEL time. * lib/oem_atca.c: Added some prints on some ATCA table errors. 2005-11-04 Corey Minyard * lib/mc.c: Allowed null handlers in some set calls. * include/OpenIPMI/ipmiif.h.in: Correct some documentation on managed hot-swap. * include/OpenIPMI/ipmi_fru.h: Added some missing information to the comments. * doc/IPMI.ltx: Added info on the new FRU interfaces, cleaned up a few things. 2005-10-30 Corey Minyard * include/OpenIPMI/internal/ipmi_mc.h, lib/mc.c: Add a way to force the active value without reporting it. * lib/domain.c: Force the system address MC to always be active, since it makes no sense for it to be inactive. * lib/cmdlang.c: Make sure output is reported properly for binary and unicode output to avoid warning messages. 2005-10-24 Matt Domsch * ipmi.sysconf: add IPMI_POWERCYCLE back in, change SuSEconfig modulename to .ipmi 2005-10-20 Corey Minyard * include/OpenIPMI/ipmi_conn.h: Modify the ipmb-providing functions to take an array of IPMB addresses, not a single ipmb address. Required for per-channel IPMB support. An unfortunate (mostly internal) interface change. * lib/domain.c, include/OpenIPMI/internal/ipmi_domain.h: Add per-channel IPMB address support. * lib/ipmi_lan.c: ditto * lib/ipmi_smi.c: ditto * lib/oem_atca.c: ditto * lib/oem_atca_conn.c: ditto * lib/oem_force_conn.c: ditto * lib/oem_intel.c: ditto * lib/oem_kontrol_conn.c: ditto * include/linux/ipmi.h: Add per-channel IPMB support ioctls. * lib/ipmi_smi.c: Remove socket support, as nobody should be using it. * everything: Cleaned up a bunch of new warnings from the gcc 4.0 compiler. * include/OpenIPMI/internal/ipmi_domain.h, lib/domain.c: The MC scanning functions were not following the rules properly; the done function would still be called on some errors. Some users were handling this properly and some weren't. This cleans it up to follow the standard rules (return an error then no callback, return success then always callback). * lib/oem_motorola_mxp.c: ditto * include/OpenIPMI/internal/ipmi_domain.h, lib/domain.c, lib/atca.c: Modified the way bus scanning works so that the ATCA code can use it. * include/OpenIPMI/internal/ipmi_domain.h, lib/domain.c: Modified the domain fully up code to take a debugging parm to help know who is not releasing this properly. * lib/entity.c: ditto * lib/mc.c: ditto 2005-10-17 Corey Minyard * include/OpenIPMI/ipmi_fru.h: Add ipmi_bits.h include. * include/OpenIPMI/internal/ipmi_fru.h: Add some needed includes. * lib/oem_atca.c, lib/oem_atca_fru.c: Move the FRU decoding to a different file. * include/OpenIPMI/ipmiif.h.in, lib/strings.c: Added ATCA blade domain type, and the option for local-only domains. * lib/domain.c, lib/ipmi.c, include/OpenIPMI/internal/ipmi_domain.h: Added local-only domain options support. * lib/domain.c, include/OpenIPMI/internal/ipmi_domain.h: Added a way to get the connections for a domain. * lib/oem_atca.c: Added support for local blade domains when coming in from an system interface. 2005-10-17 Matt Domsch * ipmi.init: if ipmi_devintf can't be removed, don't delete /dev/ipmi0 * ipmi.init: merge SuSE config file foo=yes vs foo=1 changes. * ipmi.sysconf: ditto 2005-10-13 Corey Minyard * cmdlang/Makefile.am: Fix the clean to work properly. * glib/Makefile.am: ditto * lanserv/Makefile.am: ditto * lib/Makefile.am: ditto * ui/Makefile.am: ditto * unix/Makefile.am: ditto * utils/Makefile.am: ditto * lib/fru.c: Added a call to cleanup the old FRU recs when the rec data for the FRU information is set and old FRU data exists. * lib/fru_spd_decode.c: Don't free the FRU data at shutdown. * lib/normal_fru.c: If you add a record area to a non-normal FRU, convert it to a normal FRU. This lets you edit a corrupt FRU. * lib/oem_intel.c: Add support for the Intel SE7520 motherboard. 2005-10-09 Corey Minyard * lib/opq.c: Added a way to pre-allocaste opq entries, a way to put an item at the front of the opq instead of at the end, and a way for an opq operation to return if it was started or not (an optimization to keep from blowing the stack in operations that might heavily nest). * lib/control.c: Adjusted for the opq changes. * lib/entity.c: ditto * lib/lanparm.c: ditto * lib/mc.c: ditto * lib/pef.c: ditto * lib/sdr.c: ditto * lib/sensor.c: ditto * lib/sel.c: Optimized SEL clearing. If the SEL detects that all entries are deleted, it will immediately add a fetch operation at the head of the queue. If the fetch operation succeeds and clears the SEL, any pending deletes are marked as already done and will return a success for the operation. * lib/sel.c, include/OpenIPMI/internal/ipmi_sel.h: Added a way to try to force an SEL clear immediately. NOTE: Do not use this. This is only for HPI. * lib/mc.c, include/OpenIPMI/ipmi_mc.h: Added an SEL clear function for the MC. NOTE: Do not use this. This is only for HPI. * include/OpenIPMI/internal/ipmi_mc.h: Added a way to set a custom clear handler. * cmdlang/cmd_sel.c: Added a way to force-clear an MC's SEL. * lanserv/emu.c: Fixed some bugs in SEL handling. 2005-10-05 Corey Minyard * lib/entity.c, include/OpenIPMI/internal/ipmi_entity.h: Added a way to set the FRU for an entity. * lib/oem_atca.c: Put the shelf FRU info into the chassis entity (the 23.1 entity). * lib/oem_atca.c: Fix some problems with references on the multirecord decoding. * lib/normal_fru.c: Make sure the fru is unlocked while calling the root node handlers. * lib/fru.c: Make sure the FRU is unlocked while decoding the FRU data. 2005-10-04 Matt Domsch * ipmi.init: don't strictly require LSB functions on Red Hat / VMware 2005-10-02 Corey Minyard * utils/*.c, lanserv/*.c, lanserv/*.h: Relicense part of OpenIPMI under a dual LGPL/BSD license so it may be used as part of a BMC implementation. * include/OpenIPMI/internal/ilist.h: ditto * include/OpenIPMI/internal/md2.h: ditto * include/OpenIPMI/internal/md5.h: ditto * include/OpenIPMI/internal/ipmi_malloc.h: ditto * include/OpenIPMI/internal/ipmi_locks.h: ditto * include/OpenIPMI/internal/locked_list.h: ditto * include/OpenIPMI/ipmi_auth.h: ditto * include/OpenIPMI/ipmi_err.h: ditto * include/OpenIPMI/ipmi_log.h: ditto * include/OpenIPMI/os_handler.h: ditto * include/OpenIPMI/ipmi_debug.h: ditto * include/OpenIPMI/ipmi_addr.h: ditto * include/OpenIPMI/ipmi_msgbits.h: ditto * include/OpenIPMI/ipmi_picmg.h: ditto * include/OpenIPMI/ipmi_bits.h: ditto * include/OpenIPMI/ipmi_types.h: ditto * include/OpenIPMI/lanserv.h: ditto 2005-09-29 Corey Minyard * lib/oem_atca.c: Make sure the shelf entity is reported before any child entities of the ATCA shelf. 2005-09-22 Corey Minyard * lib/fru.c: Added an error when FRU decode failed. * lib/normal_fru.c: Fixed the filename in error prints and remove an error log when the checksum fails. * lib/ipmi.c, lib/fru_spd_decode.c: Added FRU info decoding for SPD FRU information. This info type occurs in DRAMs. * lib/sample.c: Switched over to use the new FRU decode fetching method. 2005-09-21 Corey Minyard * lib/event.c, include/OpenIPMI/ipmiif.h.in: Added a way to "interpret" an existing event the same way that new incoming events are interpreted. * cmdlang/cmd_sel.c: Added an "interp" option to the event listing command to interpret the event. 2005-09-14 Matt Domsch * ipmi.init: use poweroff_control or poweroff_powercycle module option to ipmi_poweroff as appropriate. kernel 2.6.14-rc1 (driver 36.0) and newer uses poweroff_powercycle. * OpenIPMI.spec.in: %preun and %postun fixes from Fedora Core 2005-09-08 Matt Domsch * ipmi.init: silence modprobe output, matches Fedora again 2005-09-06 Corey Minyard * lib/fru.c: Check that the write and write complete functions are available before allowing them to be called. 2005-09-06 Corey Minyard * include/OpenIPMI/ipmiif.in, lib/entity.c: Added a function to get the mcid of an entity, for MC and generic entities. 2005-08-31 Matt Domsch * ipmi.init: Updated initscript to return sane status values from all commands. 2005-08-31 Corey Minyard * lib/fru.c, include/OpenIPMI/ipmi_fru.h: Create a new abstract FRU interface based upon the node stuff done with multi-records. This is getting ready for FRU data that is not standard IPMI (SPD in DIMMs, for instance). * include/OpenIPMI/internal/ipmi_oem.h: Move some FRU-specific interfaces out of here. * include/OpenIPMI/internal/ipmi_fru.h: Move the FRU-specific interfaces into here. * lib/normal_fru.c, lib/oem_atca.c: Convert over to the new FRU interfaces. This changed all the multi-record interfaces, but is much cleaner. * cmdlang/out_fru.c: Use new FRU data dumping interface. * swig/OpenIPMI.i: Added an interface to get the FRU's root node, for the new abstract FRU interface. 2005-08-29 Corey Minyard * lib/ipmi_lan.c: Fixed a possible race during shutdown with timer handling. * lib/opq.c: Only allow the opq destroy to be done once, in case it is called again from the destroy callbacks. * lib/event.c, include/OpenIPMI/internal/ipmi_event.h: Add a way to get the generating MC from a standard IPMI event. * lib/event.c, include/OpenIPMI/ipmiif.h.in: Add a way to get the generating sensor from a standard IPMI event. * lib/domain.c: Convert over to the new function to get the generating MC. * lib/fru.c, include/OpenIPMI/internal/ipmi_fru.h: Removed all the "normal" FRU processing and made interfaces so it can be put into another file and abstracted (to allow multiple FRU data types). Not quite done yet, but a long way down the road. * lib/normal_fru.c, lib/Makefile.am, lib/ipmi.c: The "normal" fru processing moved here. 2005-08-26 Corey Minyard * ipmi.init, ipmi.sysconf, Makefile.am, OpenIPMI.spec.in: Add init script stuff. * include/OpenIPMI/ipmi_fru.h, lib/fru.c, cmdlang/cmd_fru.c: Add general FRU float handling. 2005-08-25 Corey Minyard * lib/sensor.c, lib/control.c: Fix so proper counts are held in shutdown situations. 2005-08-24 Corey Minyard * lib/domain.c, include/OpenIPMI/internal/ipmi_domain.h: Added a way to tell if the domain is in shutdown. * lib/sensor.c: Don't allow operations if the domain/mc it is attached to is in shutdown or is not active. There was a problem where if a sensor was getting refetched in the fetch completion handler, and it blew the stack because the fetch would go through the opq, fail, call the handler, start the fetch, etc. * lib/control.c: ditto * lib/sensor.c: Fix an error path in states_get_start() that was incorrectly returning success. Fix a typo in a comment. * include/OpenIPMI/ipmi_sol.h: Make this into a normal unix text file (remove carraige returns) and general formatting cleanups. 2005-08-23 Gerhard Obrecht * lib/ipmi.c, lib/Makefile.am, lib/oem_kontron_conn.c: Add support for the Kontron system interface IPMB address setting. 2005-08-23 Corey Minyard * cmdlang/cmd_sensor.c, man/ipmi_cmdlang.7: Fixed the docs on the threshold names. * lib/sensor.c: Fix threshold setting to clear out the unused threshold values (just so random data isn't sent). 2005-08-19 Corey Minyard * lib/sensor.c: When doing a "set sensor enable", only disable the bits that the sensor says it supports. * lib/lanparm.c: Added a hack for working with broken systems that return the wrong alert destination number with the response. 2005-08-18 Corey Minyard * lib/oem_atca.c: When a hot-swap event comes in and the MC already exists, it is probably an AMC insertion/removal. Rescan the SDRs on the IPMC when this occurs, as it probably has new sensors. 2005-08-16 Corey Minyard * OpenIPMI.pc.in: Fix linking and order for libOpenIPMIutils. * OpenIPMIcmdlang.pc.in: ditto * OpenIPMIglib.pc.in: ditto * OpenIPMIposix.pc.in: ditto * OpenIPMIpthread.pc.in: ditto * OpenIPMIui.pc.in: ditto 2005-08-05 Corey Minyard * lib/entity.c: Fix an entity destruction problem that could result in a SEGV in some situations. * swig/OpenIPMI.i: Fix the fru multi-record node handling. * swig/perl/OpenIPMI_lang.i: ditto * swig/python/OpenIPMI_lang.i: ditto * swig/perl/sample: Added code for dumping multirecords. 2005-08-02 Corey Minyard * cmdlang/os_debug.c: Fix so log handler gets set correctly. * cmdlang/out_fru.c: Add support for multi-record parsing. * include/OpenIPMI/ipmi_fru.h, lib/fru.c: Add consts where needed. * include/OpenIPMI/internal/ipmi_int.h: ditto * include/OpenIPMI/internal/ipmi_oem.h: ditto * lanserv/atca.emu: Add more multi-records for testing. * lib/fru.c: Fix return of the multi-record root name. * lib/oem_atca.c: Fix problems with the multi-record parsing, add support for the ATCA address table. * swig/OpenIPMI.i: Add support for the fru nodes and multi-record parsing. * swig/perl/OpenIPMI_lang.i, swig/python/OpenIPMI_lang.i: new types for multi-record parsing. * ui/ui.c: Some const fixes. * lib/lanparm.c: Fixed the RMCP+ cipher suites lanparm entry so it is optional. * include/OpenIPMI/internal/ipmi_oem.h: Add comments on registering FRU multi-record handlers. * lib/fru.c, include/internal/ipmi_oem.h, include/ipmi_fru.h: Modified the fru node to return floating point and boolean values. * lib/oem_atca.c: ditto * ui/ui.c: ditto * cmdlang/out_fru.c: ditto * lib/fru.c: Added support for the standard FRU multi-record for power supplies (types 0-2). 2005-07-21 Darius Davis * lib/ipmi_sol.c: Fix potential crash due to a dodgy memset(). Fixed an incorrect warning text string. 2005-07-14 Corey Minyard * lib/sensor.c: Make sure the entity for a sensor is locked even if the MC is bad. * lib/sel.c: Remove a bogus sel_unlock(). * include/OpenIPMI/os_handler.h: Add a way to directly set the log handler for an os handler. * include/OpenIPMI/ipmi_posix.h: Remove the posix_vlog garbage. We still maintain backwards compatability, but this was a stupid idea. * unix/posix_os_hnd.c: ditto * unix/posix_thread_os_hnd.c: ditto * unix/posix_os_hnd.c: Add in the set_log_handler os_handler function. * unix/posix_thread_os_hnd.c: ditto * glib/glib_os_hnd.c, include/OpenIPMI/ipmi_glib.h: ditto * cmdlang/os_debug.c: ditto * cmdlang/ipmish.c: Convert over to set_log_handler. * sample/sample.c: ditto * sample/ipmicmd.c: Remove posix_vlog and use the default one. * sample/sample2.c: ditto * sample/sample3.c: ditto * configure.in: Move to version 2.0.2 2005-07-13 Corey Minyard * include/OpenIPMI/internal/ipmi_sensor.c, include/OpenIPMI/ipmiif.h.in: Move ipmi_sensor_get_owner() to ipmiif.h for the CIM mapping. * everything: A massive update to improve const correcteness. 2005-07-12 Corey Minyard * lib/fru.c: Fix a problem with uninitialized variable FRU string data and another problem with encoding later fields after a changed field. * cmdlang/cmd_fru.c: Must reference the FRU again before deleting; the caller is holding their own reference and will dereference it themselves. * lanserv/emu_cmd.c: Fixed a problem reading continued command strings in the emulator. * lanserv/README.emulator: Fixed some documentation for FRU handling. * lib/sdr.c: When checking the length of SDR data, allow extra data at the end. 2005-07-06 Corey Minyard * swig/perl/test_fru: Added some more tests trying to reproduce a user problem. 2005-06-14 Forrest Zhao , Corey Minyard * include/OpenIPMI/ipmi_fru.h, include/OpenIPMI/internal/ipmi_oem.h lib/fru.c, lib/oem_atca.c, ui/ui.c: Add support for OEM FRU multirecord decode, providing a hierarchy interface for user to get each field of decoded OEM FRU multirecord. 2005-06-10 Corey Minyard * lib/sensor.c: Fix some english grammar problems in a pring. * swig/python/Makefile.am, OpenIPMI.spec.in: Fix so python installs correctly. * configure.in: Move to version 2.0.1. 2005-06-05 Corey Minyard * include/OpenIPMI/ipmi_fru.h: Add some docs explaining how the type field works in multi-records. * lib/fru.c: Fix the definition of fru_area_info to be static and not extern for the forward definition. * lib/fru.c: Call fru_write_handler, not fru_data_handler, on a write retry. 2005-06-02 Corey Minyard * lib/fru.c: Fix the byte ordering on reading FRU time. Make sure the in_use field is reset if the FRU is written but there are no changes. 2005-05-19 Forrest Zhao * include/OpenIPMI/ipmiif.h, lib/domain.c, lib/oem_atca.c, lib/sensor.c: Add callback for OEM-specific sensor types. 2005-05-18 Corey Minyard * lanserv/lanserv_ipmi.c: Use K1 instead of SIK for the initial key for hmac_sha1, per the IPMI 2.0 R2 errata. * lanserv/lanserv_ipmi.c: Adjust the range of allowed sequence numbers for RMCP+, per the IPMI 2.0 R2 errata. * lib/ipmi_lan.c: Adjust the range of allowed sequence numbers for RMCP+, per the IPMI 2.0 R2 errata. * lib/entity.c: Add presence bit sensors entries for drive slot and memory sensor types, per the newly added bits in the IPMI 2.0 R2 errata. * lib/strings.c: Add strings for sensor bit readings for memory sensors, drive slot sensors, and cable sensors, per the IPMI 2.0 R2 errata. 2005-05-17 Corey Minyard * lib/mc.c, include/OpenIPMI/ipmi_mc.h, swig/OpenIPMI.i: Add the (dangerous) ability to set the system event log enable for an MC. * cmdlang/cmd_mc.c: ditto * lib/domain.c: Move adding the domain to the domain list to right where the domain is created. That way it will be cleaned up properly even if it never comes up. 2005-05-10 Paul Drews * unix/posix_thread_os_hnd.c: Clear the internal_data structure after allocating. 2005-05-06 Paul Drews * unix/posix_thread_os_hnd.c: Initialize the mutex structure after it is allocated. 2005-04-27 Corey Minyard * include/OpenIPMI/ipmi_sdr.h, lib/sdr.c: Added the ability to clear out and SDR like it has never been fetched. * include/OpenIPMI/internal/ipmi_event.h, lib/event.c, lib/sel.c: Added setting if the event is old into the event itself. * lib/oem_atca.c, lib/oem_motorola_mxp.c, lib/domain.c: Use the old event info in the event itself to reject old events. * lanserv/README.emulator: Added channel info fetching. * lanserv/atca.emu: ditto * lanserv/emu.c: ditto * lanserv/emu.h: ditto * lanserv/emu_cmd.c: ditto * lanserv/lanserv_emu.c: ditto * lib/chassis.c: Tie into the MC going inactive to remove the chassis controls. * lib/control.c: Fix handling of shutdown when destroyed to clear out the waitq when the control does an opq done and the control is destroyed. Also fix some refcount problems on some error situations. * lib/sensor.c: Ditto, but for sensors. * lib/mc.c: Make sure the clear out the SDR repository to an intial state when the MC goes inactive. Also add some useful error messages. * lib/oem_atca.c: Fix the detection of going to or from not installed state to be correct. * lib/entity.c: Fixed a problem where if a presence sensor got an error on a reading, it would not continue to try other presence methods. 2005-04-20 Corey Minyard * unix/posix_os_h.c, unix/posix_thread_os_hnd.c: Fix incorrect return values from perform_one_op() in these os handlers. * sample/ipmicmd.c: When performoning a non-interactive operation, make sure to not exit in the message handler, because that is done with the LAN object still refcounted (so it won't shut down). 2005-04-18 Corey Minyard * lib/sel.c: Fix a bug where deleting the last record of the SEL cause the SEL fetch to not work any more on systems that support individual deletes. 2005-04-14 Corey Minyard * lib/ipmi_lan.c: Fix a bug with multiple IPMI connections on the same FD. 2005-04-13 Corey Minyard * lib/strings.c, lib/ipmi_sol.c, sample/solterm.c: Fix compile problems with older compilers. * lib/oem_atca.c: Modify the ATCA detection to use a Get PICMG Properties command instead of getting the shelf FRU info address, since not all systems get the shelf FRU properly. 2005-04-08 Corey Minyard * sample/ipmicmd.c: Make sure all error output goes to stderr and only submit the command once in LAN mode. 2005-04-07 Corey Minyard * OpenIPMI.spec.in: Added solterm, reorganized a little. * swig/OpenIPMI.h: Added domaim monitoring interfaces. 2005-04-07 Darius Davis * sample/solterm.c, sample/Makefile.am: Added solterm sample program. 2005-04-07 Darius Davis * include/OpenIPMI/ipmi_err.h: Added error codes and macros for Serial over LAN support * include/OpenIPMI/ipmi_err.h: Added prototype for ipmi_get_error_string. * include/OpenIPMI/ipmi_lan.h: #defined IPMI_RMCPP_ADDR_SOL to provide the RMCP+ address for the SoL payload. * include/OpenIPMI/ipmi_sol.h: New file: Serial over LAN (SoL) interface. * lib/Makefile.am: Added ipmi_sol.c. * lib/ipmi_lan.c: Added support for Serial over LAN on an IPMI 1.5 connection, using the most significant "reserved" bit in the AuthType field. Even on an IPMI 1.5 connection, the outgoing and incoming SoL packets are treated exactly the same as packets for the SoL RMCP+ payload. * lib/ipmi_sol.c: New file: Serial over LAN (SoL) support. * lib/strings.c: Added descriptions for SoL and RMCP+ errors. * lib/strings.c: Added ipmi_get_error_string function to generate a textual description from an error code regardless of the error class. 2005-03-31 Corey Minyard * lib/ipmi_lan.c: Cleaned up some minor things. 2005-03-30 Corey Minyard * lib/sel.c: Remove a bogus stat increment. * lib/ipmi_lan.c: Add a missing stat. 2005-03-30 Corey Minyard * lib/ipmi_lan.c: Fix a problem with multiple connections to the same address. These cannot share lan_fd entries because they cannot be uniquely identified. * include/OpenIPMI/ipmi_conn.h: Rework the RMCP+ hacks to make them more generic. * cmdlang/cmd_domain.c: ditto * lib/hmac.c: ditto * lib/rakp.c: ditto * lib/ipmi.c: ditto * man/ipmi_cmdlang.7: ditto * all: Release version 2.0.0. 2005-03-29 Corey Minyard * include/OpenIPMI/ipmi_conn.h: Added support for a IPMI_CONN_HACK_BROKEN_INTEL_BMC for handling RMCP+ problems on Intel BMCs. The Intel BMCs use the bottom 4 bits of the ROLE(m) instead of the whole ROLE(m) byte. They also use K1 instead of SIK to authenticate normal messages. Both of these are problems with spec compliance. * cmdlang/cmd_domain.c: ditto. * lib/hmac.c: ditto * lib/rakp.c: ditto * lib/ipmi.c: ditto * man/ipmi-cmdlang.7: ditto * lib/ipmi_lan.c: It seems the payload length does not include the integrity padding, adjust for that. * lib/hmac.c: The integrity length for normal messages is 12 bytes for SHA1-96, not 20 bytes. * lib/rakp.c: The integrity length for RAKP4 messages was 12 bytes, not 20 bytes. * lanserv/lanserv_ipmi.c: It seems the payload length does not include the integrity padding, adjust for that. The integrity length for normal messages is 12 bytes for SHA1-96, not 20 bytes. The integrity length for RAKP4 messages was 12 bytes, not 20 bytes. 2005-03-29 Darius Davis , Corey Minyard * configure.in: Add test for execinfo.h * utils/ipmi_malloc.c: #ifdef HAVE_EXECINFO_H around code dependent on execinfo.h and the backtrace function. 2005-03-24 Corey Minyard * cmdlang/cmdlang.c: Cast ipmi_time_t to long long when outputting the data to avoid compiler warning. * lib/aes_cbc.c, lanserv/lanserv_ipmi.c: Don't use the padding from openssl, as it is incorrect for IPMI. Add our own padding and turn openssl padding off. 2005-03-24 Darius Davis * lib/fru.c, include/OpenIPMI/ipmi_fru.h: Moved #include to fru.h. * lib/ipmi_lan.c: #ifdef around more PF_INET6 dependent code. * lib/ipmi_lan.c: when reading AuthType field, only take low nybble. * lib/ipmi_lan.c: raise a warning if the BMC reports that it supports IPMI2 in extended capabilities, but doesn't say it provides extended capabilities. * lib/ipmi_lan.c: move RMCP+ support detection from auth_cap_done_p to auth_cap_done so we can give a warning for BMCs that don't handle Get Channel Auth Conf properly. * lib/sensor.c: change log2 to c_log2 for platforms that define log2 as a macro (Cygwin). 2005-03-23 Corey Minyard * include/OpenIPMI/mxp.h: Fixed the license to be LGPL, as intended. * configure.in: Added some target detection and some target-specific defines. * lib/ipmi.c, lib/ipmi_smi.c: Made the init/shutdown of ipmi_smi based upon target-specific defines. 2005-03-22 Corey Minyard * lib/entity.c: Fix a bug in fru presence handling, addressing beyond the end of the array. * lib/ipmi.c: Fixed a problem with handling of 1-byte full ASCII. * lib/ipmi_lan.c: Lots of little fixes. * include/OpenIPMI/ipmi_lan.h: Added a string for the IPMI LAN standard port. * unix/posix_thread_os_hnd.c: Fix a possible double-free scenario. * glib/glib_os_hnd.c: Fix a possible use of free data scenario. * lanserv/lanserv_ipmi.c: in return_rmcpp_rsp, make the d[] array be one longer to accomidate the checksum. * lanserv/lanserv.c: in handle_msg_ipmi_dev, make the data[] array be one longer to accomidate the checksum. * sample/ipmicmd.c: Check to make sure the channel is present. 2005-03-21 Corey Minyard * lib/domain.c: Added IPMI 2.0 as a supported version. 2005-03-21 Darius Davis * lib/strings.c: Fix misnamed command string for payload activation. 2005-03-17 Corey Minyard * lib/fru.c: Fixed an off-by-one problem when writing FRU data. * unix/posix_thread_os_hnd.c: ifdef some gdbm stuff that needed it. * include/OpenIPMI/internal/ipmi_utils.h, lib/fru.c: Add a field to the notrack FRU to allow only specific areas to be processed. * lib/entity.c: ditto * lib/oem_atca.c: ditto, only fetch multi-records. 2005-03-16 Corey Minyard * lib/fru.c: Added IPMI_REQUEST_DATA_LENGTH_INVALID_CC to the list of errors that means the FRU fetch was too big and we should back off the fetch size. 2005-03-12 Corey Minyard * lib/lanparm.c: Fix some minor problems with IPMI 2.0 parms. 2005-03-03 Corey Minyard * sample/ipmicmd.c: Fixed some memory sloppiness that was causing segvs with test_lat. * lib/ipmi_lan.c: Added a boatload of statistics to the LAN interface. * lib/sel.c: Added statistics. 2005-03-02 Corey Minyard * lib/domain.c, include/OpenIPMI/ipmiif.h.in: Added a statistics interface. * include/OpenIPMI/ipmi_conn.h: Added a statistics interface for connections. * lib/ipmi_lan.c: Started adding statistics. * cmdlang/cmd_domain.c: Added statistics dumping. * lib/ipmi_lan.c: Converted to socket to be non-blocking. 2005-02-28 Corey Minyard * lib/ipmi_lan.c: Modified sending to sending to odd netfns will result in immediate send without response. * lib/ipmi_lan.c, lib/ipmi_smi.c: Free the "name" attribute if it is set. * lib/control.c, lib/sensor.c, lib/entity.c: Don't check for the lock on opq_done() operations, since the lock may not be held due to shutdown races. * lib/ipmi_lan.c: Removed an unecessary "retries" and "timer" variables from the LAN structure. * lib/oem_atca.c: More hacks for broken hardware. * lib/sel.c: Hacks for broken hardware. * lib/mc: Added some information for changed MCs. 2005-02-25 Corey Minyard * lib/oem_atca.c: Some more fixups for the Intel chassis. 2005-02-24 Corey Minyard * lib/entity.c: Ignore controls and sensors for presence if they are supposed to be ignored when the entity is not present. I think I previously misunderstood this bit (not like it is well explained, anyway). * lib/sensor.c, lib/control.c: Make oem sensors and controls not ignored when the entity is not present. * lib/oem_motorola_mxp.c: ditto * lib/oem_test.c: ditto * lib/oem_intel.c: ditto * lib/oem_atca.c: Set address controls to be ignored if the entity is not present. * lib/sensor.c: Fix a problem with handling sensor state fetches that didn't have optional bytes. * lib/oem_atca.c, lib/oem_atca_conn.c: Modify fetching the shelf FRU to try the ECN 1.1 version first. Commented out some Intel-specific hacks as the shelf gets better. * include/OpenIPMI/internal/locked_list.h, util/locked_list.c: Added a way for the prefunc to tell it to skip an item. * include/OpenIPMI/ipmiif.h, lib/domain.c: Added support for domain statistics. * include/OpenIPMI/ipmi_conn.h: Added a statistics interface. 2005-02-23 Tariq Shureih , Corey Minyard * lib/entity.c: Added a physical slot number attribute for entities, useful for ATCA, CTCA, PICMG2.6, etc. * include/OpenIPMI/ipmiif.h.in: ditto * include/OpenIPMI/internal/ipmi_entity.h: ditto * cmdlang/cmd_entity.c, man/ipmi_cmdlang.7: ditto * lib/oem_atca.c: ditto * lib/oem_motorola_mxp.c: ditto * swig/OpenIPMI.i: ditto * lib/entity.c: Fixed an ordering problem were if the FRU becomes present before its entity data comes in, still fetch the FRU info. 2005-02-18 Corey Minyard * cmdlang/cmd_entity.c: Add an "entity tree" command to dump the list of entities in a tree structure. * lib/fru.c: Add a new error to handle auto-resizing of FRU fetches with. 2005-02-11 Corey Minyard * lib/ipmi_utils.c, include/OpenIPMI/ipmi_addr.h: Add an address comparison that does not use the LUN as part of the comparison. * lib/domain.c: Modify finding MCs to not use the LUN, since there may be multiple LUNs on an MC. * lib/oem_atca.c: In the Intel SDR fixups, added entity containment records for all the entities found in the SDRs. * lib/sel.c: Fixed problems with timestamp handling. * lib/mc.c: Fixed an error/shutdown race with timer info. 2005-02-08 Corey Minyard * lib/entity.c: Fixed some problems with the use of qsort and the sorting and comparing of device locator records and entity association records. * glib/Makefile.am: Changed the name of a field to be glib, not posix. * glib/glib_os_hnd.c: Clear out the glib info so the gdbmf will be NULL at startup. * lib/domain.c: Added a general domains_initialized function to know if the domain lock is valid. This is because some things can try to do a ipmi_domain_pointer_cb() after the domains have been shut down. * lib/sdr.c: Only store the SDRs in the database if we have a valid key for the MC. * swig/OpenIPMI.i: Initialize the glib OS handler in the right order. * utils/ipmi_malloc.c: Don't free the memory in the alloced list when shutting down. It may still be in use. 2005-02-02 Corey Minyard * include/OpenIPMI/os_handler.h, lib/ipmi.c: Added an interface to protect users that have created their own OS handler from additions to the os handler data structure. * include/OpenIPMI/os_handler.h, lib/sdr.c: Added a non-blocking mode to the database. * configure.in: Added gdbm tests. * cmdlang/os_debug.c, cmdlang/Makefile.am: Added gdbm support. * glib/glib_os_hnd.c, glib/Makefile.am: ditto * unix/posix_os_hnd.c, unix/posix_thread_os_hnd.cg, unix/Makefile.am: ditto 2005-02-01 Corey Minyard * lib/sdr.c: Add support for dynamically resizing SDR fetches if the system cannot support the size required. This allowed an increase in the starting size but can support smaller sizes than were supported. * lib/fru.c: Ditto, but for FRU data. * lib/domain.c: Fixed channel handling to not scan the IPMB if there is not one from the channel info command. This may cause some broken 1.5 systems (that do not implement the get channel info command properly) to not work, but that's too bad, they are broken. Systems without IPMB will work much better with this change. * lib/oem_atca.c: Force instance to be 0x60 on all main units that came in as entity id 7 or 0. * include/OpenIPMI/os_handler.h: Added a database interface. NOTE: This change is not binary backwards compatible if you have created your own OS handler. * lib/sdr.h: Added support for storing and retrieving SDR data in the database for client-side caching. 2005-01-30 Corey Minyard * lib/lanparm.c: Allow zero-length parm responses to represent optional unsupported parms. 2005-01-27 Corey Minyard * configure.in: Changes "==" to "=". * swig/perl/Makefile.am: Added PERLLIB to pull the modules from the right place. * lib/ipmi_lan.c: Only use the get_msg_tag() method on payloads if the session id is zero. * include/OpenIPMI/ipmi_lan.h: Improve payload docs. 2005-01-25 Corey Minyard * lib/event.c: Fixed a problem with the data length when getting data. * configure.in, lanserv/Makefile.am, sample/Makefile.am: Added popt library detection and overriding. 2005-01-23 Corey Minyard * lib/sel.c: Fixed a bug where the SEL lock was being held in the SEL fetch done callback. * include/OpenIPMI/ipmi_mc.h, include/OpenIPMI/ipmiif.h.in: Added routines to get the GUID for the system and for each MC. * include/OpenIPMI/internal/ipmi_mc.h: ditto (added set routine) * lib/mc.c: ditto * lib/domain.c: ditto * cmdlang/cmd_mc.c: ditto * cmdlang/cmd_domain.c: ditto * swig/OpenIPMI.i: ditto * man/ipmi_cmdlang.7: ditto * lib/ipmi_lan.c, lib/rakp.c: Fixed some broken stuff caused by the last changes to the LAN code. 2005-01-21 Corey Minyard * include/OpenIPMI/ipmi_lan.h: Added a function to payloads to get the message tag for a message, and added a message tag parm to starting an authentication session. This is primarily to allow the LAN code to set the message tags and get them. * lib/rakp.c: ditto * lib/ipmi_lan.c: ditto * lib/ipmi_lan.c: Modified the LAN code to allow the same socket to be reused for multiple LAN connections. This should increase scalability by a large amount. * lanserv/lanserv_emu.c: Added an option to override the port number. 2005-01-20 Corey Minyard * configure.in: Allow the SNMP and OpenSSL libraries and compile flags to be hard-coded on the configure command line. * lib/domain.c: Fixed a problem with the type in a log. * lib/lanparm.c: Fixed some problem handling the newly added parms not being there. 2005-01-19 Corey Minyard * include/OpenIPMI/ipmi_lanparm.h: Added the RMCP+ and VLAN lanparms. * lib/lanparm.c: ditto * cmdlang/cmd_lanparm.c: ditto * swig/perl/test_lanparm: ditto * include/OpenIPMI/lanserv.h: ditto * lanserv/lanserv_ipmi.c: ditto * lanserv/lanserv_ipmi.c: Fix a bug where the dummy session wasn't being zeroed when handling temporary session messages. * lib/ipmi_lan.c: Use the right size when comparing the bmc_key in the options. Also remove some debugging cruft. 2005-01-17 Corey Minyard * include/OpenIPMI/ipmi_mc.h, include/OpenIPMI/internal/ipmi_mc.h: Moved ipmi_mc_get_address, ipmi_mc_get_channel, and ipmi_mc_get_ipmi_address from the private to the public interfaces. * lib/sel.c: Added a comment on why the SEL fetch is aborted after so many reservation losses in the fetch. 2005-01-14 Corey Minyard * lib/ipmi_lan.c: Fixed some race conditions between reuse of LAN connections and destruction of LAN connections. * include/OpenIPMI/ipmi_conn.h: Reworked the registering for event handlers to use a locked list interface. Great reduction in code size and increase in reliability. * lib/ipmi_lan.c: ditto * lib/ipmi_smi.c: ditto * lib/domain.c: ditto * sample/ipmicmd.c: ditto * include/OpenIPMI/ipmiif.h.in: Added a domain option to not activate the interfaces. * include/OpenIPMI/internal/ipmi_domain.c: ditto * lib/domain.c: ditto * lib/ipmi.c: ditto 2005-01-13 Corey Minyard * include/OpenIPMI/ipmiif.h, lib/entity.c: Undeprecated the hot-swap requester and indicator command, since HPI provides them. I still think it's a bad idea to use them, though. * include/OpenIPMI/ipmi_mc.h, include/OpenIPMI/internal/ipmi_mc.h: Moved the ipmi_mc_del_event() function to the public interface. * lib/sel.c: Clear the SEL if the SEL is empty and the overflow flag is set. This appears the clear the overflow flag (at least on some systems) and is safe to do. * lib/sel.c: Fixed a bug where if the reservation was lost fetching a SEL, it would not fetch anything from the SEL until a new event was added. * lib/ipmi_lan.c: Modified the list of LAN addresses to be two hash tables, one indexed by connection and one indexed by IP address (all IP addresses go in). * include/OpenIPMI/ipmi_conn.h: Changed the connection and IPMB reporting to use an add/remove instead of a set for the handler. * lib/ipmi_smi.c: ditto * lib/ipmi_lan.c: ditto * lib/domain.c: ditto * lib/oem_motorola_mxp_intf.c, lib/ipmi.c: Removed old MXP interface support (it shouldn't be needed any more and maintenance was getting to be a pain). * lib/ipmi_lan.c: Added connection reuse. If a user makes a connection to a system and the same connection already exists (same parms) then it will reuse the old connection. * lib/entity.c: Found a problem with disconnect/reconnect; it was claiming a lock recursively in once case. 2005-01-12 Corey Minyard * configure.in: Add support for openssl. * cmdlang/Makefile.am: ditto * cmdlang/Makefile.am: ditto * lib/Makefile.am: ditto * sample/Makefile.am: ditto * cmdlang/cmd_domain.c: Added support for the new RMCP+ LAN parms. * doc/IPMI.ltx: Minor cleanups. * include/OpenIPMI/ipmi_addr.h: Added a concept of an RMCP+ address. This allows payloads to be routed using the normal addressing mechanisms. * include/OpenIPMI/ipmi_auth.h: Added RMCP+ auth and expanded the user password to 20 bytes. * include/OpenIPMI/ipmi_conn.h: Modified ipmi_msgi_t so that it can take external data as well as the internal data and knows how to free it. * lib/domain.c: ditto * lib/ipmi.c: ditto * lib/ipmi_lan.c: ditto * lib/oem_atca_conn.c: ditto * lib/oem_force_conn.c: ditto * lib/oem_motorola_mxp.c: ditto * lib/oem_motorola_mxp_intf.c: ditto * sample/ipmicmd.c: ditto * lib/strings.c: Adde RMCP+ auth strings. * include/OpenIPMI/ipmi_conn.h: Added the concept of asynchronous events so that payloads can report asyncronous data coming up. * lib/ipmi_smi.c: ditto * include/OpenIPMI/ipmi_conn.h, lib/conn.c: Added connection attributes so that payloads have a place to store data. * lib/ipmi_lan.c: Ditto * lib/ipmi_smi.c: Ditto * lib/oem_motorola_mxp_intf.c: Ditto * include/OpenIPMI/ipmi_err.h: Added RMCP+ errors. * include/OpenIPMI/ipmi_lan.h: Added support for RMCP+ payloads, authentication, integrity, and confidentiality handling. This includes new options for lan connection and the ability to register the various algorithms and payload types. * include/OpenIPMI/md5.h, utils/md5.c: Added a way to handle multiple-length passwords with MD5. * lib/ipmi_payload.c: Moved IPMI LAN data formatting into a separate file. * lib/Makefile.am, lib/ipmi.c: Added support for RMCP+ algorithms. * lib/aes_cbc.c: ditto * lib/hmac.c: ditto * lib/md5.c: ditto * lib/rakp.c: ditto * lib/ipmi.c: Add support for the new RMCP+ data options. * lib/ipmi_lan.c: Added RMCP+ support. * include/OpenIPMI/lanserv.h: Added support for RMCP+ data. * lanserv/Makefile.am: Added support for OpenSSL. * lanserv/lanserv.c: Fixed the random data routines to work right. * lanserv/lanserv_emu.c: ditto. * lanserv/lanserv_config.c: Added support for some RMCP+ data. * lanserv/lanserv_ipmi.c: Added support for RMCP+. * man/ipmi_cmdlang.7: Added info about the RMCP+ LAN parms. * configure.in: Update to version 2.0.0. 2005-01-11 Corey Minyard * include/OpenIPMI/internal/Makefile.am: Fixed so it installs in the right place. 2005-01-04 Corey Minyard * lib/entity.c: Added a warning log if the FRU fetch request failed. * include/OpenIPMI/ipmi_users.h, lib/mc.c, swig/OpenIPMI.i: Added the ability to get the other information from the get user access command. * swig/perl/test_chan: Adjusted for the previous changes. * cmdlang/cmd_mc.c, man/ipmi_cmdlang.7: ditto * doc/IPMI.ltx: Added info for user and channel management. 2005-01-03 Corey Minyard * Include/OpenIPMI/ipmi_pet.h, lib/pet.c: Added a refcount to the PET external interface and fixed some problems with PET handling. * swig/OpenIPMI.i: Added PET support. * swig/perl/test_pet, swig/perl/Makefile.am: Added PET perl tests. * glib/glib_os_hnd.c: Fixed the perform_one_op function to time (sort of) properly. * swig/perl/test_chan: Fix some problems with the tests. * lanserv/lanserv_ipmi.c: Fix bugs handling channel privilege limits. * swig/perl/test_pef, swig/perl/test_lanparm: Minor perl cleanups. * ui/ui.c: Fixed a parm messed up by an interface change. * lib/entity.c: Fixed handling of FRU info from devices, we need to look at the pending as well as the current info to know if an entity already has a FRU device. * configure.in: Move to version 1.4.7. 2005-01-01 Corey Minyard * swig/perl/test_pef: Add PEF tests. * lanserv/lanserv_ipmi.c: Fixed a few problems with PEF handling. * lib/pef.c: Fixed some problems with PEF handling. 2004-12-31 Corey Minyard * include/OpenIPMI/lanserv.h, lanserv/lanserv_ipmi.c: Added PEF config support. * cmdlang/cmd_pef.c: Fixed some printing problems. * lib/pef.c: Fixed a problem getting the last alert string and the guid data and a few data format problems. 2004-12-30 Corey Minyard * include/OpenIPMI/ipmi_strings.h: Converted return strings to be const because the user can't change them. * include/OpenIPMI/ipmiif.h.in: ditto * include/OpenIPMI/ipmi_auth.h: ditto * include/OpenIPMI/ipmi_bits.h: ditto * include/OpenIPMI/ipmi_cmdlang.h: ditto * include/OpenIPMI/internal/ipmi_sensor.h: ditto * cmdlang/cmd_sensor.c: ditto * cmdlang/cmdlang.c: ditto * cmdlang/ipmish.c: ditto * lib/control.c: ditto * lib/entity.c: ditto * lib/oem_motorola_mxp.c: ditto * lib/sensor.c: ditto * lib/strings.c: ditto * sample/sample3.c: ditto * swig/OpenIPMI.i: ditto * include/OpenIPMI/ipmi_lanparm.h, lib/lanparm.c: Added a way to get a config parm type from the parm number and added refcount stuff for perl. * swig/OpenIPMI.i: Finished adding lanparm stuff. * lib/lanparm.c: Changes to the last alert destintation can be fetched. * swig/perl/test_lanparm: Added lanparm tests. * include/OpenIPMI/ipmi_pef.h, lib/pef.c: Added a way to get data by parm number and added refcount stuff for perl. * swig/OpenIPMI.i: Added support for PEF. 2004-12-29 Corey Minyard * ui/ui.c: Added printing of if the sensor/control should be ignored if the entity is not present. * lib/control.c: Default nonstandard controls to be ignored if the entity is not present. * lib/sensor.c: Default nonstandard sensors to be ignored if the entity is not present. * lib/entity.c: Use controls for presence detection, and clean up the presence code to properly handle presence sensor removal. Also modify the presence detection to be 100% compliant with the spec, including messaging FRU devices as the last step. * lib/chassis.c: Remove the dummy presence sensor since the controls can be used for presence now. * lib/oem_motorola_mxp.c, lib/oem_atca.c: Cleanup up all the ignore if no entity setup for all the sensors and controls. * lib/fru.c: Fix a problem with handling certain invalid FRUs. * lib/entity.c: Use the proper function to destroy the entity info. * swig/OpenIPMI.i: Fix a compile problem. 2004-12-28 Corey Minyard * include/OpenIPMI/lanparm.h, lanparm/lanparm_ipmi.c: Added support for lanparm configuration parameters. * lib/entity.c: Fixed presence detection to not use sensors for entity presence that are there if the entity is not present. * swig/perl/test_atca_entities: Added a little test script for ATCA entities. * swig/OpenIPMI.i: Added some missing deref callbacks. * swig/OpenIPMI.i: Added support for lanparm configuration. 2004-12-26 Corey Minyard * lib/mc.c: Invert the values from get/set channel access so they are logical for the user. * swig/OpenIPMI.i: Added user/channel access. * swig/perl/test_fru: Fixed a timing problem. * swig/perl/test_chan, swig/perl/Makefile.am: Added channel/user testing. * swig/perl/OpenIPMI_perl.c: Added a way to pass an array of objects. * lanserv/lanserv_ipmi.c: Fixed some minor bugs in channel handling. * include/OpenIPMI/ipmi_lanparm.h, lib/lanparm.c: Added an interface for getting general data values by index/name. 2004-12-25 Corey Minyard * lib/mc.c: Fixed some minor bugs in user handling. * lib/cmd_mc.c: Fixed a missing put and some error strings. * include/OpenIPMI/lanserv.h, lanserv/lanserv_ipmi.c: Added support for all the user bits in the set and get user access commands. 2004-12-23 Corey Minyard * sample/ipmicmd.c: Removed the ipmi_log() func, it was junk and caused problems. * lib/mc.c, include/OpenIPMI/ipmi_user.h, cmdlang/cmd_mc.c: Fixed some problems with the user stuff. Added a way to set the enable/disable of a user (done through the set password command, for some strange reason). * lib/sensor.c: Fix a missing sensor in a callback. 2004-12-22 Corey Minyard * lib/mc.c, include/OpenIPMI/ipmi_mc.h, include/OpenIPMI/ipmi_user.h: Added handling for users and channel information. * lib/cmd_mc.c: converted over to the standard user and channel handling. 2004-12-17 Corey Minyard * lib/lanparm.c, lib/pef.c, lib/pet.c: Fixed some locking and refcount problems found with testing. 2004-12-16 Corey Minyard * lib/fru.c: Fixed a problem with FRU area creation, where the versions where not set properly. * lib/ipmi.c: Fixed some last bugs dealing with IPMI strings. * swig/OpenIPMI.i: Added handling for properly deleting FRU information when we are done with it. * lib/fru.c: Fixed some race conditions with the new list stuff and FRU destruction. * include/OpenIPMI/ipmi_fru.h, lib/fru.c: Added refcount functions for keeping track of FRUs. * swig/perl/test_fru: Finished up FRU tests. * include/OpenIPMI/ipmi_fru.h, lib/fru.c: Added a FRU alloc function that has the domain in the callback. Converted the domain pointer in the FRU to a domain id and modified the function to get the FRU's domain to return the domain id. * include/OpenIPMI/internal/ipmi_util.h, lib/fru.c: Modified the notrack FRU allocater to take the domain pointer * lib/entity.c: ditto * lib/domain.c: ditto * swig/OpenIPMI.i: Fixed the FRU functions to call the FRU destructor when the FRU was dereffed. Modified the FRU alloc and write functions to also supply the domain as the first parameter. Added debugging setup functions. * swig/perl/test_fru, swig/perl/sample: Adjusted for the previous changes. * lib/domain.c: Pass in domain during shutdown clearing of messages. * lib/mc.c: Fixed some problems where the refetch callbacks were not always being called in certain error situations. * lib/domain.c, include/OpenIPMI/internal/ipmi_domain.c: Modified the domain attributes to be refcount based, since they could theoretically go away while still in use. * lib/lanparm.c: ditto * lib/pef.c: ditto * lib/pet.c: ditto * lib/fru.c: ditto 2004-12-15 Corey Minyard * lib/fru.c, include/OpenIPMI/ipmi_fru.c: Fixe the name of the set multi-record function function. * cmdlang/cmd_fru.c: ditto * swig/OpenIPMI.i: Add functions to set FRU multi-records. Properly handle undefined values in the other FRU set functions. * include/OpenIPMI/internal/ipmi_utils.h, lib/fru.c: Added internal FRU destroy functions to keep users from destroying internal FRUs. * lib/entity.c: ditto * lib/oem_atca.c: ditto * swig/perl/test_fru, swig/perl/Lanserv.pm: More work on tests. * lib/ipmi.c, lib/fru.c: Fixed some more string handling problems that the new testing found. * lib/domain.c: Rework error return values to make them a single consistent set. * lib/fru.c: ditto * lib/ipmi.c: ditto * lib/ipmi_smi.c: ditto * lib/lanparm.c: ditto * lib/mc.c: ditto * lib/oem_atca.c: ditto * lib/oem_motorola_mxp.c: ditto * lib/pef.c: ditto * lib/sdr.c: ditto * lib/sel.c: ditto * lib/sensor.c: ditto * lib/.c: ditto * swig/OpenIPMI.i: More work to fix some bugs and add the error constants used by OpenIPMI. 2004-12-14 Corey Minyard * lib/fru.c: Fixed some bugs with FRU handling. * include/OpenIPMI/internal/ipmi_int.h, lib/ipmi.c: FRU data needed some more info for decoding, handle that. * lib/fru.c: ditto * lib/entity.c: ditto * lib/sensor.c: ditto * lib/oem_atca.c: ditto * include/OpenIPMI/ipmi_fru.h, lib/fru.c: Added functions to convert between names and FRU field indexes. * lanserv/lanserv_emu.c: Added a noecho command to turn off echo. * lib/ipmi_smi.c: Return the entry when registering commands to watch. * swig/OpenIPMI.i: Added support for getting multirecords from the FRU. Fixed some other FRU-related problems. * swig/perl/test_fru, swig/perl/Lanserv.pm, swig/perl/Makefile.am: Started working on some tests. 2004-12-13 Corey Minyard * include/OpenIPMI/internal/locked_list.h, utils/locked_list.h: Added the ability for the user to use their own lock with locked lists. This avoids multiple locking in areas that already have locks. * lib/entity.c: Converted over the entity, child, parent, sensor, and control lists to use the main domain lock as their lock, since that lock was always claimed anyway. * lib/lanparm.c: Fixed a race condition between lanparm iteration and destruction using the new locked list stuff. * lib/pet.c: ditto * lib/pef.c: ditto * lib/fru.c: ditto * lib/entity.c: Fixed some minor locking problems the previous changed exposed. * swig/OpenIPMI.i: Add the FRU writing support to the Perl code. * doc/IPMI.ltx: Added documenation for FRU writing. * swig/perl/sample: Clean up Perl warnings. * include/OpenIPMI/internal/ipmi_entity.c, lib/entity.c: Added a way for code to force entities to stay around. * lib/oem_atca.c: Force the shelf entity to stay around even if there are no sub-entities. * cmdlang/fru_cmd.c: Added multi-record setting. * lib/fru.c: Fixed problems writing multi-records. 2004-12-10 Corey Minyard * include/OpenIPMI/internal/ipmi_int.h, lib/ipmi.c: Fixes to the IPMI string encoding/decoding routines. * lib/fru.c: ditto * lib/entity.c: ditto * lib/oem_atca.c: ditto * lib/sensor.c: ditto * include/OpenIPMI/ipmi_fru.h, lib/fru.c: Added the capability to modify FRU info and write FRU data back to the FRU. * lib/fru.c: Added tracking of FRUs in the system. * include/OpenIPMI/internal/ipmi_utils.c, lib/fru.c: Added an interface for FRUs so internal stuff can allocate untracked FRU information. This way, user's can't delete internal FRU data. * lib/entity.c: ditto * lib/oem_atca.c: ditto * lib/sensor.c: ditto * cmdlang/cmd_fru.c, cmdlang/cmdlang.c, cmdlang/Makefile: Added FRU handling routines: * include/OpenIPMI/ipmi_cmdlang.h: ditto * man/ipmi_cmdlang.7: ditto * cmdlang/cmd_domain.c: Don't deleted FRUs after they are fetched. * cmdlang/ipmish.c: Fix unicode handling. * cmdlang/out_fru.c: Minor FRU data handling updates. * lib/domain.c: Minor fixes for attribute handling, make sure things are cleared out correctly. 2004-12-07 Corey Minyard * include/OpenIPMI/ipmiif.h.in, lib/mc.c, lib/domain.c, lib/ipmi.c: Added an option to not set the SEL time. * include/OpenIPMI/ipmi_mc.h, include/OpenIPMI/internal/ipmi_mc.h: Moved the ipmi_mc_set_current_sel_time() from the internal to the user-visible interface. * cmd_entity.c, man/ipmi_cmdlang.7: Added the id and entity id string to the entity info. * cmd_mc.c: Added a way to set the SEL time. * include/OpenIPMI/ipmiif.h.in: Added support for a managed hot-swap call so the user can know if the entities hot-swap states can be managed. * include/OpenIPMI/internal/ipmi_entity.h: ditto * lib/entity.c: ditto * lib/oem_atca.c: ditto * cmdlang/cmd_entity.c: ditto * man/ipmi_cmdlang.7: ditto 2004-12-03 Corey Minyard * lib/mc.c: Fixed a problem where the startup SEL time was not set if the target time was ahead of the time on the system. This would cause old events in the SEL to be reported as new events. * lib/oem_atca.c: Reworked the fixups for broken entity ids to be more general. 2004-12-02 Corey Minyard * lib/ipmi.c: fixed a problem with ipmi_parse_args mishandling userids. * include/OpenIPMI/*.h: Added extern "C" to all the necessary include files. 2004-12-01 Corey Minyard * lib/entity.c: Ignore sensors for presence if they use the generic reading type codes. * lib/chassis.c: Added a dummy presence sensor for the chassis entity so it will be reported as present. 2004-11-27 Corey Minyard * include/OpenIPMI/ipmi_lan.h, lib/ipmi_lan.c: Added a new, more flexible interface for configuring a LAN connection. Hopefully this is the last one we have to do here, this would be able to handle anything (especially RMCP+). * lib/ipmi.c: Adjusted to use the new LAN connection method. 2004-11-18 Corey Minyard * lib/ipmi_smi.c: Fix the unregister ioctl for the socket interface. * configure.in: Fix comments on perlinstall option. * configure.in: Allow perl, swig, and glib options to be overriden to support cross-compilation. * configure.in: Move to version 1.4.6. 2004-11-16 Corey Minyard * cmdlang/cmd_mc.c: Added support for the user information viewing and modification. * man/ipmi_cmdlang.7: Added information about the channel and user commands just added. 2004-11-15 Corey Minyard * include/OpenIPMI/ipmi_auth.h, lib/ipmi_lan.c: Added the ability to have a "default" auth type that will pick the best authentication type available. * include/OpenIPMI/ipmi_auth.h, lib/strings.c: Added strings for the auth and privilege values. * lib/ipmi.c: Added a new parameter parsing function that should be easier to use. * cmdlang/cmd_domain.c: Added support for a "domain open" command using the new parameter parsing. * cmdlang/cmd_mc.c: Added support for the channel info and access control commands. * cmdlang/cmd_mc.c: Fixed a bug where the MC was not printed when dumping SEL info. * include/OpenIPMI/ipmi_err.h: Fixed a bug in the IPMI_OS_ERR_VAL macro. * lib/ipmi_lan.c: Fixed a bug where a timer might be freed twice on an error. 2004-11-10 Corey Minyard * cmdlang/ipmish.c: Fixes a problem with the --execute command line option where only the first and last command would be executed. 2004-11-09 Corey Minyard * OpenIPMI.spec.in: Changes to compile on Redhat. * configure.in: Move to version 1.4.5. 2004-11-09 Andrew Cress * lib/oem_intel.c: Minor fixups for the alarm control. 2004-11-09 Kevin Gao * sample/ipmicmd.c: Don't segv when given bad parms. 2004-11-05 Corey Minyard * configure.in: Another fix to the perl installation dir. 2004-11-04 Corey Minyard * configure.in: Fix perlinstalldir to work. * doc/IPMI.ltx: Added some docs on the Perl interface. * lib/ipmi.c: Fixed optional SEL handling. * lib/ipmi_smi.c: Added missing close_connection_domain callback initialization. * swig/OpenIPMI.i: Fixed initialization to work without glib. 2004-11-01 Corey Minyard * FAQ: Added some useful information * OpenIPMI.spec.in: Cleaned up the spec file andmake it correct, added the new stuff. * README: Added Perl info. * configure.in, swig/perl/Makefile.am: Improved the Perl detection support, added handling for Perl module installation. * cmdlang/out_fru.c: Fix compiler warning. * lib/fru.c: Modified initialization to work with older C compilers. * lib/mc.c, lib/entity.c: Fixed deadlocks. * swig/Makefile.am, swig/OpenIPMI.i: Minor build cleanups. * swig/OpenIPMI.i: Fixed some problems with handling FRU data. * swig/perl/sample: Fixed some problems with events. * configure.in: Move to version 1.4.4 2004-10-29 Corey Minyard * include/OpenIPMI/ipmi_conn.h: Added another connection close handler that has a callback. This way, the domain code can know when the connection is really closed. There were race conditions at shutdowns that this fixes. * lib/ipmi_lan.c: ditto * lib/ipmi_smi.c: ditto * lib/oem_motorola_mxp_intf.c: ditto * lib/domain.c: ditto * lib/control.c, lib/sensor.c: Fixed some shutdown ordering problems. * lib/oem_atca.c: Don't clean up the MC if it has already been destroyed. * swig/OpenIPMI.i, swig/perl/OpenIPMI.h, swig/perl/OpenIPMI_perl.c: Added a perl interface for OpenIPMI. * swig/perl/Makefile: ditto * swig/perl/sample: ditto * swig/perl/ipmi_powerctl: ditto 2004-10-27 Corey Minyard * lib/ipmi_lan.c: Fixed race conditions handling sequence numbers and connection handling. * include/OpenIPMI/ipmiif.h.in: Added a comment saying that a lock is held in connection change delivery. * lib/domain.c: Added a comment saying that locks are not necessary to sequence event delivery. * cmdlang/cmd_domain.c: Fix docs on "domain new". * lib/fru.c, include/OpenIPMI/ipmi_fru.h: Added an interface to make it possible to get FRU data in a more generic way. * cmdlang/out_fru.c, man/ipmi_cmdlang.7: Converted over to the new generic FRU interface and changed the output format some. 2004-10-26 Corey Minyard * include/OpenIPMI/ipmiif.h.in, lib/sensor.c: Renamed ipmi_discrete_event_readable to ipmi_sensor_discrete_event_readable. * lib/entity.c: ditto * cmdlang/cmd_sensor.c: ditto 2004-10-24 Corey Minyard * include/OpenIPMI/ipmiif.h.in, lib/entity.c: Deprectated the ability to directly handle the hot-swap indicators and requesters. In hindsight, this seems like a bad idea. This should be under the control of the hot-swap state machine. 2004-10-22 Corey Minyard * lib/ipmi_lan.c: Fix problems with connection failure during startup of the connection. This fixes problems with the connections getting stuck and never coming up. * unix/posix_os_hnd.c: Fixed a problem with the return value of getting the random data. * unix/posix_thread_os_hnd.c: ditto * glib/glib_os_hnd.c: ditto * cmdlang/os_debug.c: ditto * ui/ui_os.c: ditto * lib/ipmi_lan.c: Only report the connection whose state changed on a connection up failure/success. * cmdlang/ipmi_sh.c, man/ipmish.1: Added the ability to turn off the redisplay of the command line on incoming events. 2004-10-20 Corey Minyard * Makefile.am: Added glib OS handler. * configure.in: ditto * glib/Makefile.am: ditto * glib/glib_os_hnd.c: ditto * cmdlang/cmd_domain.c, include/OpenIPMI/ipmi_cmdlang.h: Remove selector stuff from cmdlang. * cmdlang/ipmish.c: ditto * cmdlang/os_debug.c: Removed rwlocks from OpenIPMI. * include/OpenIPMI/ipmi_conn.h: ditto * include/OpenIPMI/os_handler.h: ditto * include/OpenIPMI/internal/ipmi_int.h: ditto * lib/conn.c: ditto * lib/ipmi.c: ditto * lib/ipmi_lan.c: ditto * lib/ipmi_smi.c: ditto * lib/oem_motorola_mxp_intf.c: ditto * lib/sdr.c: ditto * unix/posix_thread_os_hnd.c: ditto * include/OpenIPMI/ipmi_glib.h: ditto * ui/ui.c: Add internal MC include file. * cmdlang/Makefile.am: Work on adding glib support. * glib/Makefile.am: ditto * include/OpenIPMI/Makefile.am: ditto * cmdlang/ipmish.c: ditto * cmdlang/os_debug.c: Rework locking to not allow recursive locks, and fix tons of problems with the locking. * glib/glib_os_hnd.c: ditto * lib/domain.c: ditto * lib/entity.c: ditto * lib/lanparm.c: ditto * lib/mc.c: ditto * lib/pef.c: ditto * lib/sdr.c: ditto * lib/sel.c: ditto * lib/sensor.c: ditto 2004-10-19 Corey Minyard * cmdlang/cmd_conn.c: Renamed IPMI_MAX_DOMAIN_NAME_LEN to IPMI_DOMAIN_NAME LEN to make it consistent with the other defines. * cmdlang/cmd_domain.c: ditto * cmdlang/cmd_entity.c: ditto * cmdlang/cmd_lanparm.c: ditto * cmdlang/cmd_mc.c: ditto * cmdlang/cmd_pef.c: ditto * cmdlang/cmd_pet.c: ditto * cmdlang/cmd_sel.c: ditto * cmdlang/cmdlang.c: ditto * include/OpenIPMI/ipmi_mc.h: ditto * include/OpenIPMI/ipmiif.h.in: ditto * lib/domain.c: ditto * lib/fru.c: ditto * lib/ipmi.c: ditto * lib/mc.c: ditto * lib/sel.c: ditto * ui/ui.c: ditto 2004-10-18 Corey Minyard * Practically_everything: More work on the include files, moved the internal/OEM include files to an "internal" directory, more restructure to make thing easier to use and make more clean definitions of what is and is not supported. This means that if you were naughty and used internal interfaces, you will have to change your code. * cmdlang/cmd_mc.c, cmdlang/cmd_domain.c, man/ipmi_cmdlang.7: Added beter support for the SELs. * lib/mc.c: Don't set the SEL time if that would move the time backwards. 2004-10-14 Corey Minyard * Practically_everything: A restructure of the include files so the ipmiif.h is really the only thing you need to include to do pretty much everything (except for the helper things like pefs, lanparm, pets, etc.). There should no longer be any need for external user programs to use ipmi_domain.h, ipmi_mc.h, or things like that. 2004-10-14 Corey Minyard * include/OpenIPMI/ipmiif.h.in, lib/strings.c, lib/sensor.c: Added sensor direction from the 2.0 spec. * cmdlang/cmd_sensor.c, man/ipmi_cmdlang.7: Added direction output. * include/OpenIPMI/ipmi_bits.h, lib/strings.c: Added some more entity IDs that are new in the 2.0 spec. * lib/sensor.c: Added type 3 (event only) sensor support. * include/OpenIPMI/ipmi_bits.h, lib/strings.c, lanserv/priv_table.c: Added commands from the 2.0 spec. * include/OpenIPMI/ipmi_bits.h, lib/strings.c: The conversion code for commands, netfns, and completion codes was using static buffers. Convert to using passed-in buffers so it is reentrant. * include/OpenIPMI/ipmi_err.h: ditto * lib/ipmi_lan.c: ditto * lib/ipmi_smi.c: ditto 2004-10-12 Corey Minyard * lib/entity.c: Fixed some race conditions with entity creation and deletion. The changes make sure that if an entity is deleted and re-added at about the same time, the operations occur in the right order. * lib/entity.c: Modified the timers to handle destruction more gracefully so the entity doesn't have to hang around until the timers go off. * lib/sensor.c: Report bad SDRs by record id, not the internal OpenIPMI index. * lib/sensor.c: Fix handling of duplicate SDR record detection to take the MC into account, too. 2004-10-11 Corey Minyard * include/OpenIPMI/ipmi_event.h, lib/event.c: Changed the type for getting event data to an unsigned char. * cmdlang/cmd_mc.c, man/ipmi_cmdlang.7: Added active handler to know when MCs go active/inactive. Added if the MC is active to the MC info. * cmdlang/cmd_control.c: Fixed an output problem with the control listing. * cmdlang/cmdlang.c: Fixed error output when no object was selected to work in all cases. * cmdlang/ipmish.c: Added output for ipmish-specific commands. * lib/oem_intel.c: Attach the alarm control to MC 0x20 and scan address 0xc0 when certain events are received. * cmdlang/cmd_lanparm.c: Fixed a problem with losing lanparm configs. * cmdlang/cmd_pef.c: Fixed a problem with losing pef configs. * include/OpenIPMI/ipmi_conn.h: Added a con_type field to the connection type for the connection code to use to identify itself. Added a priv_level field so the privilege of the conneciton may be reported. * lib/ipmi_lan.c, lib/ipmi_smi.c: Added the new items to the connection type. * include/OpenIPMI/ipmi_domain.h, lib/domain.c: Added a way to query the ports of a connection to see if they are up. * cmdlang/cmd_conn.c, man/ipmi_cmdlang.7: Added port information reporting and reporting of if the connection is up. * lib/domain.c: Modified setting the "set event receiver" option to depend on the privilege level, since it requires admin access to run. * include/OpenIPMI/ipmi_int.h: Added a "msg err" debugging flag to print out when errors occur in messaging. * cmdlang/ipmish.c, cmdlang/cmdlang.c, lib/ipmi_lan.c: Added support for the msg err debugging flag. 2004-10-10 Corey Minyard * man/ipmi_cmdlang.7: Finished this document. * cmdlang/cmdlang.c: Renamed the three-character short form thresholds to be two characters to make them consistant. * configure.in: Move to version 1.4.3 2004-10-09 Corey Minyard * OpenIPMIcmdlang.pc.in, Makefile.am: Added file for the new cmdlang library. * lib/strings.c, cmdlang/cmd_entity.c, cmd/cmdlang.c: Fixed some minor formatting things. * cmdlang/cmd_sensor.c: Added number output for sensor types, event readings, and units. * man/ipmi_cmdlang.7: Lots of work adding docs. More formatting work still to do. 2004-10-08 Corey Minyard * doc/IPMI.ltx: Documentation cleanup * doc/OpenIPMI.texi: Removed old docs. * doc/Makefile.am: Removed old docs and added generation of the LaTeX documentation. * sample/sample.c: Cut the length of a line so it came out nicely on the docs. * lib/domain.c: Cleaned up log output. * lib/entity.c: ditto * lib/ipmi.c: ditto * lib/ipmi_lan.c: ditto * lib/ipmi_smi.c: ditto * cmdlang/*, include/OpenIPMI/ipmi_cmdlang.h: Added the new and improved command language. * lib/control.c: Removed lock check from ipmi_control_get_mc() since it is needed to check the lock. * lib/domain.c: Fixed a lock problem in the attributes. * lib/entity.c: Make sure the MC is locked when iterating controls. * lib/lanparm.c: Fixed a lock problem. * lib/pef.c: Fixed a lock problem. * lib/sensor.c: Zero the data used when fetching event enables. * man/ipmish.1: Added man page. * man/ipmi_cmdlang.7: Started man page. 2004-10-07 Corey Minyard * lib/domain.c: Fixes some problems found by a static analysis tool. * lib/mc.c: ditto * lib/entity.c: ditto * lib/control.c: ditto * lib/sensor.c: ditto * lib/oem_atca.c: ditto * lib/lanparm.c: ditto * lib/pef.c: ditto * lib/pet.c: ditto * lib/ipmi_utils.c: ditto * lib/sdr.c: ditto * lib/oem_motorola_mxp.c: ditto * lib/strings.c: ditto * include/OpenIPMI/ipmi_pef.h, lib/pef.c: Added a consistent presentation of the GUID. * include/OpenIPMI/ipmi_bits.h, lib/strings.c: Added fatal error and gram unit types. * lib/sensor.c: Fixed sensor reporting order so locks are properly held. * lib/oem_atca.c: Fixed some problems with holding the proper refcounts on object during callbacks. * lib/oem_intel.c: Fixed some problems with holding the proper refcounts on object during callbacks. * lib/entity.c: Fixed a race condition with the try count for presence detection. * lib/domain.c: Fixed race conditions dealing with callbacks. * include/OpenIPMI/ipmi_sensor.h, lib/sensor.c: Added a way to get a sensor's domain. * include/OpenIPMI/ipmiif.h.in: Added support to the open domain call for detecting when the domain has finished all initial operations. * include/OpenIPMI/ipmi_domain.h: ditto * lib/domain.c: ditto * lib/entity.c: ditto * lib/mc.c: ditto * ui/ui.c: Adjusted for the change to open domain. * ui/basic_ui.c: ditto * sample/sample.c: ditto * sample/sample2.c: ditto * sample/sample3.c: ditto * include/OpenIPMI/ipmiif.h.in, lib/domain.c: Deprecated ipmi_close_connection() and added ipmi_domain_close() in its place. * ui/ui.c: Adjusted for the change to ipmi_close_connection(). * sample/sample.c: ditto * sample/sample2.c: ditto * sample/sample3.c: ditto 2004-10-06 Corey Minyard * include/OpenIPMI/ipmi_domain.h, lib/domain.c: Added an anonymous attribute that allows external code to tie data into the domain without the domain having direct knowledge of them. * lib/pet.c: Converted the PET list to be per domain. * include/OpenIPMI/ipmi_lanparm.h, lib/lanparm.c: Rework of the lanparm code to keep track of the lanparms that have been allocated, be able to list them, etc. * include/OpenIPMI/ipmi_pef.h, lib/pef.c: Rework of the pef code to keep track of the lanparms that have been allocated, be able to list them, etc. * lib/pef.c, lib/lanparm.c: Fix locking behaviour to work. 2004-10-05 Corey Minyard * include/OpenIPMI/ipmiif.h.in: Renamed a bunch of the sensor functions and types to make their names more consistent I hope this is the last big rename effort for 1.4. * include/OpenIPMI/ipmi_sensor.h: ditto * lib/entity.c: ditto * lib/oem_atca.c: ditto * lib/oem_motorola_mxp.c: ditto * lib/sensor.c: ditto * sample/sample3.c: ditto * ui/ui.c: ditto * lanserv/emu.c, lanserv/emu.h, lanserv/emu_cmd.c: Fixed problems with SEL handling. * lib/mc.c, lib/sel.c, lib/event.c: Fixed some problem with handling errors from SEL deletes. * unix/posix_thread_os_hnd.c: Add a missing return. 2004-10-04 Corey Minyard * include/OpenIPMI/ipmi_control.h, lib/control.c: Add the ability to check the local control capability of an LED. * include/OpenIPMI/ipmiif.h.in: ditto * lib/oem_atca.c: ditto * lib/control.c: Add missing ipmi_control_get_id_type() function. * lib/oem_atca.c: Fixed color reporting to report black when the on time is 0. * lib/domain.c: Minor changes to domain startup reporting so things come in the right order. * lanserv/emu.c: Fixed local control support to use the right bit. 2004-10-02 Corey Minyard * include/OpenIPMI/ipmiif.h.in, include/OpenIPMI/ipmi_domain.h: Added support for some option for enabling/disabling various automatic scanning and fetching operations. * lib/domain.c: ditto * lib/mc.c: ditto * lib/entity.c: ditto 2004-10-01 Corey Minyard * lib/domain.c, include/OpenIPMI/ipmiif.h.in: Add support for a global domain change handler to report addition and removal of domains. * lib/pet.c: Removed an extraneous mc put, cleaned up close handling to be done in the proper order. 2004-09-25 Chetan Hiremath * lib/ipmi_smi.c: Use the proper address on received commands and async events. 2004-09-23 Corey Minyard * include/OpenIPMI/ipmi_pet.h, lib/pet.c: Modified the PETs to be refcount based, use locked lists, and have all the information about them available. 2004-09-17 Corey Minyard * include/OpenIPMI/ipmiif.h.in, lib/fru.c: Modified the FRU length returned to include the NIL character for ASCII strings. * include/OpenIPMI/ipmiif.h.in, lib/fru.c: Added a way to get the domain from the fru type. 2004-09-13 Corey Minyard * FAQ: Added some information about the driver. 2004-09-11 Corey Minyard * lib/domain, include/OpenIPMI/ipmiif.h.in: Added options to the ipmi_open_domain call to allow things to be done in the future (like turn off certain functions, etc.). * ui/ui.c, ui/basic_ui.c: Adjust for previous change * sample/sample.c, sample/sample2.s, sample/sample3.c: ditto 2004-09-09 Corey Minyard * lib/mc.c: Return the proper callback data for the sel_reread function. 2004-09-08 Corey Minyard * utils/ipmi_malloc.c, include/OpenIPMI/ipmi_malloc.h: Added an ipmi_strndup() function. 2004-09-07 Corey Minyard * lib/domain.c, include/OpenIPMI/ipmiif.h.in: Added a list of domains and a way to iterate them. * lib/domain.c, include/OpenIPMI/ipmiif.h.in: Reworked the naming code to make thing a lot more sane and consistent. * lib/mc.c, include/OpenIPMI/ipmi_mc.h: ditto * lib/entity.c: ditto * lib/sensor.c: ditto * lib/control.c: ditto * sample/sample.c: Add domain name for above changes. * sample/sample2.c: ditto * sample/sample3.c: ditto * ui/basic_ui.c, ui/ui.c: ditto * lib/ipmi.c: Added a prototype for ipmi_malloc_init(). 2004-09-02 Corey Minyard * ui/ui.c: Print active information about MCs when reported. * utils/selector.c, utils/heap.c, utils/test_heap.c, utils/Makefile.am: Moved the selector code into the unix directory, where it really belonged. * unix/selector.c, unix/heap.c, unix/test_heap.c, unix/Makefile.am: New location * include/OpenIPMI/os_handler.h: Added memory allocation into the os handlers. Lots of things had to change. * utils/ipmi_mem_alloc.c: ditto. * ui/os_hnd.c: ditto * unix/posix_os_hnd.c: ditto * unix/posix_thread_os_hnd.c: ditto * lib/ipmi.c: Add mem alloc initialization * unix/selector.c: Converted over to using "malloc" instead of ipmi_mem_alloc() to avoid startup race conditions. This code is now unix-specific, so that should be fine. * unix/selector.c, include/OpenIPMI/ipmi_posix.h: Reworked the selector code to directly use POSIX locks. * unix/posix_os_hnd.c: ditto * unix/posix_thread_os_hnd.c: ditto * ui/ui.c: Reworked initialization because of the mem alloc changes. * ui/basic_ui.c, ui/Makefile.am: Have to link with libOpenIPMIposix now to get the selector code. * utils/ipmi_mem_alloc.c: Fixed a bug handling the head and tail elements of the debug malloc list. * sample/sample2.c, sample/sample3.c: Fixed a few small problems in the examples. * configure.in: Move to version 1.4.2 * lib/ipmi_lan.c: Fixed a problem where the wrong LUN was being looked at in LAN reponses. 2004-09-01 Corey Minyard * lib/chassis.c: Fixed a problem where the wrong error was being passed to a callback. * lib/mc.c: Cleaned up the logs. * lib/sel.c: ditto * lib/oem_force_conn.c: ditto * lib/opq.c: Initialize the opq data. * lib/oem_atca.c: Fixed problems due to the new refcount code. Modify the address control numbers to just be assigned sequentially; you cannot use the IPMB address since multiple functions may be at the same IPMB. * lib/control.c: Fix problems with not unlocking locks in certain situations. * lib/control.c: Add reporting of duplicate control numbers. * lib/domain.c: Don't clear the active call list when reporting updates. * lib/domain.c: Remove a redundant set active for MCs. * lib/mc.c, include/OpenIPMI/ipmi_mc.h: Remove _ipmi_mc_clear_active_call(). * lib/sensor.c: Fixed problems detecting duplicate sensor numbers in an SDR array. The new code really works, verses the old code which didn't work any more. * lib/mc.c: Apply pending updated to devid data before installing a new MC. 2004-08-23 Corey Minyard * lib/oem_motorola_mxp.c: Fixed a problem with SDR support. 2004-08-20 Corey Minyard * lib/oem_intel.c: Fixed some problems with the alarm panel, modified to add the controls and entities at the right time and to handle removal of the MC properly. * lib/sensor.c, lib/control.c: Added an "add_pending" flag to sensors and controls so that the sensor or control is not reported until it has been "put" for the last time. This works like entities and allows creators of non-standard controls and sensors to report the entities when they want to report them. * lib/entity.c: Make sure the entity add handler is called before calling the sensor update handlers. * lib/chassis.c: Reworked the getting and putting so the controls are reported properly. * doc/IPMI.ltx: Added docs for the Intel alarm panel. 2004-08-19 Andrew Cress * lib/oem_intel.c: Handle different bus ids for alarm panel. 2004-08-19 Corey Minyard * doc/Makefile: Add new documentation. Note that this is LaTex for now but will probably be switched to docbook. * doc/IPMI.ltx: ditto * doc/ipmi.bib: ditto * BusSystem.dia: ditto * ManagementController.dia: ditto * SimpleHotSwap.dia: ditto * ComplexHotSwap.dia: ditto * MgmtIF.dia: ditto * Thresh.dia: ditto * Hyst.dia: ditto * ServerSystem.dia: ditto * configure.in: Move to version 1.4.1 2004-08-16 Corey Minyard * include/OpenIPMI/ipmiif.h, include/OpenIPMI/ipmi_controls.c: Renamed the "setting" part of a transition light to "value" to avoid confusion with "setting" type lights. * lib/control.c: ditto * lib/oem_motorola_mxp.c: ditto * lib/oem_test.c: ditto 2004-08-11 Erwan Velu * lanserv/lanserv_config.c: Print the line number of errors. 2004-08-10 Corey Minyard * ui/ui.c: Added support for displaying the one-shot reset and output devices. 2004-08-06 Corey Minyard * lanserv/emu.c: Fixed some problems with handling event masks. * sample/sample3.c: Fixed some bugs so this works correctly. * lib/entity.c: Fixed the relative entity strings to subtract off 0x60 from the instance (per the spec). * lib/oem_atca.c: Ignore the floating IPMB address (0x20) for ATCA functions, since it's really not a physical device but a virtual device. * include/OpenIPMI/ipmiif.h, include/OpenIPMI/ipmi_sensor.h: Move some user-needed functions into ipmiif.h and do some minor cleanups. * lib/entity.c, lib/control.c, lib/sensor.c: Don't allow operations on destroyed objects. 2004-08-04 Corey Minyard * include/OpenIPMI/ipmiif.h.in, lib/sensor.c: Added a way to tell if the threshold is returned by the sensor when the value is read. * include/OpenIPMI/ipmi_bits.h, include/OpenIPMI/ipmiif.h: Made the various unit value into enums so it is easier to know what returns what. * lib/sensor.c: ditto * lib/strings.c: ditto 2004-08-03 Corey Minyard * include/OpenIPMI/ipmiif.h.in, lib/sensor.c: Added more consistent functions for checking if threshold and discrete events are supported. Deprecated old functions. * lib/entity.c: adjust for above change * ui/ui.c: ditto * sample/sample3.c, sample/Makefile.am: Added a new sample file to show something about event settings. 2004-08-02 Corey Minyard * include/OpenIPMI/ipmiif.h.in: Renamed some parameters to be more clear, moved some things around that were in the wrong places. * include/OpenIPMI/ipmi_sensor.h: ditto * lib/entity.c: Added the processor bit presence sensor, since there is a presence bit for processor sensors. * lib/oem_atca.c: Fixed an error log. 2004-07-29 Corey Minyard * lib/domain.c, include/OpenIPMI/domain.h: Added a way to fetch the main SDRs from a domain. 2004-07-13 Corey Minyard * include/OpenIPMI/ipmi_domain.h: Fixed a misnamed parm. * Makefile.am, configure.in, OpenIPMI.spec.in: Added support for building RPMs for OpenIPMI. * bootstrap: Added a helper shell script for starting up a raw CVS checkout. * lib/entity.c: Fix a problem with entity presence detection, entities were not being detected not-present in some cases when they went from non-present to present. 2004-06-28 Corey Minyard * lib/domain.c: Fixed a theoretical race condition in fetching the system SELs. 2004-06-24 Corey Minyard * sample/sample.c: Added event handling for sensors to the sample. 2004-06-23 Michael McMaster * lib/mc.c: Initialize info->err in ipmi_mc_reread_sel(). 2004-06-23 Corey Minyard * include/OpenIPMI/os_handler.h: Add some user functions for performing operations like freeing hte handler, and waiting for events to occur. * include/OpenIPMI/ipmi_posix.h: Rework to use the standard functions in the OS handler. * unix/posix_os_hnd.c: ditto * unix/posix_thread_os_hnd.c: ditto * sample/sample.c: ditto * sample/sample2.c: ditto * lib/entity.c: Fixed a problem with always fetching FRU data. 2004-06-22 Corey Minyard * lib/oem_atca.c: Fix a race with deleting an MC. 2004-06-18 Corey Minyard * include/OpenIPMI/ipmiif.h.in, include/OpenIPMI/ipmi_domain.h: Added a ipmi_domain_get_type() function for determining the type of domain. This is so things like ATCA domains can be detected. * lib/domain.c: ditto * lib/oem_motorola_mxp.c, lib/oem_atca.c: Added domain type setting for MXP and ATCA. * include/OpenIPMI/ipmiif.h.in, lib/strings.h: Added strings for the domain type. * lib/oem_atca.c: Add setting the entity id string into the entity fixup callback. 2004-06-17 Philipp Matthias Hahn * man/ipmi_ui.1, man/ipmicmd.1, man/ipmilan.8: Cleanups for the man pages. 2004-06-17 Corey Minyard * lib/domain.c, lib/mc.c: Don't check the OEM handlers if the MC is in used, wait until the MC is no longer in use and apply the pending data update and check OEM handlers then. * lib/oem_atca.c: Added a control for getting the address information of an ATCA FRU. * lib/oem_atca.c: Added entity id strings for all ATCA entities that OpenIPMI deals with. * lib/entity.c: Defer reporting an entity add until the entity is put, so that the entity can be modified by OEM handlers before they are reported 2004-06-15 Corey Minyard * lib/entity.c: Check for a null event in call_presence_handlers(). * unix/posix_os_hnd.c, unix/posix_thread_os_hnd.c: Fixed up some problems with posix_vlog. 2004-05-21 Corey Minyard * lib/entity.c: Add a callback for fetching FRU information even if the FRU information is bad. 2004-05-14 Louis Zhuang * lib/oem_intel.c: Added support for the alarm panel on an Intel server box. 2004-04-30 Corey Minyard * include/OpenIPMI/ipmi_posix.c: Reworked the POSIX os handler to make it easier to use and add helper code for handling threaded wakeups. * unix/posix_os_hnd: ditto * unix/posix_thread_os_hnd: ditto * sample/sample1.c: Reworked for the POSIX os handler changes. * sample/sample2.c: Reworked for the POSIX os handler changes, and made it multi-threaded. * doc/OpenIPMI.texi: Reworked the docs on locking. * lib/sel.c, include/OpenIPMI/ipmi_sel.c: Added a way to get the number of entries and free bytes in the SEL. * lib/mc.c, include/OpenIPMI/ipmi_mc.c: ditto * lib/domain.c, lib/mc.c, lib/entities.c: More work on locking, making sure locks are held in the proper places. * lib/domain.c, lib/mc.c, include/OpenIPMI/ipmi_int.h: Rework the locking on MCs so that the device id data and the active indications are not changed until no one is using the MC. * lib/entity.c: Rework the locking on entities so that the DLR data does not change until no one is using the entity, and the changed indications are not reported until the entity is not in use. Presence is also change to work this way, but it may need some more thinking. 2004-04-29 Corey Minyard * everything: A massive rework of the internals. Basically, locking was reworked completely. Now locks are *not* held in user callbacks. Instead, items in callbacks are usecounted and will not be destroyed until the usecount goes to zero. All the same rules apply, there are just no locks held. This should avoid problems with deadlocks. * lib/domain.c, lib/entity.c: Worked on marking deprecated functions using GCC-specific attributes. * include/OpenIPMI/ipmi_types.h: ditto * include/OpenIPMI/ipmi_entity.h: ditto * include/OpenIPMI/ipmi_domain.h: ditto * lib/sel.c: Fixed a bug in the sel get where the info allocated can go away before the operation returns, but the info is used after the operation returns. * lib/sensor.c: Fix the hysteresis setting to send a message that is the right size. 2004-04-15 Corey Minyard * lib/oem_intel.c: More work on getting the various Intel servers supported better. * include/OpenIPMI/ipmiif.h.in: Modified the hot-swap state machine slightly to support the ability to move to activation requested state from inactive state. * include/OpenIPMI/ipmi_entity.h, lib/entity.c: Added the calls for ipmi_entity_set_activation_requested() to the hot-swap variables. The normal state machine will not support it. * lib/oem_atca.c: Added support for setting the FRU activation policy with ipmi_entity_set_activation_requested(). * configure.in: Move to version 1.3.5 * include/OpenIPMI/ipmi_mc.h, lib/mc.c: Added callbacks for knowing when the MC has finished reading its SDRs and reading the SEL for the first time. 2004-04-14 Corey Minyard * lib/entity.c: Scan MCs from MCDLRs even if the information is not used for anything else. * doc/OpenIPMI.texi: Add information about callbacks. * lib/oem_intel.c, lib/ipmi.c, lib/Makefile.am: Added an Intel server-specific file for handling special things about Intel's servers. * configure.in: Move to version 1.3.4. 2004-04-13 Corey Minyard * lib/entity.c: Prefer to keep the MCDLR information for an entity that has FRU information, and don't try any FRU detection work if the MCDLR has FRU turned off. * lib/oem_atca.c: Turn off setting the event reciever for the ATCA chassis (for now), since it seems to cause all kinds of bad things to happen. * lib/entity.c, lib/sensor.c: Some minor changes to entity presence detection. 2004-04-12 Corey Minyard * lib/control.c, lib/sensor.c, lib/entity.c: Reworked the internal naming of these to make them consistent. * lib/domain.c: Fixed a nasty bug about MC deletion, basically don't delete MCs from the domain list while processing, because they can be the "next" item in the list and corrupt the list traversal. Add a delayed delete operation. * lib/domain.c: Do the OEM startup check after fetching the MC information for the connection. * lib/oem_atca.c: Fix a bunch of problems, add hacks for broken hardware. * lib/sensor.c: Destroy the handler list of a sensor on a duplicate sensor entry. * include/OpenIPMI/ipmi_conn.h: Added hacks to some of the interfaces to support wierd things. * lib/domain.c: ditto * lib/ipmi_lan.c: ditto * lib/ipmi_smi.c: ditto * lib/oem_atca.c: ditto * lib/oem_force_conn.c: ditto * lib/oem_motorola_mxp.c: ditto * lib/oem_motorola_mxp_intf.c: ditto * lib/domain.c: Added sending message straight to an interface if it matches the address of an interface. * lib/ipmi_lan.c: Added support for a wierd hack where the first IPMI address in a LAN message is 0x20, and the other one is the internal address. * lib/oem_atca_conn.c, lib/oem_atca.c: Added some hacks for the current bugs in the Intel ATCA box. * lib/oem_atca.c: Reworked the handling of MCs and entity addition to happen after the user is informed of the domain. * include/OpenIPMI/ipmi_domain.h, lib/domain.c: Added a way for OEM code to call the MC scan done handler. * lib/oem_atca.c: Fixed some SEL handling and report MC scan done when it is done. * lib/oem_atca.c: Added hacks for broken SDRs. * configure.in: Move to version 1.3.3. 2004-04-09 Corey Minyard * lanserv/emu.c, lanserv/emu.h, lanserv/emu_cmd.c: Added capabilities to disable, enable, and remove MCs, also added a sleep command. * lanserv/lanserv_emu.c: Added support for the sleep command. 2004-04-08 Corey Minyard * lib/ipmi_smi.c, lib/ipmi_lan.c, lib/domain.c: Remove the broken broadcast handling from the domain code and put it into the lower-level code, so the lower level code knows how to time it better. * lib/domain.c: Add a scan of IPMB 0x20 as the first thing. * lib/domain.c: Destroy locks last in a domain. * lib/mc.c, lib/entity.c, include/OpenIPMI/ipmi_mc.h: Rework the active_handlers dependency between entitys and MCs by using a refcount instead of seeing if something is in the active handlers list. Using the list didn't work because external (user) entities in the list would keep the MC from being destroyed. * lib/oem_atca.c: Added a check_hot_swap_state handler. Fixed some problems with getting the hot-swap state. * lib/domain.c, include/OpenIPMI/ipmi_domain.h: Added a callback to be called when a domain starts shutting down. * lanserv/atca.emu: Added a new board. * lanserv/emu.c: Fixed problems with event timestamps. * lib/domain.c, lib/entity.c, lib/mc.c, lib/oem_atca.c: Fixed a host of problems with shutdown order. It still needs some work because of the backwards dependency from entities to MCs created by the requirement for active MCs to contribute to entity presence. * lib/oem_atca.c: Create the entities for the items in the shelf address table at startup and keep them around. 2004-04-07 Corey Minyard * ui/ui.c: Added an MC active callback to the UI. * configure.in: Move to version 1.3.2. * lib/oem_motorola_mxp.c: Added a slot GA sensor to the AMC. 2004-04-02 Corey Minyard * lib/sensor.c, lib/control.c: Make sure that calls that send messages cannot be done on destroyed sensors. 2004-04-02 Corey Minyard * lib/entity.c, lib/sensor.c, lib/control.c: Fixed a rather nasty race condition. Sensors and control may go away after the MC goes away underneath them if the sensor or control has an operation pending. The entity routine to remove the sensor and control calls ipmi_xxx_convert_to_id(), which requires the MC to exist. These were converted to use the pointer itself. 2004-04-02 Corey Minyard * lanserv/emu.c, lanserv/emu_cmd.c, lanserv/emu.h: Reworked LED support to better handle ATCA. Added hot-swap support. * lanserv/README.emulator: Added. * lanserv/atca.emu: Added. * lib/oem_atca.c: Worked on hot-swap support. * configure.in: Move to version 1.3.1. * doc/OpenIPMI.texi: Added some docs on ATCA. * lib/entity.c: Added a check for duplicate FRU entries in the SDR DLRs, in case there is one. * lib/mc.c: Fixed connection up info to be freed for MCs that never go active. * lib/entity.c, include/OpenIPMI/ipmi_entity.c: Added support for checking the current hot-swap state (as in an audit). * include/OpenIPMI/ipmiif.h.in: Added functions for the above call. * lib/domain.c: Fix the ordering of OEM handling and reporting things so the MC is ready for commands at that time. * lib/entity.c: Add checking of hot-swap state along with presence. * lib/oem_motorola_mxp.c: Added an event for the power control. * lib/control.c, include/OpenIPMI/ipmi_control.h: Added a way to do noseq callbacks to controls. 2004-04-01 Corey Minyard * lanserv/emu.c, lanserv/emu_cmd.c, lanserv/emu.h: Added a start at ATCA support. * lanserv/atca.emu: Emulator file for ATCA support started. * lib/mc.c, include/OpenIPMI/ipmi_mc.h: Added support for watching when an MC goes active or inactive. * lib/entity.c: For entities with FRU data, use the fru device (whether the MC is active or not)) to know if the entity is present. * include/OpenIPMI/ipmi_msgbits.h: Add some netfns for the group extensions. * lanserv/ipmi_checksum.c, lanserv/Makefile.am: Added a small program for calculating checksums, useful when working with emulator files and FRU info. * lib/domain.c: Moved the OEM domain info destroyer callback to the end of the domain destruction so that the OEM data is available through the destructino process. * lib/mc.c, lib/domain.c: Newly created MCs come up inactive by default and are set active. * lib/oem_atca.c: Lots of little bug fixes, finally getting to test it. * ui/ui.c: Added multi-record dumping for FRU info. * ui/ui.c: Added support for settings-based lights. * lib/entity.c: A rework of the entity handling so that entities cannot be destroyed while callback handlers are using them. * lanserv/emu_cmd.c, lanserv/emu.h: Made command reading halt on the first error. 2004-03-31 Corey Minyard * lanserv/emu.c, lanserv/emu_cmd.c: Added power control, fixed some problems with getting the event state. * lanserv/emu.c: Added the hot-swap LED control. * lib/oem_test.c, lib/ipmi.c: Added some test code for testing things inside OpenIPMI. * lib/chassis.c: Added tests to make sure the response is long enough in power controls. * lib/entity.c: More work on the hot-swap state machine. * lib/sdr.c: Fix a memory leak when the SDRs are replaced. 2004-03-30 Corey Minyard * lib/sensor.c: Fix a problem checking the event capabilities on setting the event enables. * lanserv/emu.c, lanserv/emu.h, lanserv/emu_cmd.c: Started actually working on a useful simulator. Added SDR, FRU data, and sensor support. 2004-03-26 Corey Minyard * lib/entity.c: Added calling the entity update handler when the hot-swap capabilities change. * lib/strings.c, include/OpenIPMI/ipmiif.h: Added strings for the hot-swap states. * ui/ui.c: Added hot-swap support. * ui/ui.c: Turn off nonblocking mode on the write fd. * lib/entity.c: Some hot-swap fixes. * lib/oem_motorola_mxp.c: Turned on the hot-swap indicator and hot-swap requester. * lib/sensor.c: Alloc a handler_list for each sensor for type 2 sensors records. * lib/entity.c: Added a slot sensor as one that has a bit presence detector. * lib/entity.c: Don't require event support for a presence sensor. * lib/entity.c: Don't fetch FRU information for an entity until it is present. 2004-03-25 Corey Minyard * lib/entity.c: Always rescan FRU info on an entity presence change for an entity that has FRU info. 2004-03-23 Corey Minyard * lib/entity.c: Call _ipmi_find_or_create_mc_by_slave_addr() on new mcdlrs. * lib/domain.c: Scan MCs that are added from SDR sources. * lib/oem_atca.c: Turn off SEL support for everything but the BMC. * lib/oem_atca.c: Rework the handling of new MCs and entities to handle things added before the FRU information is read. * lib/entity.c: Use certain sensors that have presence bits as presence sensors. 2004-03-20 Corey Minyard * everything: Massive rework of the code structure. 2004-03-19 Corey Minyard * configure.in, include/OpenIPMI/ipmiif.h.in: Completele rework the version handling so that major, minor, release, and extra version information are separately available for #ifdeff-ing. * lib/ipmi.c, ui/ui.c: Use OPENIPMI_VERSION for the version string. * Makefile.am, configure.in, OpenIPMI.pc.in, OpenIPMIui.pc.in: Added pkg-config info for OpenIPMI libraries. * lib/posix_thread_os_hnd.c, lib/Makefile.am: Add a first shot at a threaded POSIX OS handler, libOpenIPMIpthread. * OpenIPMIpthread.pc.in, Makefile.am, configure.in: ditto 2004-03-15 Corey Minyard * include/OpenIPMI/selector.h, lib/selector.c: Unfortunately, there were some race conditions in the freeing up of file descriptors. Cleanups were done for this. * include/OpenIPMI/os_handler.h: Unfortunately, there were some race conditions in the freeing up of file descriptors. Cleanups were done for this. * ui/ui_os.c: Adjusted for the selector and os_handler changes. * lib/ipmi_smi.c: ditto * lib/ipmi_lan.c: ditto * lib/oem_motorola_mxp_intf.c: ditto 2004-03-11 Corey Minyard * lib/mc.c: Fix the set_time routine to pass in the info to the message send. 2004-03-09 Corey Minyard * lib/oem_motorola_mxp.c: Don't create the "healthy" sensor for AMC boards. * lib/oem_motorola_mxp.c: Clear our the right variable after the allocation of info->con_ch_info. 2004-03-04 Corey Minyard * include/OpenIPMI/ipmi_int.h, lib/sel.c, lib/mc.c: Fix broken time calculations for events. * lib/ipmi_lan.c: ditto * lib/ipmi_smi.c: ditto * include/OpenIPMI/ipmiif.h.in, lib/event.c, lib/domain.c: Created a new event delete function that does not take a domain. * doc/OpenIPMI.texi: Added some more documentation and cleaned things up a little. 2004-03-02 Corey Minyard * lib/ipmi_lan.c: Fixed a bug where incoming SNMP traps were compared against the wrong IP address. * lib/oem_atca.c: Added the cold reset control. * lib/sensor.c: Fixed the range check in ipmi_sensor_pointer_cb(). * lib/control.c: Fixed the range check in ipmi_control_pointer_cb(). 2004-03-01 Corey Minyard * lib/oem_atca_conn.c: Set broadcast_broken all the time. * lib/ipmi.c: Added raw debug tracing for incoming SNMP traps. * include/OpenIPMI/ipmi_conn.h, lib/ipmi.c, ui/basic_ui.c: Added a source address length to the SNMP trap reporting handler. 2004-02-26 Corey Minyard * lib/mc.c, include/OpenIPMI/ipmi_mc.h: Added a way to check if an ID is invalid. * include/OpenIPMI/ipmiif.h.in: ditto for domains, sensors, controls, and entities. * lib/domain.c: ditto * lib/sensor.c: ditto * lib/control.c: ditto * lib/entity.c: ditto * lib/entity.c: Do a changed callback on the parent and child when a parent-child relationshi

* lib/domain.c: Fixed a few problems were callbacks can receive NULL values that were not being handled. * configure.in: Move to version 1.2.16. * lib/oem_motorola_mxp.c: Added zeroing all data structures after they are allocated. * lib/entity.c, include/OpenIPMI/ipmiif.h: Added a way to have multiple callback handlers on control, sensor, and fru updates. * ui/ui.c: Converted over to the multi-callback handlers. 2004-02-24 Corey Minyard * lib/control.c: Added an option for light controls to be able to set their color, on, and off times directly. * include/OpenIPMI/ipmiif.h: ditto * include/OpenIPMI/ipmi_control.h: ditto * include/OpenIPMI/ipmi_bits.h, lib/strings.h: Added an "orange" light color. * lib/oem_atca.c: Started serious work into handling for ATCA LEDs. * lib/oem_motorola_mxp.c: Added handling for newer Zynx switch boards. * utils/Makefile.am: Removed the md2 and md5 tests since they contain marginally free code. * lib/mc.c, include/OpenIPMI/ipmi_mc.h: Added a way to enable and disable the event generation on an MC. * ui.c, man/ipmi_ui.1: Added commands for mc event enable settings. * lib/entity.c, include/OpenIPMI/ipmi_entity.h: Added a way to have multiple callback handlers called when an entity is added to a domain. * lib/domain.c, include/OpenIPMI/ipmiif.h: ditto * lib/domain.c: Modified finding the event reciever to use the event receiver bit (not the SEL bit) and to ignore BMC channels, since their addresses would be bogus. * lib/ipmi_lan.c: Removed scanning the system address for general LAN connections. It will do wierd things, and is only necessary if specific support is required. * lib/oem_motorola_mxp.c: Re-added scanning the system address for MXP chassis. * lib/domain.c, include/OpenIPMI/ipmi_domain.c, lib/sensor.c: Changed _ipmi_find_or_create_mc_by_slave_addr() to take a channel as part of the address. 2004-02-23 Corey Minyard * lib/mc.c: Fixed a race condition dealing with an MC going away while the SDRs were being fetched. I wasn't following my own rules about pointers and callbacks. * lib/oem_motorola_mxp.c: Added a read handler for the I2C Isolate control. * lib/oem_motorola_mxp.c: Used the minor firmware version, not the major version,to tell if an MXP board has SDRs on-board. * configure.in: Move to version 1.2.15. * lib/domain.c, lib/mc.c, lib/oem_motorola_mxp.c: Fix some problems handling things being destroyed at startup. * lib/oem_motorola_mxp.c: Changed the number of boards on the half-pint chassis to 9. Fixed the detection of board versions. 2004-02-22 Corey Minyard * lib/oem_motorola_mxp.c: Added reading the reset control for boards. Don't create the I2C Isolate controls on the half-pint chassis. * man/ipmi_ui.1: Fixed the explanation of connecting using multiple connections and LAN addresses. * configure.in: Move to version 1.2.14. * sensor.c: Added a missing command length setting. 2004-02-20 Corey Minyard * lib/fru.c, include/OpenIPMI/ipmi_fru.h: Added multi-record FRU handling. * lib/entity.c, include/OpenIPMI/ipmiif.h: Added multi-record FRU handling. * lib/domain.c, include/OpenIPMI/ipmi_domain.h: Added OEM information for a domain. * lib/oem_atca.c: More ATCA work. 2004-02-19 Corey Minyard * lib/lanparm.c: Initialize the callback data when cleaning the lan parm lock. * man/ipmicmd.1, man/ipmi_ui.1: Update to make current. * include/OpenIPMI/ipmiif.h, lib/entity.c: Added an entity id comparison function. * include/OpenIPMI/ipmiif.h, include/OpenIPMI/ipmi_types.h: Added invalid id's for all the various object id's. * include/OpenIPMI/ipmi_mc.h: ditto * lib/entity.c: ditto * lib/mc.c: ditto * lib/sensor.c: ditto * lib/control.c: ditto * lib/domain.c: ditto * doc/OpenIPMI.texi: Added some more information about locking. * lib/oem_atca.c, lib/ipmi.c: Started work on the ATCA code. 2004-02-18 Corey Minyard * configure.in: Reworked SNMP library configuration to check for the include files first, then the libraries. * README: Improved quite a bit. * lib/oem_motorola_mxp.c: Modified the power supply sensor to only set the power feed failure bits on DC power supplies. * doc/OpenIPMI.texi: Revised the Motorola MXP documentation. * lib/oem_motorola_mxp.c: Discovered that the "power good" bit in the power supply status event is really a "power fail" bit. * configure.in: Move to version 1.2.12. * lib/oem_motorola_mxp.c: Renumbered the sensors so that five power supplies and fans could fit. Also split out the fan info from the power supply info to allow different counts of fans and power supplies. Fixed the fan IPMB for half-pint to be 0x30-0x34. * lib/entity.c, include/OpenIPMI/ipmiif.h: Added the ability to get the channel and address for a device-relative entity. * configure.in: Move to version 1.2.13. * lib/oem_motorola_mxp.c: Add fan speed raw/cooked conversion function. * lib/domain.c: Fixed a problem with handling old messages on a failover. Changed so that old messages will certainly be ignored. 2004-02-17 Corey Minyard * include/OpenIPMI/ipmi_conn.h: Added a "broadcast broken" flag to the interface data. * include/OpenIPMI/ipmi_domain.h, lib/domain.c: Removed the ability to set broadcast broken directly for the domain, instead we get it from the interface data. * lib/oem_motorola_mxp.c: Add setting broadcast broken on the interface to an MXP, removed the domain setting of the same. * configure.in: Move to version 1.2.11. 2004-02-12 Corey Minyard * include/OpenIPMI/ipmiif.h, lib/entity.c: Added entity-id based versions of some hot-swap functions and the function to get the current entity presence. * include/OpenIPMI/ipmiif.h, doc/OpenIMPI.texi: Added some text about how the object pointer callbacks are always called immediately. * lib/sel.c: Initialize the return value in ipmi_sel_add_event_to_sel(). * lib/sel.c, ui/ui.c: Fix some problem with adding events to the SEL. * configure.in: Move to version 1.2.10. * lib/OpenIPMI/ipmi_addr.h, lib/ipmi_utils.c: Added a privilege field to the IPMI LAN address. 2004-02-11 Corey Minyard * lib/sensor.c: Reworked sensor naming to include the entity id and instance. * lib/oem_atca_conn.c: Made ATCA connections always active. * lib/entity.c, include/OpenIPMI/ipmi_entity.h: Revised the entity addition function to take the mc channel and address, not an MC pointer, since the MC pointer is not always available. * lib/oem_motorola_mxp.c: adjusted for the previous change * lib/chassis.c: adjusted for the previous change * lib/sensor.c: adjusted for the previous change * lib/control.c, lib/sensor.c: Fixed some problems dealing with non-standard device-relative entities that are actually not on the device we are dealing with. * lib/oem_motorola_mxp.c: Added a CPCI board healthy sensor. * ui/basic_ui: Added a '-drawmsg' parameter to start raw message tracing at startup. * include/OpenIPMI/ipmi_addr.h: Added updates to the lan address stuff. * ui/ipmicmd.c: ditto * lib/ipmi_utils.c: Added handling of the LAN address type. * lib/oem_motorola_mxp.c: Removed the ability to set the chassis type control, as it is really not settable. * configure.in: Move to version 1.2.9. 2004-02-10 Corey Minyard * include/OpenIPMI/ipmi_mc.h, lib/mc.c: Added a way to send events to the SEL of an MC. * include/OpenIPMI/ipmi_sel.h, lib/sel.c: ditto * ui/ui.c: Added a way to add events using the above calls. * lib/oem_motorola_mxp.c: Make the entities for boards on the MXP V2 chassis device-relative. 2004-02-09 Corey Minyard * configure.in: Move to version 1.2.7. * lib/oem_motorola_mxp.c: Add support for MXP half-pint chassis. * include/OpenIPMI/ipmiif.h: removed * include/OpenIPMI/ipmiif.h.in: added, with version info * configure.in: Added setting the version info of ipmiif.h * include/OpenIPMI/ipmiif.h.in, lib/ipmi.c: Added a version function. * include/OpenIPMI/ipmi_addr.h: Added a LAN address type. * lib/domain.c: Modified the bus scanning to put a second delay between attempts when checking for an MC that has been removed, just in case of a transitional failure. * sample/ipmicmd.c: Added support for LAN addresses. * configure.in: Move to version 1.2.8. 2004-02-08 Corey Minyard * lib/entity.c: Don't subtract 0x60 from device-relative entity instances in the id, just leave it. * lib/entity.c: Fix some bugs extracting DLRs from the SDRs. * ui/ui.c: Subtract 0x60 from device-relative entity instances on display/input. 2004-02-02 Corey Minyard * configure.in: Move to version 1.2.6. * everything: Massive rework of the logging to get more information in there so the logs can be correlated to specific domains, sensors, MCs, etc. 2004-01-31 Corey Minyard * domain.c: Cleaned up logs, made them include the file and function name. * ipmi_lan.c: Ditto * ipmi_lan.c: Modified message logging to separate the raw and normla message logging. 2004-01-29 Corey Minyard * lib/oem_motorola_mxp.c: Move the AMC chassis id and temp cool LED to the main chassis entity, since only the active AMC handles it. 2004-01-28 Corey Minyard * configure.in: Move to version 1.2.5. * lib/oem_motorola_mxp.c: Removed the hot-swap status from the blue leds and ejector switches, until I figure out a good way to handle the power. * lib/entity.c: Fixed an extraneous unlock in the hot swap code. * lib/domain.c: Only scan the IPMB on an address change if not in startup mode to avoid scanning an MC before the user is informed of the domain being up. 2004-01-27 Corey Minyard * lib/entity.c: Finished implementing the hot-swap state machine. 2004-01-26 Corey Minyard * include/OpenIPMI/ipmiif.h, lib/sensor.c, lib/control.c, lib/entity.c: Added some routines for dealing more directly with ids. * configure.in: Move to version 1.2.4. * lib/domain.c, lib/sensor.c, lib/mc.c: Fixed some domain shutdown problems. * lib/oem_motorola_mxp.c: Reworked the control and sensor creation so the object is fully correct and available when reported. 2004-01-25 Corey Minyard * lib/sensor.c: Lots of cleanups and error handling consolidation. 2004-01-24 Corey Minyard * lib/sensor.c, include/OpenIPMI/ipmi_sensor.c: Reworked the default threshold handling, I misread the spec on this. These are only valid for setting the threshold at init time. * lib/oem_motorola_mxp.c: Removed all the SDR hacks, since it is now all correct in the SDRs. * configure.in: Move to version 1.2.3. 2004-01-23 Corey Minyard * lib/ilist.c, include/OpenIPMI/ilist.h: Added a ilist_twoitem_destroy() call. * include/OpenIPMI/ipmi_control.h, lib/control.c: Allow controls to generate update events. * lib/conn.c: Fixed some memory leaks. * include/OpenIPMI/ipmi_bits.h: Added a return value for the event handlers to tell if the handler will manage the event or if it should be passed on. * include/OpenIPMI/ipmi_control.h, lib/control.c: ditto * include/OpenIPMI/ipmi_sensor.h, lib/sensor.c: ditto * include/OpenIPMI/ipmi_control.h, lib/control.c: Added lots of info to the hot-swap indicator. * include/OpenIPMI/entity.h: Added lots of info to the hot-swap state machine description. * include/OpenIPMI/ipmiif.h, lib/entity.c: Started work on the hot-swap state machine. * lib/oem_motorola_mxp.c: Went back to the old presence state machine, except the healthy and reset events cause a presence check, they don't directly drive the state machine, since then are not 100% dependable. * lib/oem_motorola_mxp.c: Modified the code to register all product ids from 0x01 to 0x40 as MXP products. 2004-01-22 Corey Minyard * include/OpenIPMI/ipmiif.h, include/OpenIPMI/ipmi_control.h: Added a way for standard value controls to generate events. * lib/control.c: ditto 2004-01-21 Corey Minyard * include/OpenIPMI/ipmiif.h, lib/sensor.c: Added a way to register multiple handlers on a sensor event. 2004-01-20 Corey Minyard * include/OpenIPMI/ipmiif.h: Added hot-swap state machine and function definitions. * include/OpenIPMI/ipmi_entity.h, lib/entity.c: Added hot-swap polymorphic routines. * include/OpenIPMI/ilist.h, lib/ilist.c: Added two item list code, primarily for handling callback lists. * lib/conn.c: Converted OEM connection callback list to the two item list, and call all the OEM connection callbacks at once. 2004-01-19 Corey Minyard * lib/conn.c, include/OpenIPMI/ipmi_conn.h: Added a connection handler for testing new connections types (primiarily for ATCA). * lib/oem_atca_conn.c, lib/ipmi.c: Added, new code for ATCA connection handler, for getting the IPMB address. * lib/domain.c: Fixed a problem in domain OEM callbacks; the iterator used may become invalid during the process of handling the OEM callbacks. * lib/ipmi_lan.c: Return NULL for the IPMI in a handler when the connection is shut down. * lib/ipmi_lan.c, lib/ipmi_smi.c: Added calls to the OEM connection handler code. * lib/ipmi_smi.c: Have the shutdown code call the handler on all outstanding messages. 2004-01-14 Corey Minyard * configure.in, ui/basic_ui.c: Added support for net snmp. * configure.in: Move to version 1.2.2 * ui/ui.c: Added handling for controls going away when displayed. * README.MotorolaMXP: Added. * lib/oem_motorola_mxp.c: Modified the handling for custom AMC sensors to only be created if it's an old AMC. Also added support for handling the sensors from the AMC properly, setting the entity ID properly. * lib/domain.c: Have the domain code call the OEM handler for the SI MC. * lib/mc.c: Added a way to have an MC's main device repository treated as a device SDR repository. * lib/oem_motorola_mxp.c, doc/OpenIPMI.texi: Removed the fan speed control (it no longer works) and added the fan speed reading. 2004-01-14 Corey Minyard * doc/OpenIPMI.texi: Added some MXP-specific information. * lib/oem_motorola_mxp.c: Fixed a few problems, the Chassis ID sensor was on the wrong entity, some boards were missing, and a few other little glitches. * lib/domain.c: Added scanning the system interface when a connection goes up or down. 2004-01-13 Corey Minyard * configure.in: Move to version 1.2.1 * configure.in, ui/Makefile.am, ui/basic_ui.c: Make the SNMP stack optional. * man/ipmi_ui.1: Add docs for the -snmp option * doc/OpenIPMI.texi: Added docs for the SNMP trap handling. * include/OpenIPMI/ipmi_conn.h, lib/ipmi.c: Added an external SNMP trap handler. * include/OpenIPMI/ipmi_lan.h, lib/ipmi_lan.c: Added an external trap handler. * include/OpenIPMI/ipmi_mc.h, lib/mc.c: Added a return code from adding an event to know if the event was a duplicate. * include/OpenIPMI/ipmi_sel.h, lib/sel.c: Ditto * lib/domain.c: Modified the incoming event handler so that if it gets a NUL event message, to rescan the SEL from the source MC. * lib/ipmi_lan.c: Modified the sequence number handling to not use a zero sequence number, and to ignore zero sequence numbers. This allows things to send messages with ignored responses by setting the sequence to zero. * ui/basic_ui.c: Added support for SNMP traps. 2004-01-12 Corey Minyard * lib/pet.c, include/OpenIPMI/ipmi_pet.h: Modified the PET code to only handle a single channel, and to specify the channel and connection explicitly. It's really impossible for this code to know automatically what channels to configure and what IP addresses to use for each. * configure.in: Update version to 1.2.0. * lib/mc.c, include/OpenIPMI/ipmi_mc.h, include/OpenIPMI/ipm_oem.h: Added a mechanisms to fixup a sensor before anything is done with it (to fix broken values). * lib/oem_motorola_mxp.c: Added a fixup handler for AMC sensors to set the entity instance properly. * lib/oem_motorola_mxp.c: Converted over handling of semi-standard sensors to use the standard sensor fetch mechanism, if possible. Also added the AMC temperature sensor. * doc/OpenIPMI.texi - Added a bunch of info on the new MXP version. * lib/oem_motorola_mxp_intf.c: Modified to startup up a standard LAN connection if on a newer AMC. * lib/sensor.c, include/OpenIPMI/ipmi_sensor.c: Added a send_lun to the OEM sensors so they can use the normal sensor code for things that are standard. 2004-01-09 Corey Minyard * include/OpenIPMI/ipmi_bits.h, ui/ui.c, lib/strings.c: Added one-shot reset, general output, and one-shot ouput controls. * lib/oem_motorola_mxp.c: Added a bunch of controls for various things in the chassis and boards. * lib/ipmi_lan.c: Fixed a problem when receiving messages, need to compare the netfn as well as the command when looking for sendmsg and event msg buffer commands. * lib/oem_motorola_mxp.c: Modified the presence sensor for normal boards to use the CPCI healthy signal instead of the wierd thing it was doing. * lib/mc.c: Don't delete the MC removed handlers unless the MC is really deleted. 2004-01-08 Corey Minyard * lib/fru.c: Added error info logs to tell why a FRU was bad. * doc/OpenIPMI.texi: Added documenataion for the new PEF, PET, and LAN configuration items. * lib/domain.c, include/OpenIPMI/ipmi_domain.h: Added code to check if a specific connection is active and to activate a connection explicitly. * ui/ui.c: Added support for the connection activation. * lib/mc.c, include/OpenIPMI/ipmi_mc.h: Added a mc reset command for sending MC cold and warm resets. * lib/chassis.c: Added a one-shot reset control. * lib/oem_motorola_mxp.c: Added controls for the version AMC version. 2003-01-08 Jeff Zheng * lib/pef.c: Various fixes for PEF handling. 2004-01-07 Corey Minyard * ui/ui.c: Added LAN and PEF lock clearing. * lib/pet.c, include/OpenIPMI/ipmi_pet.h: Reworked the PET to support proper locking and to support the proper setup of the policy number. * ui/ui.c: Added support for the PET. * lib/domain.c, include/OpenIPMI/ipmi_domain.h: Added a "broadcast broken" field so systems that have non-working broadcasting can set this. Then bus scanning wll use normal messages, not broadcasts. * lib/oem_motorola_mxp.c: Set the broadcast broken flag. 2004-01-06 Corey Minyard * lib/pef.c, include/OpenIPMI/ipmi_pef.h: Reworked this to handle locking properly, the lock is claimed on a PEF config read and the lock is cleared on a write. Also added a specific clear lock operation. * lib/lanparm.c, include/OpenIPMI/ipmi_lanparm.h: Reworked this to handle locking properly, the lock is claimed on a LAN config read and the lock is cleared on a write. Also added a specific clear lock operation. 2004-01-05 Corey Minyard * ui/ui.c, ui/basic_ui.c: Added a way to free things allocated in the main routine. * lib/ipmi.c, include/OpenIPMI/ipmi_int.h: Added an IPMI rwlock. * lib/pet.c: Converted the main pet lock to a rwlock. * ui/ui.c: Consolidate MC reading. * lib/domain.c: Fixed the system interface address handling to be correct for the individual interfaces. * lib/ipmi_lan.c: Removed the bind code, as if you don't bind an address one will be auto-assigned. * ui/ui.c: Added the ability to set the LAN and PEF parameters. 2004-01-05 Corey Minyard * include/OpenIPMI/ipmi_int.h, lib/ipmi.c: Added a way for internal code to fetch the global OS handler. * lib/pef.c, include/OpenIPMI/ipmi_pef.h: Added a way to get the MC for a PEF. * lib/impi_lan.c: Added system address scanning for all LAN connections. * lib/ipmi.c: Added PET init and shutdown functions. * lib/ipmi.c, include/OpenIPMI/ipmi_int.h: Added a method to get the main OS handler. * include/OpenIPMI/ipmi_addr.h: Added a define for the "self" channel. * lib/pet.c, include/OpenIPMI/ipmi_pet.c, lib/Makefile.am: Added a way to easily set up the platform event trap stuff for just getting all events. * ui/ui.c: Added support for the LAN parameter display. 2004-01-02 Corey Minyard * include/OpenIPMI/ipmi_int.h: Added ipmi_strdup for use by everyone. * include/OpenIPMI/ipmi_pef.h, lib/pef.c: Added and mostly rewrote some PEF code from Jeff Zheng. Still not quite done. * include/OpenIPMI/ipmi_lanparm.h, lib/lanparm.h: Added code for handling LAN configuration parameters. * ui/ui.c: Added some code for fetching and writing PEFs. 2003-12-26 Corey Minyard * configure.in: Move to version 1.1.8 2003-12-26 Corey Minyard * include/OpenIPMI/ipmi_domain.h, lib/domain.c: Added a domain OEM handler for detecting and setting up special types of domains, mainly in preparation for ATCA. * lib/ipmi_lan.c: IPMIv1_5_rev1_1_0926 markup, section 6.12.4, didn't clear things up at all. Some manufacturers have interpreted a certain way that this added code handles, but IMHO it is incorrect. 2003-12-09 Louis Zhuang * lib/ilist.c: Fix a bug in the routine to go to the previous item. 2003-12-05 Corey Minyard * lanserv/emu.c: Work on SDR emulation. 2003-12-04 Louis Zhuang * include/OpenIPMI/ipmi_mc.h, lib/mc.h: Add a new function 'ipmi_mc_sel_get_last_addition_timestamp' for OpenHPI to use. * include/OpenIPMI/ipmi_sel.h, lib/sel.h: Add a new function 'ipmi_sel_get_last_addition_timestamp'. 2003-12-04 Jeff Zheng , Corey Minyard * sample/ipmicmd.c: Actually close the IPMI connection at quit. 2003-12-04 Corey Minyard * include/OpenIPMI/ipmiif.h: Use "const" properly to get rid of warnings. * lib/ipmi.c: ditto * sample/ipmicmd.c: ditto * sample/sample.c: ditto * ui/basic_ui.c: ditto 2003-12-03 Corey Minyard * lib/sensor.c: Allow settable hysteresis values to be read, too. * include/OpenIPMI/ipmi_bits.h: Added some docs on the confusing names of the hysteresis values. 2003-12-03 Corey Minyard * configure.in: Move to version 1.1.7 * lib/ipmi_lan.c: Updated the response format where the send message is include with the response to include the destination IPMB as part of the header. * lanserv/emu.c lanserv/lanserv.c lanserv/lanserv_emu.c: Adjustments for the previous change. * utils/md5.c: Fixed this to work on big and little endian without special defines. 2003-12-02 Corey Minyard * lanserv/emu_cmd.c, lanserv/Makefile.am, lanserv/lanserv_emu.c: Added a command processor for handling control commands to the emulator. * lanserv/emu.c, lanserv/emu.h, lanserv/lanser_emu.c: Massive restructure to clean this up and support various commands and get IPMB working. * lanserv/lanserv.c: Check for proper message length in broadcasts. 2003-12-02 Louis Zhuang * include/OpenIPMI/ipmi_mc.h, lib/mc.h: Add a new function 'ipmi_mc_event_by_recid' for OpenHPI to use. * include/OpenIPMI/ipmi_sel.h, lib/sel.h: Add a new function 'ipmi_sel_get_event_by_recid'. 2003-12-01 Corey Minyard * include/OpenIPMI/ipmi_mc.h, lib/mc.c: Renamed some functions to remove the leading "_". This opens them up for OpenHPI to use. * lib/domain.c: Updates for the above changes. * lib/sel.c: ditto * lib/sdr.c: ditto * lib/sensor.c: ditto * lib/control.c: ditto * lib/oem_motorola_mxp.c: ditto * ui/ui.c: ditto 2003-11-30 Corey Minyard * include/OpenIPMI/ipmi_control.h, lib/control.c: Added a way to get the source MC for the control. * include/OpenIPMI/ipmi_sensor.h, lib/sensor.c: Added a way to get the source MC for the sensor. * lib/chassis.c, lib/mxp_oem_motorola_mxp.c: Side effects from the above changes. * include/ipmi_domain.h, lib/domain.c: Reworked the MC update handler to be more standard. * ui/ui.c, ui/basic_ui.c: Fix problems with the reconnect code. * ui/ui.c: Added MC update handler registration so new MCs are reported. 2003-11-28 Corey Minyard * include/OpenIPMI/ipmiif.h, lib/ipmi.h: Added parameter parsing code for parsing the various types of connections from argv-type strings (really taken from ui/basic_ui.c). * ui/basic_ui.c, sample/sample.c, sample/ipmicmd.c: Converted over to use the new parameter parsing code. 2003-11-21 Louis Zhuang * lib/domain.c, include/OpenIPMI/ipmi_domain.h: Add function 'ipmi_domain_set_bus_scan_handler' to indicate bus scan is done * sample/sample.c: Add some code to demostrate usage of 'ipmi_domain_set_bus_scan_handler' 2003-11-21 Louis Zhuang * lib/domain.c: Fix a bug in ipmi_domain_reread_sels 2003-11-17 Corey Minyard * lib/mc.c, lib/domain.c: Added support for detection old and newer IPMI versions and issuing appropriate logs. 2003-11-11 Corey Minyard * configure.in: Move to version 1.1.6. 2003-11-11 Jeff Zheng * configure.in: Add checking for getaddrinfo(). * include/OpenIPMI/ipmi_lan.h, lib/ipmi_lan.c: Added support for a IPv6 capable interface. * lanserv/lanserv.c, lanserv/lanserv_config.c, lanserv.h: Add support for IPv6 addresses. * sample/sample.c, ui/basic_ui.c, sample/ipmicmd.c: Reworked to use the new IPv6 capable interfaces. 2003-11-10 Corey Minyard * lib/domain.c: Fixed MC scanning to handle a single address properly and fixed some error handling cases. 2003-10-30 Corey Minyard * lib/domain.c: Fixed MC scanning to skip addresses properly at the beginning of a scan. * lib/domain.c, include/OpenIPMI/ipmi_domain.h: Modified the MC scanning ignoring to use ranges. * lib/domain.c: The previous fix to handle an MC-less case by just allowing scanning the BMC at 0x20, not scanning the sysaddr. The sysaddr stuff was just too tied to the redundant BMC case. * lib/ipmi_smi.c: Send messages with the proper size. 2003-10-31 Louis Zhuang * lib/mc.c, include/OpenIPMI/ipmi_mc.h: Add const qualifier into function 2003-10-30 Corey Minyard * lib/ipmi_smi.c: Handle data portion of a socket message correctly. * sample/ipmicmd.c: Fix error handling. 2003-10-30 Louis Zhuang , Corey Minyard * lib/mc.c, include/OpenIPMI/ipmi_mc.h: Add a function to set the SEL time for an MC. 2003-10-30 Corey Minyard * lib/selector.c: Allow a NULL send_sig handler. 2003-10-30 Jarrod Johnson * sample/ipmicmd.c: Close the connection when done. 2003-10-29 Corey Minyard * lib/mc.c, include/OpenIPMI/ipmi_mc.h: Added a way to force rereading the SEL. * lib/domain.c, include/OpenIPMI/ipmiif.h: Added a way to force rereading all the SELs in a domain. 2003-10-23 Corey Minyard * lib/sdr.c: Fixed a bug in the random backof of SDR reading. On a random backoff, it would also start one immediately, too. This was bad because it didn't avoid the contention and it was possible to have two SDR readings going on at the same time in the same SDR structure. 2003-10-23 Corey Minyard * lib/domain.c: If a BMC reports through its channels that is does not have an IPMB bus, then force scanning the system address so we will find something useful. 2003-10-20 Corey Minyard * ui/ui.c: Added some code to print the number of SEL entries on an mc (when dumping the MC) and the total number of SEL entries when listing the SEL. * lanserv/lanserv.c, lanserv/lanserv_config.c: Restructured the LAN code to make it more flexible and split out more generic functions. * lanserver/lanserv_emu.c, lanserv/emu.c, lanserv/emu.h: Ditto * include/OpenIPMI/lanserv.h: Ditto 2003-10-17 Tony Griffiths * lib/ipmi_smi.c: Added some enhanced debugging info. 2003-10-17 Corey Minyard * configure.in: Move to version 1.1.5. 2003-10-16 Corey Minyard * include/OpenIPMI/ipmi_mc.h, lib/mc.c: Added a way to get the current SEL time. 2003-10-16 Louis Zhuang * include/OpenIPMI/ipmi_mc.h, lib/mc.c: add a bundle of mc wapper functions for SEL operation 2003-10-15 Corey Minyard * ipmi_lan: Fix the send to the system address to be correct, and handle incoming messages properly. * lib/sdr.c: Null a message data (to keep valgrind happy). * ui/ui_os.c: Fixed a problem valgrind found, timer data may be freed in the user's handler, but we still used it in the timer handler after the call to the user's handler. 2003-10-15 Jeff Zheng * lib/mc.c: Null out some values on removal. * lib/fru.c: Calculate the end of the FRU data correctly. 2003-10-09 Thomas Kanngieser * lanserv/lanserv_asf.c: Send the right data for an RMCP ping. 2003-10-09 Corey Minyard * configure.in: Move to version 1.1.4. * lanserv/priv_table.c: Fixed the permissions checking code, ADMIN privilege was specified incorrectly for unknown messages and magic numbers were replaced with defined names. 2003-10-08 Livio Pugliese * lib/sensor.c: Added the missing log2() conversion function to the array of conversion values. 2003-10-07 Tony Griffiths * lib/domain.c: Fix getting the vendor id from the channel info response. 2003-10-02 Corey Minyard * lib/ipmi_lan.c: Changed the max outstanding message default to two. * lib/mc.c: Removed setting the event receiver for SEL devices that are not event generators. * ui/ui.c: Fixed problems printing entities. 2003-10-07 Tony Griffiths * lib/domain.c: Fixed channel scanning to go on if it gets an error from the channel. That way if channels are not present, it will still find channels beyond the errored channel. * lib/strings.c, include/OpenIPMI/ipmi_msgbits.h: Add strings for the netfns, commands, and errors. * include/OpenIPMI/ipmi_err.h: ditto * lib/ipmi_lan.c: Convert debugging to clean up the formatting and use the new strings. 2003-10-05 Thomas Kanngieser * lib/sensor.c: The binary search converting from float to raw values had the compare backwards. 2003-10-02 Corey Minyard * ui/entity.c: Fixed the custom info get function names. * ui/ui.c: Fixed a few FRU output problems. * sample/sample.c: Fixed the FRU output. * ui/entity.c, ui/fru.c: Added board manufacture time function. * include/OpenIPMI/ipmi_fru.h: ditto * include/OpenIPMI/ipmiif.h: ditto * ui/ui.c: Converted over all display of entities to do the relative and absolute entity names. * lib/sdr.c: The Get Device SDR command stupidly only returns the number of sensors, not the number of SDR entries. For device SDRs, the SDR array will expand up to 512 entries if it runs out of SDR entries. 256 is the max number of sensors, so this should be safe. 2003-10-02 Thomas Kanngieser * lib/sensor.c: The bit shifts for getting the hysteresis and threshold support from the SDR were incorrect. 2003-10-01 Corey Minyard * configure.in: Move to version 1.1.3 * lib/ui.c: Added support for device-relative entities. * include/OpenIPMI/ipmi_types.h: The bit assigns for entity_instance and channel were switched in the entity id type. * include/OpenIPMI/ipmi_control.h: Added an include for ipmi_addr.h since it is used in this include file. * include/OpenIPMI/ipmi_oem.h, lib/mc.c: Allow multiple OEM removal handlers to be registered against an MC. * include/OpenIPMI/ipmi_mc.h, lib/Makefile.am, lib/mc.c, lib/chassis.c: Added converting chassis control commands to a power control. 2003-09-30 Corey Minyard * lib/sdr.c: Don't refetch SDRs if the population is not dynamic. * lib/mc.c, lib/domain.c, include/OpenIPMI/ipmi_mc.h: Added an audit to check the SDRs for an MC and for the main SDR repository. * lib/mc.c: Was reading the device SDRs twice. That's why it was so slow at startup. * lib/domain.c: Call the connection change function as soon as the connection is up, don't wait to read the SDRs, etc. * ui/ui.c, include/OpenIPMI/ipmi_ui.h: Add a function to set the domain at startup. * lib/entity.c: Make sure to free the entity SDR info when it is destroyed. * lib/domain.c: Initialize the running field of the activate_timer_info data. * ui/ui.c: Added TCSADRAIN to the tcsetattr() calls so that the output wouldn't get chopped off on shutdown of the program. Also properly restored the flags for the output terminal. * ui/ui.c: Fixed a possible overrun in normal_char, it was using strcpy but the string wasn't necessarily nil terminated. Change to use memcpy with a length. 2003-09-29 Corey Minyard * lib/ipmi.c: The length bits of an IPMI string are the bottom 6 bits, no the bottom 5 bits. 2003-09-28 Corey Minyard * configure.in: Move to version 1.1.2. * lib/domain.c: Added handling of system ids in events. * lib/domain.c: Don't allow messages to be sent on a shutdown domain. This avoids an infinite loop in some cases. * lib/domain.c: In cleanup_domain(), pass the error response in as the response, not the original message. * lib/entity.c, include/OpenIPMI/ipmiif.h: Added entity functions to get FRU information so the user doesn't have to deal directly with the FRU type. * include/OpenIPMI/ipmiif.h, include/OpenIPMI/ipmi_fru.h: Moved all the FRU functions and types into ipmi_fru.h. * include/OpenIPMI/ipmi_fru.h, include/OpenIPMI/ipmi_bits.h: Moved the chassis types into the public bits. 2003-09-26 Corey Minyard * configure.in: Move to version 1.1.1. * Lib/ipmi_malloc.c: Fill debug malloced memory with junk to help catch usage before initialization. Also cleaned up some error messages. * lib/entity.c: Fixed a problem where some data was being used before initialization. 2003-09-25 Corey Minyard * configure.in: Move to version 1.1.0. * doc/OpenIPMI.texi: Added a little information about FRUs. * include/OpenIPMI/ipmiif.h, include/OpenIPMI/ipmi_entity: Moved entity type definitions to the public part and renamed them, and allow getting and setting the type * lib/entity.c: ditto * include/OpenIPMI/entity.h, lib/entity.c: Reworked the FRU handling to be more flexible. * include/OpenIPMI/ipmiif.h: Reworked the entity information to make it more understandable. * lib/entity.c: Lots of little cleanups for FRU handling and handling of SDR records. * lib/fru.c: Fixed handling of some data type to find some types of errors. * lib/ipmi_lan.c: Modified the handling of tunnelling IPMB over LAN to work with Intel boxes. It seems their interpretation of the spec is different than mine, but the code should now work with both interpretations. * lib/ipmi_malloc.c: Don't print some data that we don't have. * lib/oem_motorola_mxp.c: Updated for FRU handling. * ui/ui.c: Added better entity output and FRU change handling. 2003-09-24 Corey Minyard * ui/ui.c: Added some FRU handling commands. * lib/mc.c: Added entity scanning to device SDRs. * lib/entity.c: Reworked the entity SDR handling code so that it tracks the old values, detects when values change, and does the appropriate thing. * lib/fru.c, include/OpenIPMI/ipmi_fru.h: Added FRU handling code. * include/OpenIPMI/ipmiif.h: ditto * lib/Makefile.am, include/OpenIPMI/Makefile.am: ditto * lib/entity.c: ditto * lib/mc.c, include/OpenIPMI/ipmi_mc.c: Allow the entity code to store MC-specific SDR information in the MC. * lib/domain.c, include/OpenIPMI/ipmi_domain.c: ditto, but for the main SDR repository. * include/OpenIPMI/ipmi_bits.h: Added unicode support. * include/OpenIPMI/ipmi_control.h: ditto * include/OpenIPMI/ipmi_entity.h: ditto * include/OpenIPMI/ipmi_int.h: ditto * include/OpenIPMI/ipmi_sensor.h: ditto * include/OpenIPMI/ipmiif.h: ditto * lib/control.c: ditto * lib/entity.c: ditto * lib/ipmi.c: ditto * lib/oem_motorola_mxp.c: ditto * lib/sensor.c: ditto * include/OpenIPMI/ipmi_sensor.h, include/OpenIPMI/ipmi_mc.h: Moved the sdr fetching code to the MC code where it belonged, but had to export the sensors waitq to do this. * lib/mc.c, lib/sensor.c: ditto * include/OpenIPMI/ipmiif.h, include/OpenIPMI/ipmi_int.h: Moved the string decoding and data decoding functions into the internal functions. 2003-09-24 Corey Minyard * configure.in: Move to version 1.0.4. * lib/selector.c: Allow the selector code to be called from multiple threads, and fix a race condition on waking up waiting selectors. 2003-09-23 Corey Minyard * lib/sel.c, lib/sdr.c: Fixed setting the minor version, thanks Livio Pugliese for pointing this out. 2003-09-19 Corey Minyard * lib/selector.c, include/OpenIPMI/selector.h: Change sel_select_loop() to return an error if select fails(), instead of calling exit(). 2003-09-02 Corey Minyard * lib/oem_motorola_mxp_intf.c: Changed the timer for MXP messages to 20ms and added a 20ms delay between checking for the message lock. Added a 20ms delay after sending 8 messages to let other boxes have access. * lib/oem_motorola_mxp.c: Fixed the -12V voltage sensor on the 5365 card to be 10% tolerance. * lib/mc.c: Fixed process to continue when the SDR fetch fails. * lib/entity.c, include/OpenIPMI/ipmiif.h: Added a way to force entity presence detection. 2003-08-27 Corey Minyard * lib/ipmi_lan.c: Fixed reconnection problems. * lib/oem_motorola_mxp_intf: Removed connection loss detection from the MXP-specific queue fetch, because it is unreliable. Just use the main LAN connection for failure detection. * lib/mc.c: Don't cleanup the MC if the SDR read fails. 2003-08-13 Corey Minyard * configure.in: Move to version 1.0.3. * doc/OpenIPMI.texi: Minor doc updates. * lib/domain.c, include/OpenIPIM/ipmiif.h: Added a way for the user to know when all the main SDRs have been read. 2003-08-13 Louis Zhuang * lib/selector.c: Fixed a trivial bug in process_timers 2003-08-12 Corey Minyard * lib/sdr.c: Added code to the SDR so that it will wait until everything outstanding is clear before restarting the fetch operation. Also added a random timer to restart SDR operations when the reservation was lost. * lib/domain.c: Reworked the code to not start the connection up process on an inactive connection. 2003-08-11 Corey Minyard * lib/sdr.c: Fixed a locking bug in the SDR code. * lib/domain.c: Modified the set timer code that processes a new working connection to wait a while until activating the connection. This allows other connections that may already be active to come up. 2003-08-01 Corey Minyard * configure.in: Move to version 1.0.2. * lib/sensor.c, lib/control.c: Handle NULL controls and sensors in opq done. If a sensor is destroyed during an operation, this can be called with NULL. * lib/oem_motorola_mxp.c: Removed some debugging cruft. * lib/oem_motorola_mxp_intf.c: Cleaned up the debug dump output. 2003-07-31 Corey Minyard * lib/domain.c, include/OpenIPMI/ipmi_domain.h: Added a way to monitor management controllers as they are added and deleted. * lib/domain.c: Minor cleanups for handling the new MXP style of addressing. * lib/oem_motorola_mxp.c: Added monitoring for the AMC card. * lib/oem_motorola_mxp.c: Split the AMC card handling up to completely rework the way the AMCs are handled. The 0x20 address points to the current AMC. Addresses (f 0) and (f 1) point to the individual AMCs. * lib/oem_motorola_mxp_intf.c: ditto * lib/oem_motorola_mxp.c: Made the board entity instances one-based instead of zero based. 2003-07-30 Corey Minyard * lib/oem_motorola_mxp.c: Made entity instances start at one for all entities instead of the random smattering that was there. * lib/oem_motorola_mxp.c: Fixed power supply events to not use the slave address of the power supply when translating events. * lib/ipmi_lan.c, lib/oem_motorola_mxp_intf.c: Modified the lan connections to make a connection for each IP address instead of sharing a connection between IP addresses. Not all boxes support sharing a connection between IP addresses. * lib/domain.c: Fixed a problem handling * lib/ipmi_lan.c, lib/oem_motorola_mxp_intf.c: Fixed a problem where the connection state wouldn't change if only the active value changed and not the IPMB address. 2003-07-29 Corey Minyard * lib/oem_motorola_mxp.c: Fixed a few little things required for the new firmware. * lib/oem_motorola_mxp_intf.c: Modified messages directly to the system interface to use the sequence number queue from the standard IPMI LAN code. You couldn't use the standard message queue because those are one-at-a-time and the messages get gummed up in there. 2003-07-25 Corey Minyard * doc/OpenIPMI.texi: Minor doc updates about authentication. 2003-07-24 Corey Minyard * lib/mc.c: Delayed the start of fetching events for an MC's SEL until the domain connection is up. 2003-07-23 Corey Minyard * lib/entity.c: Fixed searching for the next presence sensor when one is deleted. * lib/entity.c: Don't set the device num for an entity if the instance is not device-relative. Also, don't add an mcdlr if no entity id is specified. * lib/entity.c: Fix removal of controls from entities to compare properly. * lib/ipmi_oem_force_conn.c, lib/oem_force_conn.c: Renamed this file to make it more consistent. * lib/Makefile.am: ditto * lib/oem_motorola_mxp.c, lib.oem_motorola_mxp_intf.c: Added support for the Motorola MXP chassis. * include/OpenIPMI/mxp.h: ditto * lib/Makefile.am: ditto * lib/ipmi.c: ditto * ui/basic_ui.c: ditto 2003-07-22 Corey Minyard * configure.in: Moved to version 1.0.1. * utils/test_md5.c, utils/test_md2.c: Make the tests run standalone. * lanserv/Makefile.am: Make dependencies for libraries be in the build directory, not the source directory. This way it will build in a separate object directory. * lib/Makefile.am: ditto * sample/Makefile.am: ditto * ui/Makefile.am: ditto * configure.in: Moved to version 1.0.0. * everything: Restructured the entire tree and split up everyting into subdirectories. Hopefully the code is much better structured now. 2003-07-21 Corey Minyard * ipmi_smi.c: Added socket interface handling for the SMI connection. 2003-07-16 Corey Minyard * OpenIPMI.texi, sensors.c, include/OpenIPMI/ipmiif.h: Added support for just enabling or disabling sensor event (instead of directly setting them), added a bunch of error checking to the enabling and disabling of sensors to make sure the sensor supports the requested capability. * include/OpenIPMI/ipmi_sensor.c: ditto * entity.c: Reworked the presence sensor code to take into account the sensor capabilities. 2003-07-11 Louis Zhuang * ipmi_lan.c, lanserv_asf.c, lanserv_ipmi.c: Cleanups to remove some warnings. 2003-07-03 Corey Minyard * sdr.c: When handling SDR data, be sure to check that the MC is valid in responses, so that this properly handles MCs going away. 2003-06-11 Corey Minyard * configure.in: Move to version 0.4.3 * include/net/af_ipmi.h: Added include file for IPMI socket. * Makefile.am: ditto * configure.in: ditto * include/net/Makefile.am: ditto * lanserv.c: Modified to use IPMI socket if available. 2003-06-07 Corey Minyard * Makefile.am: Clean up so that every '.c' is only listed once. When used in multiple programs, create a '.o' in all but one instance. Still need to figure out how to correctly refer to .a libraries created by a '.la'. * all: License updates. 2003-06-06 Corey Minyard * sel.c: Modified to not use the state to tell if something is going on, but to use the opq. Deletes don't modify the state, but they may still be in process at deletion. * mc.c: Fixed a memory leak. 2003-06-05 Corey Minyard * sel.c: Fixed a SEL destruction race condition. 2003-06-04 Corey Minyard * OpenIPMI.tex, README.Force: Minor updates to make some things clearer. * basic_ui.c: Fixed a problem with SMI connections. * ilist.c, ilist.h: Added some helper functions. * ui_os.c: Switch from /dev/random to /dev/urandom to avoid blocking for lack of entropy. * ui.c: Added a total bytes in SDR count. * sdr.c: Added a pipeline to the SDR fetch, to speed it up for high-latency links. 2003-06-03 Corey Minyard * ipmicmd.c: Added the latency testing code back in. 2003-06-02 Corey Minyard * configure.in: Move to version 0.4.2. * sensor.c: Moved the removal of the sensor from the entity to the place of its final destruction, so the entity will exist during callbacks related to destruction of the sensor. * ipmi_lan.c: Send a close session command when the connection is closed. 2003-05-30 Corey Minyard * OpenIPMI.texi: Updated docs for handling multiple MCs. * domain.c: Add a timer to wait for a while after detecting that everyone is inactive before acting. This should solve race conditions where something deactivates one and activates another, to avoid an activation war between software devices. * domain.c: Reworked some timers so that the handle shutdowns correctly. * ipmi_lan.c: Changed the failure timeout to 3 seconds. * lanserv.c: Send all output to stdout in non-daemon mode. 2003-05-29 Corey Minyard * domain.c: More fixes for supporting multiple connections. * entity.c: Fixed the presence handling to use an entity id instead of an entity pointer since the entity can go away. * ipmi_lan.c: Modified broadcasts to not retry. * ipmi_lan.c: Added timer frees in a few places that needed them. * ipmi_oem_force_conn.c: Changed the broadcast of the deactivate to a normal message so it gets retried. * include/linux/ipmi.h: Added changes for setting the timing parameters. * lanserv.c: Added changes for setting the timing parameters. * sdr.c: Fetch sdr 0 to verify the reservation, not the current record. Also fixed some completion stuff. * sensor.c: Fixed a shutdown case. 2003-05-28 Corey Minyard * sel.c: Fixed a shutdown double-free. * sdr.c: Fixed some shutdown free problems. * mc.c: Fixed some MC shutdown problems. * ilist.c, ilist.h: Set the malloced variable for the supplied entry automatically. * sdr.c: Removed some bogus frees. * mc.c: Set the MC active when it is handled as a new MC. * ipmiif.h: Removed ipmi_domain_get_user_data, since it doesn't make sense any more. * domain.c: Added support for multiple connections to a single IPMB box. * ipmi_oem_force_conn.c: Added handling for active and inactive connections. 2003-05-26 Corey Minyard * lanserv.c: Fixed the address reading code to increment the address count when it sees an address in the configuration file. 2003-05-19 Corey Minyard * mc.c: Modified the event receiver setting code to not modify the event receiver unless it is pointing to a nonexistant MC or an MC that does not have an event receiver. 2003-05-16 Corey Minyard * configure.in: Move to version 0.4.1 * lanserv_oem_force.c, ipmi_oem_force.c: The permission from Force Computers(tm) came much faster than I expected. This included some OEM handling for the various Force cards, for switching the cards to/from BMC mode and for fetching the IPMB address. Thanks to Force for their help. * ipmi.c, lanserv.c, ipmicmd.c: Added calls to initialize the Force OEM code. 2003-05-15 Corey Minyard * lanserv.h: Moved to include/OpenIPMI * lanserv.c: Handled move of lanserv.h * lanserv_asf.c: ditto * lanserv_ipmi.c: ditto * lanserv_emu.c: ditto * configure.in: Move to version 0.4.0 * ipmicmd.c: Changed the order of the lun and netfn to make it consistent with ipmi_ui. * ipmicmd.1: Wrote some docs for ipmicmd. * include/OpenIPMI/ipmi_conn.h: Reworked the connection reporting, changed "fail" to "change" everywhere to make it more accurate, and report all connection changes through the same interface. * domain.c: ditto * ipmi_lan.c: ditto * ipmi_smi.c: ditto * ipmicmd.c: ditto * sample.c: ditto * ui.c: ditto * include/OpenIPMI/ipmi_lan.h: ditto * include/OpenIPMI/ipmi_ui.h: ditto * include/OpenIPMI/ipmiif.h: ditto * include/OpenIPMI/ipmiif.h, domain.c: Modified the domain interface to support more than one connection (although the code still only supports one). 2003-05-14 Corey Minyard * ipmi.c, conn.c: Moved some connection handling stuff into a new file. * include/OpenIPMI/ipmi_int.h: ditto * include/OpenIPMI/ipmi_conn.h: ditto * include/OpenIPMI/ipmi_conn.h: Added a lot of connection handling changes for handling different and dynamic IPMB addresses, and for supporting the concept of a connection being "active". * ipmi.c: ditto * ipmi_lan.c: ditto * ipmicmd.c: ditto * ipmi_smi.c: ditto * domain.c: ditto * ipmi.c: ditto * ipmi.c: ditto * lanserv.h, lanserv.c, lanserv_ipmi.c: Added a lot of OEM handling. * sensor.c: Fixed a missing return. 2003-05-13 Corey Minyard * ipmi.c, ipmi_lan.c, ipmi_smi.c: Added infrastructure so that OEMs can see connections by device id when the connection is first established. * include/OpenIPMI/ipmi_oem.h: ditto * include/OpenIPMI/ipmi_int.h: ditto * ipmicmd.c: Reworked this so it sits on top of an IPMI connection. This means you can make LAN connection now. * ipmi_utils.c: Split out some generic IPMI things that don't depend on anything else. * everything: Added the concept of an IPMI domain, and replaced the "BMC" with the "domain". This was not a huge change from a usage point of view, but was a big restructure internally. This way, we can support multiple BMC connections into a domain. 2003-05-05 Corey Minyard * ui.c: Added connection retrying. 2003-05-04 Corey Minyard * ipmi_lan.c: Got IPMI LAN stuff working again. * ui.c: Updates for the new id handling. 2003-05-02 Corey Minyard * lanserv_emu.c: Added an emulator for testing. * include/OpenIPMI/ipmi_conn.h: Added a way for the interface code to provide the IPMB address. * mc.c, ipmi_lan.c, ipmi_smi.c: ditto * mc.c: Added a valid field to the MC, right now just for BMCs, to handle shutdown races. 2003-05-01 Corey Minyard * include/OpenIPMI/ipmi_types.h: A restructure of the id's was done to remove the MC validation calls from the rest of the code and use the standard MC callbacks. It also added sequence numbers to MCs and MC ids so that if an MC is freed and the same memory is re-allocated, the MC still won't compare with an old id. * include/OpenIPMI/ipmi_mc.h: ditto * include/OpenIPMI/ipmi_sensor.h: ditto * control.c: ditto * entity.c: ditto * sensor.c: ditto * mc.c: ditto * sdr.c: ditto * sel.c: ditto * include/OpenIPMI/ipmi_int.h, ipmi.c: Added a sequence number allocator. 2003-04-30 Corey Minyard * lanserv.c: Modified the server to support two LAN connections specified in the config file, and modified it to always return the message from the file descriptor that received the message. * mc.c: Modified the SEL time code to set the time on the SEL, not get the time, so the SEL time will be correct. 2003-04-29 Corey Minyard * ipmi_lan.c, include/OpenIPMI/ipmi_lan.h: Added multiple IP addresses for a BMC. * include/OpenIPMI/ipmi_conn.h: Started restructuring the connection code so that the user allocates the connection and passed it into the main IPMI code. This decouples the main IPMI code from the connection code, and readies support for having more than one BMC connection into a box. * include/OpenIPMI/ipmi_lan.h: ditto * include/OpenIPMI/ipmi_smi.h: ditto * include/OpenIPMI/ipmi_ui.h: ditto * include/OpenIPMI/ipmiif.h: ditto * mc.c: ditto * ipmi_lan.c: ditto * ipmi_smi.c: ditto * basic_ui.c: ditto * sample.c: ditto * ui.c: ditto * include/OpenIPMI/ipmi_types.h: Moved ipmi_con_t as an opaque type into here, so the user can access it. 2003-04-28 Corey Minyard * lanserv.c, lanserv.h, lanserv_ipmi.c: Added logs for error and notification handling. * lanserv.c, lanserv.h, lanserv_ipmi.c: Added an OEM message handler. 2003-04-27 Corey Minyard * lanserv.c, lanserv.h, lanserv_ipmi.c: Added timeout handling for sessions. 2003-04-26 Corey Minyard * lanserv_ipmi.c: Added incoming session sequence number checking. 2003-04-25 Corey Minyard * lanserv.c, lanserv_ipmi.c, lanserv_asf.c, lanserv.h: Added a LAN to SI interface. * include/OpenIPMI/ipmi_auth.h: Abstracted the memory allocation so the auth routines don't depend on OpenIPMI. * ipmi_lan.c: ditto * ipmi_auth.c: ditto * md2.c, md2.h: ditto * md5.c, md5.h: ditto * ipmi_lan.c: ditto * ipmi_malloc.c, include/OpenIPMI/ipmi_int.h: Made ipmi_mem_alloc take an int size, not a size_t size. 2003-04-24 Corey Minyard * strings.c: Fixed a bug in getting the sensor reading name. * priv_table.c, include/OpenIPMI/ipmi_auth.h: Added a table and handling for figuring out if a message is permitted for a certain priviledge level. * include/OpenIPMI/ipmi_msgbits.h: Added all the message ids from table G-1 from the IPMI 1.5 spec. 2003-04-23 Corey Minyard * ipmi.c, ipmi_auth.c: Created ipmi_auth.c from some stuff in ipmi.c * include/OpenIPMI/ipmi_msgbits.h: Added a bunch of message ids. 2003-04-22 Corey Minyard * ipmicmd.c, include/linux/ipmi.h: Added a debug interface to ipmicmd. * ui.c: Added a way to dump all an mc's information. 2003-04-17 Corey Minyard * ui.c: Fixed a double free on set_control error conditions. * mc.c: Added set functions for all the specific MC capabilities. * configure.in: Move to version 0.3.1. * mc.c: Added a mechanism to ignore IPMB addresses. * configure.in: Move to version 0.3.0b. * ui.c: Ignore control values when an error is reported from reading a control. 2003-04-16 Corey Minyard * configure.in: Move to version 0.3.0. * mc.c: During shutdown, delete entities after sensors and controls because sensors and controls may refer to entities. 2003-04-15 Corey Minyard * ipmi_lan.c: Implemented a max outstanding message count to avoid killing a LAN BMC, and implemented a queue to hold extra messages. 2003-04-15 Duncan Laurie * ipmi_lan.c: Fix a couple of bits when the Send Message variant in lan_send is used. Fix a double-unlock condition that happens with LAN response timeouts. * ipmi_lan.c: add a Set Session Privilege Level command to the end of the session setup sequence. It is required because despite what you use the in the "privilege level" field in Activate Session command it opens in User level. 2003-04-15 Corey Minyard * configure.in: Move to version 0.2.7. * include/OpenIPMI/ipmi_mc.h, OpenIPMI.texi: Change the name of ipmi_bmc_get_startup_SEL_time() to ipmi_mc_get_startup_SEL_time(), in the docs and includes, since it had already changed in the code. 2003-04-14 Corey Minyard * configure.in: Move to version 0.2.6. 2003-04-10 Louis Zhuang , Corey Minyard * include/OpenIPMI/selector.h: Added sel_select() to the include file. * sample.c: Added an example of using sel_select(). * selector.c: Some cleanups. 2003-04-03 Duncan Laurie * ipmi_lan.c: Fixups trying to the the lan code working. 2003-04-01 Corey Minyard * mc.c: Changed the event receiver setting so that it is always done for new MCs, and it is done after the SDRs are read. That way, any pending conditions for a new MC will be generated immediately with a valid sensor to handle it. * mc.c: Modified event handling so that events from the BMC get delivered properly. It was not converting events from the system interface properly. 2003-03-31 Corey Minyard * all: Really release verion 0.2.5. * ui.c: Reset the termios on an error exit, too. * sdr.c: Fixed the SDR fetch to only fetch the exact amount of data left, instead of trying to get as much as possible, when at the end of the SDR. Apparently some hardware doesn't handle this properly. 2003-03-27 Corey Minyard * ipmi_smi.c: Removed the timing of commands, because the low-level driver does it, and it introduced some race conditions. Specifically, if OpenIPMI timed out the command and the memory address got reused before the message came back in, then the message would be delivered to the wrong place. It generally only happened when sitting for a long time in the debugger (so a whole slew of things happened at once). * example_oem.c, Makefile.am, OpenIPMI.texi: Added an example OEM plugin file for others to use to build their plugins. 2003-03-26 Corey Minyard * mc.c: Fixed some problems with non-BMC SELs. * ui.c: Added a log at startup to tell you to wait until startup is complete. * ui.c: Added a quit command. 2003-03-25 Corey Minyard * ui.c: The UI will no longer attempt to read unreadable controls. 2003-03-19 Corey Minyard * sdr.c: Modified the reservation support handling for device SDRs. Start out assuming that it is supported, and if it returns an invalid command then assume it is not supported. There is no clear way to determine if reservation is supported on device SDRs. * sdr.c: Check the proper MC flag if it is a sensor SDR to see if it supports device SDRs. * configure.in: Updated version to 0.2.5. 2003-03-14 Corey Minyard * sensor.c: Yet one more cleanup for compact sensor records, increment the source index properly. * sensor.c: Removed handle_deleted_sensor() and always use ipmi_sensor_destroy() to clean up a sensor. * control.c, include/OpenIPMI/ipmi_control.h: Added a count for the number of controls in a control repository. * sensor.c, include/OpenIPMI/ipmi_sensor.h: Added a count for the number of sensors in a sensor repository. * mc.c, include/OpenIPMI/ipmi_mc.h: Added the concept of an MC being active or inactive. Active MCs are present in the system. Inactive MCs are not present but referenced by SDRs, so they cannot be deleted. 2003-03-13 Jeff Zheng * sample.c: Added a simple sample application. 2003-03-12 Corey Minyard * mc.c: Fixed a cleanup case in the routine that finds or creates an MC. * sensor.c: Minor sensor cleanup additions. * sensor.c: Fixed compact sensor records to copy the data contents instead of the pointer. 2003-03-06 Corey Minyard * configure.in: Move to version 0.2.4. * mc.c: Cleaned up some naming (use bmc when it is a bmc). * ui.c, basic_ui.c: Added a "reconnect" command to disconnect and reconnect to the BMC. * configure.in: Move to version 0.2.3. * mc.c: Added rescanning the entities when a connection comes back. 2003-03-05 Corey Minyard * include/OpenIPMI/ipmiif.h: Fixed the description of the ipmi_bmc_add_con_fail_handler() call to be accurate and complete. * mc.c: Added starting a rescan of the IPMB bus when a connection comes back. 2003-02-27 Corey Minyard * configure.in: Move to version 0.2.2. * entity.c: Cleaned up entity presence detection so it works properly with an entity presence sensor. * sdr.c: Fixed a bug where the SDR fetch would go into an infinite loop if the last SDR was not a sensor. * ui.c: Fixed things so the "-c" option (not full screen) works ok. 2003-02-26 Corey Minyard * include/OpenIPMI/os_handler.h: Added thread functions and moved all the function OpenIPMI does not use to the end. 2003-02-25 Corey Minyard * configure.in: Move to version 0.2.1. 2003-02-25 Todd David * ipmi.c: Added a check for the lock actually being allocated in ipmi_check_lock(). 2003-02-24 Corey Minyard * test1.c, Makefile.am: Removed this bogus file. * sensor.c: Handle the same sensor received multiple times from the same SDR. This actually moves the sdr_sensors source array into the sensor itself so it can be deleted regardless of where it came from. * sdr.c: The Get Device SDR Info command is optional (even if the device has device SDRs, for some strange reason), so default the information if it's not implemented but the device supports device SDRs. * mc.c: Ignore device SDRs if we get an error back from querying them. 2003-02-21 Corey Minyard * configure.in: Moved to version 0.2.0. * include/OpenIPMI/ipmiif.h, include/OpenIPMI/ipmi_sensor.h Added rearm support for sensors. * sensor.c: ditto * ui.c: ditto * include/OpenIPMI/ipmiif.h: The spec was very confusing in section 29.11 and 29.14 (1.5 spec) about the event messages and scanning enable/disable. After studying the spec more, I'm pretty sure that 1 means enabled and 0 means disabled. I think the spec is saying that 0 means disabled in the way it presents this. * include/OpenIPMI/ipmi_int.h: ditto * sensor.c: ditto * entity.c: ditto * ipmi.c: ditto * mc.c: ditto * ui.c: ditto * mc.c: Changed setting the event receiver for an MC to only do it if the event receiver was set incorrectly. * sel.c: Fixed a missing unlock. * sel.c: Modified the way individual record deletes occur and fetches occur to use an opq. This way, reservations won't get mixed up. Also modified individual deletes to check the value of the event before they actually delete it, to make 100% sure they are deleting the right event. * include/linux/ipmi.h, include/linux/ipmi_msgdefs.h: Converted to the new versions of the kernel headers. * include/OpenIPMI/ipmi_addr.h: ditto * include/OpenIPMI/ipmi_types.h: ditto * ipmi_smi.c: ditto * ipmicmd.c, Makefile.am: Added ipmicmd to this code. 2003-02-20 Corey Minyard * ui.c: Fixed a memory leak with controls. * sel.c: Make sure to report that a sel delete completed, even if we can only clear the whole SEL when all are done. * include/OpenIPMI/ipmi_msgbits.h: Added event receiver commands. * mc.c: Fixed a memory leak deleting logs. * ui.c: Added a command to scan an IPMB address. * mc.c: Added code to set the event receiver for MCs to whatever the current event receiver device is. * ipmi.c, include/OpenIPMI/ipmi_addr.h: Added a way to get the slave address for an address. * mc.c: Since the OEM code can change the values from get device id, the comparison code (to tell if an MC has changed) was changed to used a real copy of the values from the get device id, instead of the used values. * Makefile.am, ipmi.c, ipmi_malloc.c: Split off the memory debugging stuff into a separate file. * Makefile.am: Added heap.h to the file. * mc.c, include/OpenIPMI/ipmi_oem.h: Changed the name of the MC removal callback to reflect it's function better (since it's not BMC-related). * entity.c: Fixed a memory leak with presence sensors. 2003-02-19 Corey Minyard * mc.c, include/OpenIPMI/ipmi_conn.h: Modified the ipmi_init_con() call to take the slave address. * ipmi_lan.c, ipmi_smi.c: Now pass in the slave address to ipmi_init_con(). * OpenIPMI.texi: Updated docs for changes. * ui.c: Various cleanups for the SMI address and the new SEL setup. * ilist.c, ilist.h: Added a way to traverse the list backwards. * ipmi_smi.c: Converted the BMC to use an SMI address. * mc.c, include/OpenIPMI/ipmi_mc.h: Added a way for the OEM code to add a way to fetch the SMI slave address. * mc.c, include/OpenIPMI/ipmiif.h, include/OpenIPMI/ipmi_mc.h, sel.c: Changed SEL support to be per-MC (as it should be) and not on the BMC. This will allow support for SELs not on the MC, and for multiple SEL devices in a system. It required the removal of ipmi_bmc_del_event_by_recid(), and a modification to the event structure, since the system now has to know what MC the event came from. * include/OpenIPMI/ipmi_types.h: Added an MC to the event so we know which MC it came from. 2003-02-18 Corey Minyard * ui.c: Added a way to set the event enables. * sdr.c: Made some of the err info logs unique. * mc.c, entity.c: memory leak removals * ilist.c, ilist.h, ipmi.c: Added separate allocation routines for the ilist code. * mc.c, include/OpenIPMI/ipmi_oem.h: Added a shutdown callback to the OEM registeration. * mc.c, include/OpenIPMI/ipmi_mc.h: Added global shutdown code for the mc. * ipmi.c, include/OpenIPMI/ipmiif.h: Added global shutdown code. * ipmi.c, include/OpenIPMI/ipmi_int.h: Added memory debugging code. * basic_ui.c: Converted over to the new memory debugging code. * control.c: ditto * entity.c: ditto * ipmi.c: ditto * ipmi_lan.c: ditto * ipmi_smi.c: ditto * mc.c: ditto * md2.c: ditto * md5.c: ditto * opq.c: ditto * sdr.c: ditto * sel.c: ditto * selector.c: ditto * sensor.c: ditto * ui.c: ditto * ui_command.c: ditto * ui_keypad.c: ditto * ui_os.c: ditto * selector.c, heap.h: Split out the heap code into a generic. * test_btree.c: Added a test for the heap code. 2003-02-13 Corey Minyard * configure.in: Moved to version 0.1.4. 2003-02-12 Corey Minyard * mc.c, sdr.c, sel.c: Changed all 1-bit integers to unsigned so that comparisons work properly. 2003-02-09 Corey Minyard * configure.in: Moved to version 0.1.3. * Makefile.am: Fixed include of "include" dir to be based on srcdir, removed -Werror. * src.c, selector.c, sel.c, ui.c: Fixed some deprecated operations to avoid warnings in gcc3.x. 2003-02-03 Corey Minyard * mc.c, include/OpenIPMI/ipmiif.h, sel.c, include/OpenIPMI/ipmi_sel.h: Modified the previous change to report the number of entries in the SEL, since the number of total entries available in the SEL may not be available. * mc.c, include/OpenIPMI/ipmiif.h, sel.c, include/OpenIPMI/ipmi_sel.h: Added a way to get the estimated number of entries left for new events in the SEL. 2003-01-30 Corey Minyard * configure.in: Move to version 0.1.2. * include/OpenIPMI/ipmi_msgbits.h: Added the master read/write command. 2003-01-29 Corey Minyard * mc.c, include/OpenIPMI/ipmiif.h: Added a mechanism for changing the SEL rescan timers and the bus rescan timers. 2003-01-28 Corey Minyard * ui.c: Fixed problems with the previous va_arg problem. 2003-01-27 Corey Minyard * entity.c: Lots of little cleanup for parent-child relationships and shutdown. * sensor.c: Lots of little cleanups for handling new SDRs. * ui.c: Fixed some problems with threshold display, and added the current value of the threshold (out of range). * ui.c: Fixes some va_arg problems. * sensor.c: Fixed problems with sensor allocation. 2003-01-24 Corey Minyard * ui.c: Changed shutdown code to close the connection first. * mc.c: Modified the close connection code to avoid locking problems. * include/OpenIPMI/ipmiif.h: Changed the format of the close done callback to remove the BMC (since it will be gone). * selector.c, include/OpenIPMI/selector.h: Modified the selector code to be reentrant * ipmi.c, include/OpenIPMI/ipmi_int.h: Added a way to allocate a lock using the global IPMI selector. * basic_ui.c, test1.c: Changed to account for the selector changes. 2003-01-22 Corey Minyard * basic_ui.c, ui.c, include/OpenIPMI/ipmi_ui.h: Start working on a command-line only version of the ui. * ui.c: Rework to abstract the output, getting ready for doing command-line only. * mc.c, include/OpenIPMI/ipmi_mc.h: Added support for setting more device support bits. * ui.c: Added a command to dump the SDRs. * sdr.c: Reworked the fetching of SDRs to get the SDR info first, then to do the reservation if it is required. * sensor.c: Fixed the sensor calculation values to be the right signedness. * mc.c: Modified SEL fetch to restart the timer after the previous SEL fetch completes. 2003-01-21 Corey Minyard * configure.in: Went to version 0.1.1 2003-01-20 Corey Minyard * ui.c: Added a list_sel command. * ui.c: Modified the clear sel command to go through all the events and delete them, instead of clearing the SEL with a command. * sel.c: Fixed the next, previous, first, last, and get all operations to take into account deleted events. Also fixed a bug where re-adding an event that was deleted would cause the count to be wrong. 2003-01-17 Corey Minyard * ui.c, include/OpenIPMI/ipmi_int.h: Added a debug flag to disable LAN connections. 2003-01-16 Corey Minyard * mc.c, include/OpenIPMI/ipmiif.h, include/OpenIPMI/ipmi_conn.h: Added a mechanism to report failures of the lower-level connection, and added code to ignore periodic events (bus scan, SEL scan) while the connection is down. * ipmi_lan.c: ditto * ipmi_smi.c: ditto * OpenIPMI.texi: Documented the changes to the SEL code. * mc.c, include/OpenIPMI/ipmi_oem.h: Added an OEM callback for MC removal. * mc.c: Added detection of when an MC goes away or changes. * mc.c: Cleaned up the MC cleanup code to consolidate it. * entity.c: Modified entity sensor/control deletion so that if all the entities and sensors are gone, and the entity was auto-created, that the entity itself would be destroyed. * sel.c: Reworked the event deletion code so that it works even without the ability to delete individual entries. If all the entries in the local database are deleted, it will clear out the database (if the reservation hasn't been lost). 2003-01-15 Corey Minyard * sel.c: Fixed a locking problem with SEL operations. * mc.c, include/OpenIPMI/ipmi_mc.h: Added a hook for event deletion handling, so OEM code can do its own event deletion. * mc.c, include/OpenIPMI/ipmi_mc.h: Added handling for ignoring events (only sending to the unhandled interface) for events that were already in the SEL at startup. 2003-01-14 Corey Minyard * ui.c: Added a fix for handling local interface BMCs. 2003-01-13 Corey Minyard * configure.in: Move version to 0.1.0. * OpenIPMI.texi: More work on docs. * sel.c, mc.c: Minor cleanups. * ipmi_smi.c: Modified the timeout to be a much larger value. The device drivers have their own timers, we just need to make sure something doesn't go wrong here. 2003-01-09 Corey Minyard * mc.c: Added a periodic rescan of the presence sensors periodically (with the bus scan). * ui.c: Added rescanning of entities when displaying them. * mc.c, include/OpenIPMI/mc.h, entity.c: Added support for handling unhandled (not delivered to the user) events, so the user can delete them if they like. * ui.c: The info wasn't being passed into the id-to-pointer converted for the mccmd command. * OpenIPMI.texi: More work on docs. * control.c: Fixed the calculation size for the non-standard entry array size. 2003-01-09 Corey Minyard * OpenIPMI.texi: More work on docs. * include/OpenIPMI/ipmi_control.h: ditto * include/OpenIPMI/ipmi_sensor.h: ditto * include/OpenIPMI/ipmi_control.h, control.c: Added a missing ipmi_control_send_command_addr() function. * include/OpenIPMI/ipmi_control.h, control.c: Added a cleanup handler for the OEM info. * include/OpenIPMI/ipmi_sensor.h, sensor.c: ditto * entity.c, mc.c: Added an entity-specific lock, and used it where entities were specifically being locked. * ipmi_sensor.c, sensor.c: Made the sensor callbacks const. 2003-01-08 Corey Minyard * OpenIPMI.texi: More work on docs. * include/OpenIPMI/ipmi_int.h, mc.c, ui.c: Added an event debug level. 2003-01-07 Corey Minyard * OpenIPMI.texi: More work on docs. * Makefile.am: Turned on lock checking code generation. * include/OpenIPMI/ipmi_int.h: Cleaned up the debugging flags. * include/OpenIPMI/ipmi_sel.h: Changed the name "log" to "event". * include/OpenIPMI/ipmi_oem.h: ditto * include/OpenIPMI/ipmi_sensor.h: ditto * include/OpenIPMI/ipmi_types.h: ditto * include/OpenIPMI/ipmiif.h: ditto * entity.c: ditto * ipmi.c: ditto * mc.c: ditto * sel.c: ditto * sensor.c: ditto * test1.c: ditto * ui.c: ditto * sel.c: Cleaned up the rather broken locking. * sdr.c, include/OpenIPMI/ipmi_sdr.h: Cleaned up the names and cleaned up the rather broken locking. * control.c: Added IPMI logging information. * sdr.c: ditto * sel.c: ditto * sensor.c: ditto * configure.in: Changed to version 0.0.3. * include/OpenIPMI/log.h: Reworked log handling to add a log type. * include/OpenIPMI/os_handler.h: ditto * ipmi.c: ditto * ipmi_lan.c: ditto * ipmi_smi.c: ditto * mc.c: ditto * sel.c: ditto * ui.c: ditto * ui_os.c: ditto * include/OpenIPMI/log.h, include/OpenIPMI/ipmiif.h: moved log information from ipmiif.h to log.h. 2003-01-06 Corey Minyard * ui.c: Converted the bmc pointer to a bmc id. * ipmi_smi.c: Fixed a double unlock. * ipmi.c, include/OpenIPMI/ipmi_int.h, ui_os.c: Added code for checking for locking errors, fixed locking errors * control.c: ditto * entity.c: ditto * mc.c: ditto * sensor.c: ditto * include/OpenIPMI/os_handler.h: Added callbacks for telling if a lock is held. * entity.c, include/OpenIPMI/ipmiif.h, ui.c: Added IPMI_ in front of some enumeration values. 2003-01-03 Corey Minyard * sensor.c: Modified the way the reporting of the hot-swap sensor is done, so it can support being a single offset in a sensor (like a slot sensor). * include/OpenIPMI/ipmi_sensor.h: ditto * include/OpenIPMI/ipmiif.h: ditto * ipmi_lan.c: Modified the timers to be alloc/free/start/stop, so they can be allocated and reused at will. * ipmi_smi.c: ditto * mc.c: ditto * test1.c: ditto * ui_os.c: ditto * include/OpenIPMI/os_handler.h: ditto 2002-12-18 Corey Minyard * Release of the 0.0.2 version openipmi-2.0.18/FAQ0000644000175000017500000003364710461207110012735 0ustar chuckchuck 1) Questions about the driver 1.1) I'm trying to do a send message command, but it fails. Why can't I do this? You know too much about IPMI :-). OpenIPMI does all this work for you. To send a message out on IPMB, you set up an IPMB address and send the message to that address (without all that nasty send message stuff). It's much easier. Try it, you'll like it. 1.2) I *really* want to do a send message command. How do I do it? Sorry, you can't. It's not that I have it out for you, it has to do with the technical details of IPMI. If you have multiple users of an IPMI system, you have to have a central mechanism to manage information. You have sequence numbers that have to be assigned and managed; if the same applications used the same sequence numbers then chaos would ensue. Since the OpenIPMI driver allows multiple users (and has users both inside and outside the kernel) it can't allow users to directly do send message commands. 2) Questions about the library. 2.1) Why is ipmi_ui so ugly? Well, ipmi_ui is a test program that I wrote for my own purposes. I'll try to clean it up in the future and make it into something useful, and it's certainly ugly, but it's primarily for my testing. In general, it has been replace with the ipmish command, which provides a much more consistent interface to the system. It is much more consistent and is well documented. It is perhaps not quite as nice for interactive use. 2.2) What if I just want to send some IPMI commands. Then "ipmicmd" is the tools for you. It can connect to a system interface or to a LAN connection and let you directly enter commands. 2.3) I'm trying to write a little program that comes up and queries a few things. Can I use the OpenIPMI library to do that? Yes, you can. In the ipmi_open_domain() command, you can turn on and off the things you want, so you can trim down the startup process to speed it up. 2.4) Why can't I just perform an operation and immediately get the results? Why all these callbacks? Read the documenation for details. The OpenHPI interface (http://openhpi.sourceforce.net) is expected to sit on top of the OpenIPMI library and provide an interface more like that. Plus, you can write your own wrappers to do it. It's not possible to write event-driven wrappers on top of a non-event-driven interface. 2.5) Can I have multiple OpenIPMI session from different programs to the same interface? Certainly. I do it all the time :-) The main problem is the System Event Log (SEL). Somebody has to delete items from the SEL. You have a couple of options... If you don't care about the SEL, then set the SEL rescan time to zero with ipmi_domain_set_sel_rescan_time() or disable it with the startup options. This will turn off the SEL completely. If you do care about SELs on multiple programs, you will have to develop a protocol between all the users. You have to have a way to let all the listeners get all the SELs, but still delete items from the SEL in a timely manner. I recommend that you set the SEL rescan time to a value, and for every event receive wait double that value before deleting it. OpenIPMI will correctly handle multiple things deleting items from the SEL. 2.6) Can you open more than one IPMI session from OpenIPMI? Certainly. You can create as many connections and domains as you like, the library has no limitiation. 2.7) I have an xyz computer, does OpenIPMI support it? That depends on a lot of things. Does the box have IPMI? Most systems do not, it's currently mostly on high-end system. If the system does have IPMI, OpenIPMI will probably support it. It may not support the full function of your system though. Output devices are not defined by the IPMI spec, so they are all OEM and require custom code to control them. Sensors that do not appear in an SDR repository will not be supported without custom code. Any things custom to the system will probably not be supported. 2.8) What interfaces does OpenIPMI support? OpenIPMI currently supports system interfaces through the OpenIPMI device driver and LAN interfaces. It does not support serial interfaces or any type of callback devices. 2.9) Does OpenIPMI support ICMB? Not currently, although it shouldn't be hard to add. 2.10) How do I learn more about IPMI? Not much information currently exists. The OpenIPMI web site has a pointer to the specs and the documentation that comes with IPMI, but the spec is very hard to read and the documentation is really more marketing level. The documentation that comes with OpenIPMI provides a more gentle introduction to IPMI (you should certainly read it before you read the spec) but it's more focused on OpenIPMI, not IPMI proper. Someone needs to write a book (and it's not going to be me). 2.11) What does OpenIPMI do? OpenIPMI attempts to handle a lot of the difficult parts of IPMI for the user; as much as it can without making too many policy decisions for the user. For instance, it: * Fetches all the SDRs and translates them into sensors and entity information. * Manages access to the SEL. * Handles the interface, which is especially hard for LAN connections. * Handles fetching FRU information for entities. * Lets you deal directly with sensors and entities. * Periodically scans all the information it manages to see if it has changed. * Decodes incoming events, correlates them with sensors, translates raw values into useful values, and delivers them with the sensor object. * Allows OEM code to plug in to fix up things and present non-standard devices through standard interfaces. Basically, the user just has to start up the connection and wait for things to happen. As OpenIPMI finds things, it will report them and the user can take action. It is designed to remove the low-level details from the user's concern and only present the things the user is really interested in handling. 2.12) I don't like the way OpenIPMI does x. You may disagree with implementation decisions I have made and that's fine. You can make suggestions, submit patches, and work with me on this. Or you may write your own IPMI library. Or you may pillage OpenIPMI to get what you want. Like Linus holds final say on what goes into his distribution of Linux, I hold final say on what goes into my distribution of OpenIPMI. But that doesn't mean you can't do your own work on it. 2.13) Why did you write OpenIPMI? OpenIPMI was originally written to support a customer who needed an interface for their IPMI platform. It was also designed with HPI in mind, for something to implement as the base to an HPI library. 2.14) I just want to use pieces of OpenIPMI, can I? Well, it's open source. But unfortunately, OpenIPMI is not terribly modular as a whole. Certain parts (the interface code, for instance) can be used stand-alone. But SDRs, MC, SELs, domains, sensors, etc. all know about each other. It's somewhat inescapable, really, the concepts are intertwined. It would be fairly easy to take any individual piece of the code (the sdr.c code, for instance) and change it to work in a different system, but you would have to change the code to do that. 2.15) Why is the OpenIPMI interface the way it is (bad, good, ugly, elegent, simple, obtuse, etc)? My basic philosophy of API design is: 1) Users should only have to deal with the objects they really care about. You should distill the interface down to what the user really cares about. Think about it from the user's point of view and implement what they want. 2) Users (especially me) have a hard time dealing with large numbers of types. Distill the types down to the essentials. Don't overload types with information that doesn't belong in them, either. Essentials are essentials; don't go beyond them, though. 3) Interfaces should be designed with extensibility in mind. All types should be opaque pointers so that the internal representation and implementation can change without the binary or logical interface changing. If you make an exception on this, it better be for a really good reason. 4) Use the basic types of the language as much as possible. It's better to have more functions than types. I'm very picky about this. I have seen too many bad APIs; ones based on the implementation, not the needs of the user. 2.16) My IPMI system has some broken information in it. Can I fix it in OpenIPMI? Sure. You can write OEM code that ties in to when objects are added to the system and fix them up as necessary. The details of this are beyond the scope of the FAQ, but you can look in lib/oem_*.c for examples. 2.17) It takes a long time to find all the information about a system on IPMB. What's the deal? Unfortunately, the base library can't really know what exists or where it should exist, so it has to scan everything on the bus. You can write an OEM plugin or scan the addresses you are interested in by hand. If you don't care about the information, as of version 1.4.4 you can skip those steps via options to the ipmi_open_domain() function or the startup parms to ipmish or the Perl interface. 2.18) I want to know when OpenIPMI is done finding everything in the system. Unfortunately, there is no concept of "done" in IPMI. IPMI allows a dynamic environment with elements of the system coming and going. You need to re-think your philosophy here and design software that can dynamically manage elements of the system coming and going. OpenIPMI will tell you when it finds things, and then you can manage them. But bowing to popular demand, though, the 1.4 version of OpenIPMI adds a "done" callback to the ipmi_open_domain function that lets you know when OpenIPMI has finished the first pass of everything (SDRs, SELs, FRUs, IPMB scan). There is no guarantee that it found everything in the first pass, and you should handle dynamically adding things later. 2.19) How do I build the Perl interface? The Perl interface uses swig 1.3.22 or later, which is available from http://www.swig.org. That must be installed and in your path to build the Perl interface. You must also have the development libraries for Perl installed, of course. 2.20) How do I catch SNMP traps with OpenIPMI? Although OpenIPMI has infrastructure to handle traps, it does not catch them for you. You have to provide the software to catch the traps and then you can tell OpenIPMI about them. The ui/basic_ui.c code has some example SNMP trap code using the netsmp and ucsdsnmp libraries. 2.21) Why does it take a long time to get events from OpenIPMI? The standard interface to the event log is polled, and the polling time is 5 seconds by default. You can change the polling time if you don't care about the additional load. A system interface (SMI) does have an immediate event receive capability; when an event comes in it goes into the system log and into a queue. OpenIPMI does nt enable tis by default, you must enable it yourself with a "Set BMC Global Enables Command". LAN interfaces may be capable of sending SNMP traps when an event comes in. This is through the Platform Event Traps and is fairly complicated. OpenIPMI provides a way to configure this more easily, but you still have to know what you are doing. See question 2.20 for how to handle these traps. 2.22) What crypto does OpenIPMI implement/use? OpenIPMI implements MD2 and MD5. It's questionable whether those are crypto algorithms or not, but I'm including them just to be sure. For the IPMI 2.0 RMCP+ algorithms, OpenIPMI requires the OpenSSL package. OpenIPMI will work without OpenSSL, but then it will not be able to use the advanced encryption algorithms. The algorithms used by OpenIPMI are: HMAC-SHA1 (96 bit) and HMAC-MD5 (128 bit) for authentication and integrity. AES-CBC (128 bit) is the only option for encryption. In the future, RC4 (40 bit and 128 bit) may be implemented per the spec. The OpenIPMI authentication/encryption framework is pluggable and users could write their own algorithms if they wish. 2.23) How do I interpret the OpenIPMI numeric error values? Nothing should really be printing these values except for logs and tracing. However, a lot of these come out from sample applications. However, I'll go over a little to make tracing and the like easier. The top 8 bits of an error are the error type (basically where the error came from). The rest of the value is the error itself; make sure to use the proper IPMI_xxx_ERR_VAL() to extract it. The error types are: * 00 - An OS error or an error from OpenIPMI itself. These are standard errno values and can be decoded with strerror() and friends. * 01 - An error from the remote management controller (An IPMI error). You can look these up in the IPMI manual. * 02 - RMCP+ error. These are in the IPMI LAN section of the IPMI manual. * 03 - SoL (Serial Over LAN) errors. These are in the SoL section of the IPMI manual. You can convert any of these errors to a human-readable (currently English only) string using ipmi_err_get_string(). See include/OpenIPMI/ipmi_err.h for more details on these things. openipmi-2.0.18/ltmain.sh0000644000175000017500000060646711312075134014236 0ustar chuckchuck# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # 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: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION="1.5.26 Debian 1.5.26-4+lenny1" TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # 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 <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # 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. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # 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. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done 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 "* | " `$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. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $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. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run 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 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) extracted_serial=`expr $extracted_serial + 1` my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) echo "\ $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP Copyright (C) 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." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.[fF][09]?) xform=[fF][09]. ;; *.for) xform=for ;; *.java) xform=java ;; *.obj) xform=obj ;; *.sx) xform=sx ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -module) module=yes continue ;; # -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* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC # -F/path gives path to uninstalled frameworks, gcc on darwin # @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*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$deplibdir/$depdepl" ; then depdepl="$deplibdir/$depdepl" elif test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" else # Can't find it, oh well... depdepl= fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) case " $deplibs" in *\ -l* | *\ -L*) $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; esac if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows|none) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then major=`expr $current - $age` else major=`expr $current - $age + 1` fi case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then case $archive_cmds in *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; esac else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) case " $deplibs" in *\ -l* | *\ -L*) $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; esac if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= 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 "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` else compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` fi ;; * ) compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 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 our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # 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 relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \$*\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` else relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $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 " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else if test ! -f "$dir/$dlname"; then $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: openipmi-2.0.18/depcomp0000755000175000017500000003710010532451263013755 0ustar chuckchuck#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mecanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: openipmi-2.0.18/ipmi.sysconf0000644000175000017500000000437010327237415014752 0ustar chuckchuck## Path: Hardware/IPMI ## Description: Enable standard hardware interfaces (KCS, BT, SMIC) ## Type: yesno ## Default: "yes" ## Config: ipmi # Enable standard hardware interfaces (KCS, BT, SMIC) # You probably want this enabled. IPMI_SI=yes ## Path: Hardware/IPMI ## Description: Enable /dev/ipmi0 interface, used by ipmitool, ipmicmd, ## Type: yesno ## Default: "yes" ## Config: ipmi # Enable /dev/ipmi0 interface, used by ipmitool, ipmicmd, # and other userspace IPMI-using applications. # You probably want this enabled. DEV_IPMI=yes ## Path: Hardware/IPMI ## Description: Enable IPMI_WATCHDOG if you want the IPMI watchdog ## Type: yesno ## Default: "no" ## Config: ipmi # Enable IPMI_WATCHDOG if you want the IPMI watchdog # to reboot the system if it hangs IPMI_WATCHDOG=no ## Path: Hardware/IPMI ## Description: Watchdog options - modinfo ipmi_watchdog for details ## Type: string ## Default: "timeout=60" ## Config: ipmi # Watchdog options - modinfo ipmi_watchdog for details # watchdog timeout value in seconds # as there is no userspace ping application that runs during shutdown, # be sure to give it enough time for any device drivers to # do their cleanup (e.g. megaraid cache flushes) # without the watchdog triggering prematurely IPMI_WATCHDOG_OPTIONS="timeout=60" ## Path: Hardware/IPMI ## Description: Enable IPMI_POWEROFF if you want the IPMI poweroff module to be loaded. ## Type: yesno ## Default: "no" ## Config: ipmi # Enable IPMI_POWEROFF if you want the IPMI # poweroff module to be loaded. IPMI_POWEROFF=no ## Path: Hardware/IPMI ## Description: Enable IPMI_POWERCYCLE if you want the system to be power-cycled on reboot ## Type: yesno ## Default: "no" ## Config: ipmi # Enable IPMI_POWERCYCLE if you want the system to be power-cycled (power # down, delay briefly, power on) rather than power off, on systems # that support such. IPMI_POWEROFF=yes is also required. IPMI_POWERCYCLE=no ## Path: Hardware/IPMI ## Description: Enable "legacy" interfaces for applications ## Type: yesno ## Default: "no" ## Config: ipmi # Enable "legacy" interfaces for applications # Intel IMB driver interface IPMI_IMB=no openipmi-2.0.18/OpenIPMIposix.pc.in0000644000175000017500000000041610300532522015763 0ustar chuckchuckprefix=@prefix@ exec_prefix=@prefix@ libdir=@libdir@ includedir=@includedir@ Name: OpenIPMIposix Description: POSIX unthreaded OS handler for OpenIPMI Version: @VERSION@ Requires: OpenIPMIutils Libs: -L${libdir} -lOpenIPMIutils -lOpenIPMIposix Cflags: -I${includedir} openipmi-2.0.18/COPYING.BSD0000644000175000017500000000253310415221032014031 0ustar chuckchuckRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. openipmi-2.0.18/TODO0000644000175000017500000000222111313427562013067 0ustar chuckchuckAdd domain statistics to the GUI. Look at integrating ASF info OpenIPMI. Add handling of event data for sensors that have defined event data information specific to that sensor type. Add a way to be notified if children or parents are added to an entity. Add sensor SDRs back into the main SDR repository (if they can from there). Add controls for the GUIDs (system and device) and for the various chassis-related commands. Add the ability to add/remove connections in domains and IP addresses for LAN connections. Firmware firewall configuration xRC4 support Serial port support Various chassis controls (identify, front panel enables, power restore policy, power cycle interval, restart cause) Boot option configuration Implement set channel security keys command Implement a way to get the channel cipher suites for an MC Implement direct serial port interface, including the ability to have disconnected operation. Implement payload control Dynamic address setting for IPMI LAN Settable sensor support (errata E372) Channel forwarding (errata E379) System Info support (errata E381) Suspend BMC ARPs command handling Get IP/UDP/RMCP statistics openipmi-2.0.18/README.MotorolaMXP0000644000175000017500000000136110014707553015441 0ustar chuckchuckThe Motorola MXP chassis is fully supported by OpenIPMI, it handles AMC redundancy properly and has (just about) every sensor and control device available. Thanks to Motorola for all their help getting this working. The MXP cards from Motorola have a standard protocol for controlling things not standardized by IPMI, like the blue light on the card, back end power, and on-card reset. For non-MXP cards, the standard CPCI board select and PCI Reset signals are available. All current MXP boards from Motorola, and any future boards, should be automatically supported by OpenIPMI. Extensive documentation is available in the OpenIPMI manual about what sensors and controls are available on the MXP chassis. See the section labelled "Motorola MXP".openipmi-2.0.18/missing0000755000175000017500000002540610532451262014004 0ustar chuckchuck#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: openipmi-2.0.18/OpenIPMIui.pc.in0000644000175000017500000000042110300532522015232 0ustar chuckchuckprefix=@prefix@ exec_prefix=@prefix@ libdir=@libdir@ includedir=@includedir@ Name: OpenIPMIui Description: UI front-end for OpenIPMI Version: @VERSION@ Requires: OpenIPMI ncurses Libs: -L${libdir} -lOpenIPMIutils -lOpenIPMIui -lOpenIPMI -lncurses Cflags: -I${includedir} openipmi-2.0.18/libedit/0000755000175000017500000000000011367555457014034 5ustar chuckchuckopenipmi-2.0.18/libedit/vi.c0000644000175000017500000005625510373140634014612 0ustar chuckchuck/* $NetBSD: vi.c,v 1.24 2005/08/10 12:46:24 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #include #include #include #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)vi.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: vi.c,v 1.24 2005/08/10 12:46:24 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * vi.c: Vi mode commands. */ #include "el.h" private el_action_t cv_action(EditLine *, int); private el_action_t cv_paste(EditLine *, int); /* cv_action(): * Handle vi actions. */ private el_action_t cv_action(EditLine *el, int c) { if (el->el_chared.c_vcmd.action != NOP) { /* 'cc', 'dd' and (possibly) friends */ if (c != el->el_chared.c_vcmd.action) return CC_ERROR; if (!(c & YANK)) cv_undo(el); cv_yank(el, el->el_line.buffer, el->el_line.lastchar - el->el_line.buffer); el->el_chared.c_vcmd.action = NOP; el->el_chared.c_vcmd.pos = 0; if (!(c & YANK)) { el->el_line.lastchar = el->el_line.buffer; el->el_line.cursor = el->el_line.buffer; } if (c & INSERT) el->el_map.current = el->el_map.key; return (CC_REFRESH); } el->el_chared.c_vcmd.pos = el->el_line.cursor; el->el_chared.c_vcmd.action = c; return (CC_ARGHACK); } /* cv_paste(): * Paste previous deletion before or after the cursor */ private el_action_t cv_paste(EditLine *el, int c) { c_kill_t *k = &el->el_chared.c_kill; int len = k->last - k->buf; if (k->buf == NULL || len == 0) return (CC_ERROR); #ifdef DEBUG_PASTE (void) fprintf(el->el_errfile, "Paste: \"%.*s\"\n", len, k->buf); #endif cv_undo(el); if (!c && el->el_line.cursor < el->el_line.lastchar) el->el_line.cursor++; c_insert(el, len); if (el->el_line.cursor + len > el->el_line.lastchar) return (CC_ERROR); (void) memcpy(el->el_line.cursor, k->buf, len +0u); return (CC_REFRESH); } /* vi_paste_next(): * Vi paste previous deletion to the right of the cursor * [p] */ protected el_action_t /*ARGSUSED*/ vi_paste_next(EditLine *el, int c __attribute__((__unused__))) { return (cv_paste(el, 0)); } /* vi_paste_prev(): * Vi paste previous deletion to the left of the cursor * [P] */ protected el_action_t /*ARGSUSED*/ vi_paste_prev(EditLine *el, int c __attribute__((__unused__))) { return (cv_paste(el, 1)); } /* vi_prev_big_word(): * Vi move to the previous space delimited word * [B] */ protected el_action_t /*ARGSUSED*/ vi_prev_big_word(EditLine *el, int c) { if (el->el_line.cursor == el->el_line.buffer) return (CC_ERROR); el->el_line.cursor = cv_prev_word(el->el_line.cursor, el->el_line.buffer, el->el_state.argument, cv__isWord); if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); } return (CC_CURSOR); } /* vi_prev_word(): * Vi move to the previous word * [b] */ protected el_action_t /*ARGSUSED*/ vi_prev_word(EditLine *el, int c __attribute__((__unused__))) { if (el->el_line.cursor == el->el_line.buffer) return (CC_ERROR); el->el_line.cursor = cv_prev_word(el->el_line.cursor, el->el_line.buffer, el->el_state.argument, cv__isword); if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); } return (CC_CURSOR); } /* vi_next_big_word(): * Vi move to the next space delimited word * [W] */ protected el_action_t /*ARGSUSED*/ vi_next_big_word(EditLine *el, int c) { if (el->el_line.cursor >= el->el_line.lastchar - 1) return (CC_ERROR); el->el_line.cursor = cv_next_word(el, el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, cv__isWord); if (el->el_map.type == MAP_VI) if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); } return (CC_CURSOR); } /* vi_next_word(): * Vi move to the next word * [w] */ protected el_action_t /*ARGSUSED*/ vi_next_word(EditLine *el, int c __attribute__((__unused__))) { if (el->el_line.cursor >= el->el_line.lastchar - 1) return (CC_ERROR); el->el_line.cursor = cv_next_word(el, el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, cv__isword); if (el->el_map.type == MAP_VI) if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); } return (CC_CURSOR); } /* vi_change_case(): * Vi change case of character under the cursor and advance one character * [~] */ protected el_action_t vi_change_case(EditLine *el, int c) { int i; if (el->el_line.cursor >= el->el_line.lastchar) return (CC_ERROR); cv_undo(el); for (i = 0; i < el->el_state.argument; i++) { c = *(unsigned char *)el->el_line.cursor; if (isupper(c)) *el->el_line.cursor = tolower(c); else if (islower(c)) *el->el_line.cursor = toupper(c); if (++el->el_line.cursor >= el->el_line.lastchar) { el->el_line.cursor--; re_fastaddc(el); break; } re_fastaddc(el); } return CC_NORM; } /* vi_change_meta(): * Vi change prefix command * [c] */ protected el_action_t /*ARGSUSED*/ vi_change_meta(EditLine *el, int c __attribute__((__unused__))) { /* * Delete with insert == change: first we delete and then we leave in * insert mode. */ return (cv_action(el, DELETE | INSERT)); } /* vi_insert_at_bol(): * Vi enter insert mode at the beginning of line * [I] */ protected el_action_t /*ARGSUSED*/ vi_insert_at_bol(EditLine *el, int c __attribute__((__unused__))) { el->el_line.cursor = el->el_line.buffer; cv_undo(el); el->el_map.current = el->el_map.key; return (CC_CURSOR); } /* vi_replace_char(): * Vi replace character under the cursor with the next character typed * [r] */ protected el_action_t /*ARGSUSED*/ vi_replace_char(EditLine *el, int c __attribute__((__unused__))) { if (el->el_line.cursor >= el->el_line.lastchar) return CC_ERROR; el->el_map.current = el->el_map.key; el->el_state.inputmode = MODE_REPLACE_1; cv_undo(el); return (CC_ARGHACK); } /* vi_replace_mode(): * Vi enter replace mode * [R] */ protected el_action_t /*ARGSUSED*/ vi_replace_mode(EditLine *el, int c __attribute__((__unused__))) { el->el_map.current = el->el_map.key; el->el_state.inputmode = MODE_REPLACE; cv_undo(el); return (CC_NORM); } /* vi_substitute_char(): * Vi replace character under the cursor and enter insert mode * [s] */ protected el_action_t /*ARGSUSED*/ vi_substitute_char(EditLine *el, int c __attribute__((__unused__))) { c_delafter(el, el->el_state.argument); el->el_map.current = el->el_map.key; return (CC_REFRESH); } /* vi_substitute_line(): * Vi substitute entire line * [S] */ protected el_action_t /*ARGSUSED*/ vi_substitute_line(EditLine *el, int c __attribute__((__unused__))) { cv_undo(el); cv_yank(el, el->el_line.buffer, el->el_line.lastchar - el->el_line.buffer); (void) em_kill_line(el, 0); el->el_map.current = el->el_map.key; return (CC_REFRESH); } /* vi_change_to_eol(): * Vi change to end of line * [C] */ protected el_action_t /*ARGSUSED*/ vi_change_to_eol(EditLine *el, int c __attribute__((__unused__))) { cv_undo(el); cv_yank(el, el->el_line.cursor, el->el_line.lastchar - el->el_line.cursor); (void) ed_kill_line(el, 0); el->el_map.current = el->el_map.key; return (CC_REFRESH); } /* vi_insert(): * Vi enter insert mode * [i] */ protected el_action_t /*ARGSUSED*/ vi_insert(EditLine *el, int c __attribute__((__unused__))) { el->el_map.current = el->el_map.key; cv_undo(el); return (CC_NORM); } /* vi_add(): * Vi enter insert mode after the cursor * [a] */ protected el_action_t /*ARGSUSED*/ vi_add(EditLine *el, int c __attribute__((__unused__))) { int ret; el->el_map.current = el->el_map.key; if (el->el_line.cursor < el->el_line.lastchar) { el->el_line.cursor++; if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; ret = CC_CURSOR; } else ret = CC_NORM; cv_undo(el); return (ret); } /* vi_add_at_eol(): * Vi enter insert mode at end of line * [A] */ protected el_action_t /*ARGSUSED*/ vi_add_at_eol(EditLine *el, int c __attribute__((__unused__))) { el->el_map.current = el->el_map.key; el->el_line.cursor = el->el_line.lastchar; cv_undo(el); return (CC_CURSOR); } /* vi_delete_meta(): * Vi delete prefix command * [d] */ protected el_action_t /*ARGSUSED*/ vi_delete_meta(EditLine *el, int c __attribute__((__unused__))) { return (cv_action(el, DELETE)); } /* vi_end_big_word(): * Vi move to the end of the current space delimited word * [E] */ protected el_action_t /*ARGSUSED*/ vi_end_big_word(EditLine *el, int c) { if (el->el_line.cursor == el->el_line.lastchar) return (CC_ERROR); el->el_line.cursor = cv__endword(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, cv__isWord); if (el->el_chared.c_vcmd.action != NOP) { el->el_line.cursor++; cv_delfini(el); return (CC_REFRESH); } return (CC_CURSOR); } /* vi_end_word(): * Vi move to the end of the current word * [e] */ protected el_action_t /*ARGSUSED*/ vi_end_word(EditLine *el, int c __attribute__((__unused__))) { if (el->el_line.cursor == el->el_line.lastchar) return (CC_ERROR); el->el_line.cursor = cv__endword(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, cv__isword); if (el->el_chared.c_vcmd.action != NOP) { el->el_line.cursor++; cv_delfini(el); return (CC_REFRESH); } return (CC_CURSOR); } /* vi_undo(): * Vi undo last change * [u] */ protected el_action_t /*ARGSUSED*/ vi_undo(EditLine *el, int c __attribute__((__unused__))) { c_undo_t un = el->el_chared.c_undo; if (un.len == -1) return CC_ERROR; /* switch line buffer and undo buffer */ el->el_chared.c_undo.buf = el->el_line.buffer; el->el_chared.c_undo.len = el->el_line.lastchar - el->el_line.buffer; el->el_chared.c_undo.cursor = el->el_line.cursor - el->el_line.buffer; el->el_line.limit = un.buf + (el->el_line.limit - el->el_line.buffer); el->el_line.buffer = un.buf; el->el_line.cursor = un.buf + un.cursor; el->el_line.lastchar = un.buf + un.len; return (CC_REFRESH); } /* vi_command_mode(): * Vi enter command mode (use alternative key bindings) * [] */ protected el_action_t /*ARGSUSED*/ vi_command_mode(EditLine *el, int c __attribute__((__unused__))) { /* [Esc] cancels pending action */ el->el_chared.c_vcmd.action = NOP; el->el_chared.c_vcmd.pos = 0; el->el_state.doingarg = 0; el->el_state.inputmode = MODE_INSERT; el->el_map.current = el->el_map.alt; #ifdef VI_MOVE if (el->el_line.cursor > el->el_line.buffer) el->el_line.cursor--; #endif return (CC_CURSOR); } /* vi_zero(): * Vi move to the beginning of line * [0] */ protected el_action_t vi_zero(EditLine *el, int c) { if (el->el_state.doingarg) return ed_argument_digit(el, c); el->el_line.cursor = el->el_line.buffer; if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); } return (CC_CURSOR); } /* vi_delete_prev_char(): * Vi move to previous character (backspace) * [^H] in insert mode only */ protected el_action_t /*ARGSUSED*/ vi_delete_prev_char(EditLine *el, int c __attribute__((__unused__))) { if (el->el_line.cursor <= el->el_line.buffer) return (CC_ERROR); c_delbefore1(el); el->el_line.cursor--; return (CC_REFRESH); } /* vi_list_or_eof(): * Vi list choices for completion or indicate end of file if empty line * [^D] */ protected el_action_t /*ARGSUSED*/ vi_list_or_eof(EditLine *el, int c __attribute__((__unused__))) { if (el->el_line.cursor == el->el_line.lastchar) { if (el->el_line.cursor == el->el_line.buffer) { term_overwrite(el, STReof, 4); /* then do a EOF */ term__flush(); return (CC_EOF); } else { /* * Here we could list completions, but it is an * error right now */ term_beep(el); return (CC_ERROR); } } else { #ifdef notyet re_goto_bottom(el); *el->el_line.lastchar = '\0'; /* just in case */ return (CC_LIST_CHOICES); #else /* * Just complain for now. */ term_beep(el); return (CC_ERROR); #endif } } /* vi_kill_line_prev(): * Vi cut from beginning of line to cursor * [^U] */ protected el_action_t /*ARGSUSED*/ vi_kill_line_prev(EditLine *el, int c __attribute__((__unused__))) { char *kp, *cp; cp = el->el_line.buffer; kp = el->el_chared.c_kill.buf; while (cp < el->el_line.cursor) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; c_delbefore(el, el->el_line.cursor - el->el_line.buffer); el->el_line.cursor = el->el_line.buffer; /* zap! */ return (CC_REFRESH); } /* vi_search_prev(): * Vi search history previous * [?] */ protected el_action_t /*ARGSUSED*/ vi_search_prev(EditLine *el, int c __attribute__((__unused__))) { return (cv_search(el, ED_SEARCH_PREV_HISTORY)); } /* vi_search_next(): * Vi search history next * [/] */ protected el_action_t /*ARGSUSED*/ vi_search_next(EditLine *el, int c __attribute__((__unused__))) { return (cv_search(el, ED_SEARCH_NEXT_HISTORY)); } /* vi_repeat_search_next(): * Vi repeat current search in the same search direction * [n] */ protected el_action_t /*ARGSUSED*/ vi_repeat_search_next(EditLine *el, int c __attribute__((__unused__))) { if (el->el_search.patlen == 0) return (CC_ERROR); else return (cv_repeat_srch(el, el->el_search.patdir)); } /* vi_repeat_search_prev(): * Vi repeat current search in the opposite search direction * [N] */ /*ARGSUSED*/ protected el_action_t vi_repeat_search_prev(EditLine *el, int c __attribute__((__unused__))) { if (el->el_search.patlen == 0) return (CC_ERROR); else return (cv_repeat_srch(el, el->el_search.patdir == ED_SEARCH_PREV_HISTORY ? ED_SEARCH_NEXT_HISTORY : ED_SEARCH_PREV_HISTORY)); } /* vi_next_char(): * Vi move to the character specified next * [f] */ protected el_action_t /*ARGSUSED*/ vi_next_char(EditLine *el, int c __attribute__((__unused__))) { return cv_csearch(el, CHAR_FWD, -1, el->el_state.argument, 0); } /* vi_prev_char(): * Vi move to the character specified previous * [F] */ protected el_action_t /*ARGSUSED*/ vi_prev_char(EditLine *el, int c __attribute__((__unused__))) { return cv_csearch(el, CHAR_BACK, -1, el->el_state.argument, 0); } /* vi_to_next_char(): * Vi move up to the character specified next * [t] */ protected el_action_t /*ARGSUSED*/ vi_to_next_char(EditLine *el, int c __attribute__((__unused__))) { return cv_csearch(el, CHAR_FWD, -1, el->el_state.argument, 1); } /* vi_to_prev_char(): * Vi move up to the character specified previous * [T] */ protected el_action_t /*ARGSUSED*/ vi_to_prev_char(EditLine *el, int c __attribute__((__unused__))) { return cv_csearch(el, CHAR_BACK, -1, el->el_state.argument, 1); } /* vi_repeat_next_char(): * Vi repeat current character search in the same search direction * [;] */ protected el_action_t /*ARGSUSED*/ vi_repeat_next_char(EditLine *el, int c __attribute__((__unused__))) { return cv_csearch(el, el->el_search.chadir, el->el_search.chacha, el->el_state.argument, el->el_search.chatflg); } /* vi_repeat_prev_char(): * Vi repeat current character search in the opposite search direction * [,] */ protected el_action_t /*ARGSUSED*/ vi_repeat_prev_char(EditLine *el, int c __attribute__((__unused__))) { el_action_t r; int dir = el->el_search.chadir; r = cv_csearch(el, -dir, el->el_search.chacha, el->el_state.argument, el->el_search.chatflg); el->el_search.chadir = dir; return r; } /* vi_match(): * Vi go to matching () {} or [] * [%] */ protected el_action_t /*ARGSUSED*/ vi_match(EditLine *el, int c) { const char match_chars[] = "()[]{}"; char *cp; int delta, i, count; char o_ch, c_ch; *el->el_line.lastchar = '\0'; /* just in case */ i = strcspn(el->el_line.cursor, match_chars); o_ch = el->el_line.cursor[i]; if (o_ch == 0) return CC_ERROR; delta = strchr(match_chars, o_ch) - match_chars; c_ch = match_chars[delta ^ 1]; count = 1; delta = 1 - (delta & 1) * 2; for (cp = &el->el_line.cursor[i]; count; ) { cp += delta; if (cp < el->el_line.buffer || cp >= el->el_line.lastchar) return CC_ERROR; if (*cp == o_ch) count++; else if (*cp == c_ch) count--; } el->el_line.cursor = cp; if (el->el_chared.c_vcmd.action != NOP) { /* NB posix says char under cursor should NOT be deleted for -ve delta - this is different to netbsd vi. */ if (delta > 0) el->el_line.cursor++; cv_delfini(el); return (CC_REFRESH); } return (CC_CURSOR); } /* vi_undo_line(): * Vi undo all changes to line * [U] */ protected el_action_t /*ARGSUSED*/ vi_undo_line(EditLine *el, int c) { cv_undo(el); return hist_get(el); } /* vi_to_column(): * Vi go to specified column * [|] * NB netbsd vi goes to screen column 'n', posix says nth character */ protected el_action_t /*ARGSUSED*/ vi_to_column(EditLine *el, int c) { el->el_line.cursor = el->el_line.buffer; el->el_state.argument--; return ed_next_char(el, 0); } /* vi_yank_end(): * Vi yank to end of line * [Y] */ protected el_action_t /*ARGSUSED*/ vi_yank_end(EditLine *el, int c) { cv_yank(el, el->el_line.cursor, el->el_line.lastchar - el->el_line.cursor); return CC_REFRESH; } /* vi_yank(): * Vi yank * [y] */ protected el_action_t /*ARGSUSED*/ vi_yank(EditLine *el, int c) { return cv_action(el, YANK); } /* vi_comment_out(): * Vi comment out current command * [#] */ protected el_action_t /*ARGSUSED*/ vi_comment_out(EditLine *el, int c) { el->el_line.cursor = el->el_line.buffer; c_insert(el, 1); *el->el_line.cursor = '#'; re_refresh(el); return ed_newline(el, 0); } /* vi_alias(): * Vi include shell alias * [@] * NB: posix implies that we should enter insert mode, however * this is against historical precedent... */ protected el_action_t /*ARGSUSED*/ vi_alias(EditLine *el, int c) { #ifdef __weak_extern char alias_name[3]; char *alias_text; extern char *get_alias_text(const char *); __weak_extern(get_alias_text); if (get_alias_text == 0) { return CC_ERROR; } alias_name[0] = '_'; alias_name[2] = 0; if (el_getc(el, &alias_name[1]) != 1) return CC_ERROR; alias_text = get_alias_text(alias_name); if (alias_text != NULL) el_push(el, alias_text); return CC_NORM; #else return CC_ERROR; #endif } /* vi_to_history_line(): * Vi go to specified history file line. * [G] */ protected el_action_t /*ARGSUSED*/ vi_to_history_line(EditLine *el, int c) { int sv_event_no = el->el_history.eventno; el_action_t rval; if (el->el_history.eventno == 0) { (void) strncpy(el->el_history.buf, el->el_line.buffer, EL_BUFSIZ); el->el_history.last = el->el_history.buf + (el->el_line.lastchar - el->el_line.buffer); } /* Lack of a 'count' means oldest, not 1 */ if (!el->el_state.doingarg) { el->el_history.eventno = 0x7fffffff; hist_get(el); } else { /* This is brain dead, all the rest of this code counts * upwards going into the past. Here we need count in the * other direction (to match the output of fc -l). * I could change the world, but this seems to suffice. */ el->el_history.eventno = 1; if (hist_get(el) == CC_ERROR) return CC_ERROR; el->el_history.eventno = 1 + el->el_history.ev.num - el->el_state.argument; if (el->el_history.eventno < 0) { el->el_history.eventno = sv_event_no; return CC_ERROR; } } rval = hist_get(el); if (rval == CC_ERROR) el->el_history.eventno = sv_event_no; return rval; } /* vi_histedit(): * Vi edit history line with vi * [v] */ protected el_action_t /*ARGSUSED*/ vi_histedit(EditLine *el, int c) { int fd; pid_t pid; int st; char tempfile[] = "/tmp/histedit.XXXXXXXXXX"; char *cp; if (el->el_state.doingarg) { if (vi_to_history_line(el, 0) == CC_ERROR) return CC_ERROR; } fd = mkstemp(tempfile); if (fd < 0) return CC_ERROR; cp = el->el_line.buffer; write(fd, cp, el->el_line.lastchar - cp +0u); write(fd, "\n", 1); pid = fork(); switch (pid) { case -1: close(fd); unlink(tempfile); return CC_ERROR; case 0: close(fd); execlp("vi", "vi", tempfile, NULL); exit(0); /*NOTREACHED*/ default: while (waitpid(pid, &st, 0) != pid) continue; lseek(fd, 0ll, SEEK_SET); st = read(fd, cp, el->el_line.limit - cp +0u); if (st > 0 && cp[st - 1] == '\n') st--; el->el_line.cursor = cp; el->el_line.lastchar = cp + st; break; } close(fd); unlink(tempfile); /* return CC_REFRESH; */ return ed_newline(el, 0); } /* vi_history_word(): * Vi append word from previous input line * [_] * Who knows where this one came from! * '_' in vi means 'entire current line', so 'cc' is a synonym for 'c_' */ protected el_action_t /*ARGSUSED*/ vi_history_word(EditLine *el, int c) { const char *wp = HIST_FIRST(el); const char *wep, *wsp; int len; char *cp; const char *lim; if (wp == NULL) return CC_ERROR; wep = wsp = 0; do { while (isspace((unsigned char)*wp)) wp++; if (*wp == 0) break; wsp = wp; while (*wp && !isspace((unsigned char)*wp)) wp++; wep = wp; } while ((!el->el_state.doingarg || --el->el_state.argument > 0) && *wp != 0); if (wsp == 0 || (el->el_state.doingarg && el->el_state.argument != 0)) return CC_ERROR; cv_undo(el); len = wep - wsp; if (el->el_line.cursor < el->el_line.lastchar) el->el_line.cursor++; c_insert(el, len + 1); cp = el->el_line.cursor; lim = el->el_line.limit; if (cp < lim) *cp++ = ' '; while (wsp < wep && cp < lim) *cp++ = *wsp++; el->el_line.cursor = cp; el->el_map.current = el->el_map.key; return CC_REFRESH; } /* vi_redo(): * Vi redo last non-motion command * [.] */ protected el_action_t /*ARGSUSED*/ vi_redo(EditLine *el, int c) { c_redo_t *r = &el->el_chared.c_redo; if (!el->el_state.doingarg && r->count) { el->el_state.doingarg = 1; el->el_state.argument = r->count; } el->el_chared.c_vcmd.pos = el->el_line.cursor; el->el_chared.c_vcmd.action = r->action; if (r->pos != r->buf) { if (r->pos + 1 > r->lim) /* sanity */ r->pos = r->lim - 1; r->pos[0] = 0; el_push(el, r->buf); } el->el_state.thiscmd = r->cmd; el->el_state.thisch = r->ch; return (*el->el_map.func[r->cmd])(el, r->ch); } openipmi-2.0.18/libedit/el_term.h0000644000175000017500000001175510373140634015624 0ustar chuckchuck/* $NetBSD: term.h,v 1.16 2005/03/15 00:10:40 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)term.h 8.1 (Berkeley) 6/4/93 */ /* * el.term.h: Termcap header */ #ifndef _h_el_term #define _h_el_term #include "histedit.h" typedef struct { /* Symbolic function key bindings */ const char *name; /* name of the key */ int key; /* Index in termcap table */ key_value_t fun; /* Function bound to it */ int type; /* Type of function */ } fkey_t; typedef struct { const char *t_name; /* the terminal name */ coord_t t_size; /* # lines and cols */ int t_flags; #define TERM_CAN_INSERT 0x001 /* Has insert cap */ #define TERM_CAN_DELETE 0x002 /* Has delete cap */ #define TERM_CAN_CEOL 0x004 /* Has CEOL cap */ #define TERM_CAN_TAB 0x008 /* Can use tabs */ #define TERM_CAN_ME 0x010 /* Can turn all attrs. */ #define TERM_CAN_UP 0x020 /* Can move up */ #define TERM_HAS_META 0x040 /* Has a meta key */ #define TERM_HAS_AUTO_MARGINS 0x080 /* Has auto margins */ #define TERM_HAS_MAGIC_MARGINS 0x100 /* Has magic margins */ char *t_buf; /* Termcap buffer */ int t_loc; /* location used */ char **t_str; /* termcap strings */ int *t_val; /* termcap values */ char *t_cap; /* Termcap buffer */ fkey_t *t_fkey; /* Array of keys */ } el_term_t; /* * fKey indexes */ #define A_K_DN 0 #define A_K_UP 1 #define A_K_LT 2 #define A_K_RT 3 #define A_K_HO 4 #define A_K_EN 5 #define A_K_NKEYS 6 #ifdef _SUNOS extern int tgetent(char *, const char *); extern int tgetflag(char *); extern int tgetnum(char *); extern int tputs(const char *, int, int (*)(int)); extern char* tgoto(const char*, int, int); extern char* tgetstr(char*, char**); #endif protected void term_move_to_line(EditLine *, int); protected void term_move_to_char(EditLine *, int); protected void term_clear_EOL(EditLine *, int); protected void term_overwrite(EditLine *, const char *, int); protected void term_insertwrite(EditLine *, char *, int); protected void term_deletechars(EditLine *, int); protected void term_clear_screen(EditLine *); protected void term_beep(EditLine *); protected int term_change_size(EditLine *, int, int); protected int term_get_size(EditLine *, int *, int *); protected int term_init(EditLine *); protected void term_bind_arrow(EditLine *); protected void term_print_arrow(EditLine *, const char *); protected int term_clear_arrow(EditLine *, const char *); protected int term_set_arrow(EditLine *, const char *, key_value_t *, int); protected void term_end(EditLine *); protected void term_get(EditLine *, const char **); protected int term_set(EditLine *, const char *); protected int term_settc(EditLine *, int, const char **); protected int term_telltc(EditLine *, int, const char **); protected int term_echotc(EditLine *, int, const char **); protected int term__putc(int); protected void term__flush(void); /* * Easy access macros */ #define EL_FLAGS (el)->el_term.t_flags #define EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT) #define EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE) #define EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL) #define EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB) #define EL_CAN_ME (EL_FLAGS & TERM_CAN_ME) #define EL_CAN_UP (EL_FLAGS & TERM_CAN_UP) #define EL_HAS_META (EL_FLAGS & TERM_HAS_META) #define EL_HAS_AUTO_MARGINS (EL_FLAGS & TERM_HAS_AUTO_MARGINS) #define EL_HAS_MAGIC_MARGINS (EL_FLAGS & TERM_HAS_MAGIC_MARGINS) #endif /* _h_el_term */ openipmi-2.0.18/libedit/el.c0000644000175000017500000002345710373140634014572 0ustar chuckchuck/* $NetBSD: el.c,v 1.41 2005/08/19 04:21:47 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94"; #else __RCSID("$NetBSD: el.c,v 1.41 2005/08/19 04:21:47 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * el.c: EditLine interface functions */ #include #include #include #include #include #include "el.h" /* el_init(): * Initialize editline and set default parameters. */ public EditLine * el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr) { EditLine *el = (EditLine *) el_malloc(sizeof(EditLine)); if (el == NULL) return (NULL); memset(el, 0, sizeof(EditLine)); el->el_infd = fileno(fin); el->el_outfile = fout; el->el_errfile = ferr; if ((el->el_prog = el_strdup(prog)) == NULL) { el_free(el); return NULL; } /* * Initialize all the modules. Order is important!!! */ el->el_flags = 0; if (term_init(el) == -1) { el_free(el->el_prog); el_free(el); return NULL; } (void) key_init(el); (void) map_init(el); if (tty_init(el) == -1) el->el_flags |= NO_TTY; (void) ch_init(el); (void) search_init(el); (void) hist_init(el); (void) prompt_init(el); (void) sig_init(el); (void) read_init(el); return (el); } /* el_end(): * Clean up. */ public void el_end(EditLine *el) { if (el == NULL) return; el_reset(el); term_end(el); key_end(el); map_end(el); tty_end(el); ch_end(el); search_end(el); hist_end(el); prompt_end(el); sig_end(el); el_free((ptr_t) el->el_prog); el_free((ptr_t) el); } /* el_reset(): * Reset the tty and the parser */ public void el_reset(EditLine *el) { tty_cookedmode(el); ch_reset(el, 0); /* XXX: Do we want that? */ } /* el_set(): * set the editline parameters */ public int el_set(EditLine *el, int op, ...) { va_list va; int rv = 0; if (el == NULL) return (-1); va_start(va, op); switch (op) { case EL_PROMPT: case EL_RPROMPT: rv = prompt_set(el, va_arg(va, el_pfunc_t), op); break; case EL_TERMINAL: rv = term_set(el, va_arg(va, char *)); break; case EL_EDITOR: rv = map_set_editor(el, va_arg(va, char *)); break; case EL_SIGNAL: if (va_arg(va, int)) el->el_flags |= HANDLE_SIGNALS; else el->el_flags &= ~HANDLE_SIGNALS; break; case EL_BIND: case EL_TELLTC: case EL_SETTC: case EL_ECHOTC: case EL_SETTY: { const char *argv[20]; int i; for (i = 1; i < 20; i++) if ((argv[i] = va_arg(va, char *)) == NULL) break; switch (op) { case EL_BIND: argv[0] = "bind"; rv = map_bind(el, i, argv); break; case EL_TELLTC: argv[0] = "telltc"; rv = term_telltc(el, i, argv); break; case EL_SETTC: argv[0] = "settc"; rv = term_settc(el, i, argv); break; case EL_ECHOTC: argv[0] = "echotc"; rv = term_echotc(el, i, argv); break; case EL_SETTY: argv[0] = "setty"; rv = tty_stty(el, i, argv); break; default: rv = -1; EL_ABORT((el->el_errfile, "Bad op %d\n", op)); break; } break; } case EL_ADDFN: { char *name = va_arg(va, char *); char *help = va_arg(va, char *); el_func_t func = va_arg(va, el_func_t); rv = map_addfunc(el, name, help, func); break; } case EL_HIST: { hist_fun_t func = va_arg(va, hist_fun_t); ptr_t ptr = va_arg(va, char *); rv = hist_set(el, func, ptr); break; } case EL_EDITMODE: if (va_arg(va, int)) el->el_flags &= ~EDIT_DISABLED; else el->el_flags |= EDIT_DISABLED; rv = 0; break; case EL_GETCFN: { el_rfunc_t rc = va_arg(va, el_rfunc_t); rv = el_read_setfn(el, rc); break; } case EL_CLIENTDATA: el->el_data = va_arg(va, void *); break; case EL_UNBUFFERED: rv = va_arg(va, int); if (rv && !(el->el_flags & UNBUFFERED)) { el->el_flags |= UNBUFFERED; read_prepare(el); } else if (!rv && (el->el_flags & UNBUFFERED)) { el->el_flags &= ~UNBUFFERED; read_finish(el); } rv = 0; break; case EL_PREP_TERM: rv = va_arg(va, int); if (rv) (void) tty_rawmode(el); else (void) tty_cookedmode(el); rv = 0; break; default: rv = -1; break; } va_end(va); return (rv); } /* el_get(): * retrieve the editline parameters */ public int el_get(EditLine *el, int op, void *ret) { int rv; if (el == NULL || ret == NULL) return (-1); switch (op) { case EL_PROMPT: case EL_RPROMPT: rv = prompt_get(el, (el_pfunc_t *) ret, op); break; case EL_EDITOR: rv = map_get_editor(el, (const char **)ret); break; case EL_SIGNAL: *((int *) ret) = (el->el_flags & HANDLE_SIGNALS); rv = 0; break; case EL_EDITMODE: *((int *) ret) = (!(el->el_flags & EDIT_DISABLED)); rv = 0; break; case EL_TERMINAL: term_get(el, (const char **)ret); rv = 0; break; #if 0 /* XXX */ case EL_BIND: case EL_TELLTC: case EL_SETTC: case EL_ECHOTC: case EL_SETTY: { const char *argv[20]; int i; for (i = 1; i < sizeof(argv) / sizeof(argv[0]); i++) if ((argv[i] = va_arg(va, char *)) == NULL) break; switch (op) { case EL_BIND: argv[0] = "bind"; rv = map_bind(el, i, argv); break; case EL_TELLTC: argv[0] = "telltc"; rv = term_telltc(el, i, argv); break; case EL_SETTC: argv[0] = "settc"; rv = term_settc(el, i, argv); break; case EL_ECHOTC: argv[0] = "echotc"; rv = term_echotc(el, i, argv); break; case EL_SETTY: argv[0] = "setty"; rv = tty_stty(el, i, argv); break; default: rv = -1; EL_ABORT((el->errfile, "Bad op %d\n", op)); break; } break; } case EL_ADDFN: { char *name = va_arg(va, char *); char *help = va_arg(va, char *); el_func_t func = va_arg(va, el_func_t); rv = map_addfunc(el, name, help, func); break; } case EL_HIST: { hist_fun_t func = va_arg(va, hist_fun_t); ptr_t ptr = va_arg(va, char *); rv = hist_set(el, func, ptr); } break; #endif /* XXX */ case EL_GETCFN: *((el_rfunc_t *)ret) = el_read_getfn(el); rv = 0; break; case EL_CLIENTDATA: *((void **)ret) = el->el_data; rv = 0; break; case EL_UNBUFFERED: *((int *) ret) = (!(el->el_flags & UNBUFFERED)); rv = 0; break; default: rv = -1; } return (rv); } /* el_line(): * Return editing info */ public const LineInfo * el_line(EditLine *el) { return (const LineInfo *) (void *) &el->el_line; } /* el_source(): * Source a file */ public int el_source(EditLine *el, const char *fname) { FILE *fp; size_t len; char *ptr; fp = NULL; if (fname == NULL) { static const char elpath[] = "/.editrc"; #ifdef MAXPATHLEN char path[MAXPATHLEN]; #else char path[4096]; #endif #ifdef HAVE_ISSETUGID if (issetugid()) return (-1); #endif if ((ptr = getenv("HOME")) == NULL) return (-1); if (strlcpy(path, ptr, sizeof(path)) >= sizeof(path)) return (-1); if (strlcat(path, elpath, sizeof(path)) >= sizeof(path)) return (-1); fname = path; } if (fp == NULL) fp = fopen(fname, "r"); if (fp == NULL) return (-1); while ((ptr = fgetln(fp, &len)) != NULL) { if (len > 0 && ptr[len - 1] == '\n') --len; ptr[len] = '\0'; if (parse_line(el, ptr) == -1) { (void) fclose(fp); return (-1); } } (void) fclose(fp); return (0); } /* el_resize(): * Called from program when terminal is resized */ public void el_resize(EditLine *el) { int lins, cols; sigset_t oset, nset; (void) sigemptyset(&nset); (void) sigaddset(&nset, SIGWINCH); (void) sigprocmask(SIG_BLOCK, &nset, &oset); /* get the correct window size */ if (term_get_size(el, &lins, &cols)) term_change_size(el, lins, cols); (void) sigprocmask(SIG_SETMASK, &oset, NULL); } /* el_beep(): * Called from the program to beep */ public void el_beep(EditLine *el) { term_beep(el); } /* el_editmode() * Set the state of EDIT_DISABLED from the `edit' command. */ protected int /*ARGSUSED*/ el_editmode(EditLine *el, int argc, const char **argv) { const char *how; if (argv == NULL || argc != 2 || argv[1] == NULL) return (-1); how = argv[1]; if (strcmp(how, "on") == 0) { el->el_flags &= ~EDIT_DISABLED; tty_rawmode(el); } else if (strcmp(how, "off") == 0) { tty_cookedmode(el); el->el_flags |= EDIT_DISABLED; } else { (void) fprintf(el->el_errfile, "edit: Bad value `%s'.\n", how); return (-1); } return (0); } openipmi-2.0.18/libedit/tty.c0000644000175000017500000007566710373140634015024 0ustar chuckchuck/* $NetBSD: tty.c,v 1.23 2005/06/01 11:37:52 lukem Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: tty.c,v 1.23 2005/06/01 11:37:52 lukem Exp $"); #endif #endif /* not lint && not SCCSID */ /* * tty.c: tty interface stuff */ #include #include "tty.h" #include "el.h" typedef struct ttymodes_t { const char *m_name; unsigned int m_value; int m_type; } ttymodes_t; typedef struct ttymap_t { int nch, och; /* Internal and termio rep of chars */ el_action_t bind[3]; /* emacs, vi, and vi-cmd */ } ttymap_t; private const ttyperm_t ttyperm = { { {"iflag:", ICRNL, (INLCR | IGNCR)}, {"oflag:", (OPOST | ONLCR), ONLRET}, {"cflag:", 0, 0}, {"lflag:", (ISIG | ICANON | ECHO | ECHOE | ECHOCTL | IEXTEN), (NOFLSH | ECHONL | EXTPROC | FLUSHO)}, {"chars:", 0, 0}, }, { {"iflag:", (INLCR | ICRNL), IGNCR}, {"oflag:", (OPOST | ONLCR), ONLRET}, {"cflag:", 0, 0}, {"lflag:", ISIG, (NOFLSH | ICANON | ECHO | ECHOK | ECHONL | EXTPROC | IEXTEN | FLUSHO)}, {"chars:", (C_SH(C_MIN) | C_SH(C_TIME) | C_SH(C_SWTCH) | C_SH(C_DSWTCH) | C_SH(C_SUSP) | C_SH(C_DSUSP) | C_SH(C_EOL) | C_SH(C_DISCARD) | C_SH(C_PGOFF) | C_SH(C_PAGE) | C_SH(C_STATUS)), 0} }, { {"iflag:", 0, IXON | IXOFF | INLCR | ICRNL}, {"oflag:", 0, 0}, {"cflag:", 0, 0}, {"lflag:", 0, ISIG | IEXTEN}, {"chars:", 0, 0}, } }; private const ttychar_t ttychar = { { CINTR, CQUIT, CERASE, CKILL, CEOF, CEOL, CEOL2, CSWTCH, CDSWTCH, CERASE2, CSTART, CSTOP, CWERASE, CSUSP, CDSUSP, CREPRINT, CDISCARD, CLNEXT, CSTATUS, CPAGE, CPGOFF, CKILL2, CBRK, CMIN, CTIME }, { CINTR, CQUIT, CERASE, CKILL, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, CERASE2, CSTART, CSTOP, _POSIX_VDISABLE, CSUSP, _POSIX_VDISABLE, _POSIX_VDISABLE, CDISCARD, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, 1, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; private const ttymap_t tty_map[] = { #ifdef VERASE {C_ERASE, VERASE, {EM_DELETE_PREV_CHAR, VI_DELETE_PREV_CHAR, ED_PREV_CHAR}}, #endif /* VERASE */ #ifdef VERASE2 {C_ERASE2, VERASE2, {EM_DELETE_PREV_CHAR, VI_DELETE_PREV_CHAR, ED_PREV_CHAR}}, #endif /* VERASE2 */ #ifdef VKILL {C_KILL, VKILL, {EM_KILL_LINE, VI_KILL_LINE_PREV, ED_UNASSIGNED}}, #endif /* VKILL */ #ifdef VKILL2 {C_KILL2, VKILL2, {EM_KILL_LINE, VI_KILL_LINE_PREV, ED_UNASSIGNED}}, #endif /* VKILL2 */ #ifdef VEOF {C_EOF, VEOF, {EM_DELETE_OR_LIST, VI_LIST_OR_EOF, ED_UNASSIGNED}}, #endif /* VEOF */ #ifdef VWERASE {C_WERASE, VWERASE, {ED_DELETE_PREV_WORD, ED_DELETE_PREV_WORD, ED_PREV_WORD}}, #endif /* VWERASE */ #ifdef VREPRINT {C_REPRINT, VREPRINT, {ED_REDISPLAY, ED_INSERT, ED_REDISPLAY}}, #endif /* VREPRINT */ #ifdef VLNEXT {C_LNEXT, VLNEXT, {ED_QUOTED_INSERT, ED_QUOTED_INSERT, ED_UNASSIGNED}}, #endif /* VLNEXT */ {-1, -1, {ED_UNASSIGNED, ED_UNASSIGNED, ED_UNASSIGNED}} }; private const ttymodes_t ttymodes[] = { #ifdef IGNBRK {"ignbrk", IGNBRK, MD_INP}, #endif /* IGNBRK */ #ifdef BRKINT {"brkint", BRKINT, MD_INP}, #endif /* BRKINT */ #ifdef IGNPAR {"ignpar", IGNPAR, MD_INP}, #endif /* IGNPAR */ #ifdef PARMRK {"parmrk", PARMRK, MD_INP}, #endif /* PARMRK */ #ifdef INPCK {"inpck", INPCK, MD_INP}, #endif /* INPCK */ #ifdef ISTRIP {"istrip", ISTRIP, MD_INP}, #endif /* ISTRIP */ #ifdef INLCR {"inlcr", INLCR, MD_INP}, #endif /* INLCR */ #ifdef IGNCR {"igncr", IGNCR, MD_INP}, #endif /* IGNCR */ #ifdef ICRNL {"icrnl", ICRNL, MD_INP}, #endif /* ICRNL */ #ifdef IUCLC {"iuclc", IUCLC, MD_INP}, #endif /* IUCLC */ #ifdef IXON {"ixon", IXON, MD_INP}, #endif /* IXON */ #ifdef IXANY {"ixany", IXANY, MD_INP}, #endif /* IXANY */ #ifdef IXOFF {"ixoff", IXOFF, MD_INP}, #endif /* IXOFF */ #ifdef IMAXBEL {"imaxbel", IMAXBEL, MD_INP}, #endif /* IMAXBEL */ #ifdef OPOST {"opost", OPOST, MD_OUT}, #endif /* OPOST */ #ifdef OLCUC {"olcuc", OLCUC, MD_OUT}, #endif /* OLCUC */ #ifdef ONLCR {"onlcr", ONLCR, MD_OUT}, #endif /* ONLCR */ #ifdef OCRNL {"ocrnl", OCRNL, MD_OUT}, #endif /* OCRNL */ #ifdef ONOCR {"onocr", ONOCR, MD_OUT}, #endif /* ONOCR */ #ifdef ONOEOT {"onoeot", ONOEOT, MD_OUT}, #endif /* ONOEOT */ #ifdef ONLRET {"onlret", ONLRET, MD_OUT}, #endif /* ONLRET */ #ifdef OFILL {"ofill", OFILL, MD_OUT}, #endif /* OFILL */ #ifdef OFDEL {"ofdel", OFDEL, MD_OUT}, #endif /* OFDEL */ #ifdef NLDLY {"nldly", NLDLY, MD_OUT}, #endif /* NLDLY */ #ifdef CRDLY {"crdly", CRDLY, MD_OUT}, #endif /* CRDLY */ #ifdef TABDLY {"tabdly", TABDLY, MD_OUT}, #endif /* TABDLY */ #ifdef XTABS {"xtabs", XTABS, MD_OUT}, #endif /* XTABS */ #ifdef BSDLY {"bsdly", BSDLY, MD_OUT}, #endif /* BSDLY */ #ifdef VTDLY {"vtdly", VTDLY, MD_OUT}, #endif /* VTDLY */ #ifdef FFDLY {"ffdly", FFDLY, MD_OUT}, #endif /* FFDLY */ #ifdef PAGEOUT {"pageout", PAGEOUT, MD_OUT}, #endif /* PAGEOUT */ #ifdef WRAP {"wrap", WRAP, MD_OUT}, #endif /* WRAP */ #ifdef CIGNORE {"cignore", CIGNORE, MD_CTL}, #endif /* CBAUD */ #ifdef CBAUD {"cbaud", CBAUD, MD_CTL}, #endif /* CBAUD */ #ifdef CSTOPB {"cstopb", CSTOPB, MD_CTL}, #endif /* CSTOPB */ #ifdef CREAD {"cread", CREAD, MD_CTL}, #endif /* CREAD */ #ifdef PARENB {"parenb", PARENB, MD_CTL}, #endif /* PARENB */ #ifdef PARODD {"parodd", PARODD, MD_CTL}, #endif /* PARODD */ #ifdef HUPCL {"hupcl", HUPCL, MD_CTL}, #endif /* HUPCL */ #ifdef CLOCAL {"clocal", CLOCAL, MD_CTL}, #endif /* CLOCAL */ #ifdef LOBLK {"loblk", LOBLK, MD_CTL}, #endif /* LOBLK */ #ifdef CIBAUD {"cibaud", CIBAUD, MD_CTL}, #endif /* CIBAUD */ #ifdef CRTSCTS #ifdef CCTS_OFLOW {"ccts_oflow", CCTS_OFLOW, MD_CTL}, #else {"crtscts", CRTSCTS, MD_CTL}, #endif /* CCTS_OFLOW */ #endif /* CRTSCTS */ #ifdef CRTS_IFLOW {"crts_iflow", CRTS_IFLOW, MD_CTL}, #endif /* CRTS_IFLOW */ #ifdef CDTRCTS {"cdtrcts", CDTRCTS, MD_CTL}, #endif /* CDTRCTS */ #ifdef MDMBUF {"mdmbuf", MDMBUF, MD_CTL}, #endif /* MDMBUF */ #ifdef RCV1EN {"rcv1en", RCV1EN, MD_CTL}, #endif /* RCV1EN */ #ifdef XMT1EN {"xmt1en", XMT1EN, MD_CTL}, #endif /* XMT1EN */ #ifdef ISIG {"isig", ISIG, MD_LIN}, #endif /* ISIG */ #ifdef ICANON {"icanon", ICANON, MD_LIN}, #endif /* ICANON */ #ifdef XCASE {"xcase", XCASE, MD_LIN}, #endif /* XCASE */ #ifdef ECHO {"echo", ECHO, MD_LIN}, #endif /* ECHO */ #ifdef ECHOE {"echoe", ECHOE, MD_LIN}, #endif /* ECHOE */ #ifdef ECHOK {"echok", ECHOK, MD_LIN}, #endif /* ECHOK */ #ifdef ECHONL {"echonl", ECHONL, MD_LIN}, #endif /* ECHONL */ #ifdef NOFLSH {"noflsh", NOFLSH, MD_LIN}, #endif /* NOFLSH */ #ifdef TOSTOP {"tostop", TOSTOP, MD_LIN}, #endif /* TOSTOP */ #ifdef ECHOCTL {"echoctl", ECHOCTL, MD_LIN}, #endif /* ECHOCTL */ #ifdef ECHOPRT {"echoprt", ECHOPRT, MD_LIN}, #endif /* ECHOPRT */ #ifdef ECHOKE {"echoke", ECHOKE, MD_LIN}, #endif /* ECHOKE */ #ifdef DEFECHO {"defecho", DEFECHO, MD_LIN}, #endif /* DEFECHO */ #ifdef FLUSHO {"flusho", FLUSHO, MD_LIN}, #endif /* FLUSHO */ #ifdef PENDIN {"pendin", PENDIN, MD_LIN}, #endif /* PENDIN */ #ifdef IEXTEN {"iexten", IEXTEN, MD_LIN}, #endif /* IEXTEN */ #ifdef NOKERNINFO {"nokerninfo", NOKERNINFO, MD_LIN}, #endif /* NOKERNINFO */ #ifdef ALTWERASE {"altwerase", ALTWERASE, MD_LIN}, #endif /* ALTWERASE */ #ifdef EXTPROC {"extproc", EXTPROC, MD_LIN}, #endif /* EXTPROC */ #if defined(VINTR) {"intr", C_SH(C_INTR), MD_CHAR}, #endif /* VINTR */ #if defined(VQUIT) {"quit", C_SH(C_QUIT), MD_CHAR}, #endif /* VQUIT */ #if defined(VERASE) {"erase", C_SH(C_ERASE), MD_CHAR}, #endif /* VERASE */ #if defined(VKILL) {"kill", C_SH(C_KILL), MD_CHAR}, #endif /* VKILL */ #if defined(VEOF) {"eof", C_SH(C_EOF), MD_CHAR}, #endif /* VEOF */ #if defined(VEOL) {"eol", C_SH(C_EOL), MD_CHAR}, #endif /* VEOL */ #if defined(VEOL2) {"eol2", C_SH(C_EOL2), MD_CHAR}, #endif /* VEOL2 */ #if defined(VSWTCH) {"swtch", C_SH(C_SWTCH), MD_CHAR}, #endif /* VSWTCH */ #if defined(VDSWTCH) {"dswtch", C_SH(C_DSWTCH), MD_CHAR}, #endif /* VDSWTCH */ #if defined(VERASE2) {"erase2", C_SH(C_ERASE2), MD_CHAR}, #endif /* VERASE2 */ #if defined(VSTART) {"start", C_SH(C_START), MD_CHAR}, #endif /* VSTART */ #if defined(VSTOP) {"stop", C_SH(C_STOP), MD_CHAR}, #endif /* VSTOP */ #if defined(VWERASE) {"werase", C_SH(C_WERASE), MD_CHAR}, #endif /* VWERASE */ #if defined(VSUSP) {"susp", C_SH(C_SUSP), MD_CHAR}, #endif /* VSUSP */ #if defined(VDSUSP) {"dsusp", C_SH(C_DSUSP), MD_CHAR}, #endif /* VDSUSP */ #if defined(VREPRINT) {"reprint", C_SH(C_REPRINT), MD_CHAR}, #endif /* VREPRINT */ #if defined(VDISCARD) {"discard", C_SH(C_DISCARD), MD_CHAR}, #endif /* VDISCARD */ #if defined(VLNEXT) {"lnext", C_SH(C_LNEXT), MD_CHAR}, #endif /* VLNEXT */ #if defined(VSTATUS) {"status", C_SH(C_STATUS), MD_CHAR}, #endif /* VSTATUS */ #if defined(VPAGE) {"page", C_SH(C_PAGE), MD_CHAR}, #endif /* VPAGE */ #if defined(VPGOFF) {"pgoff", C_SH(C_PGOFF), MD_CHAR}, #endif /* VPGOFF */ #if defined(VKILL2) {"kill2", C_SH(C_KILL2), MD_CHAR}, #endif /* VKILL2 */ #if defined(VBRK) {"brk", C_SH(C_BRK), MD_CHAR}, #endif /* VBRK */ #if defined(VMIN) {"min", C_SH(C_MIN), MD_CHAR}, #endif /* VMIN */ #if defined(VTIME) {"time", C_SH(C_TIME), MD_CHAR}, #endif /* VTIME */ {NULL, 0, -1}, }; #define tty_getty(el, td) tcgetattr((el)->el_infd, (td)) #define tty_setty(el, td) tcsetattr((el)->el_infd, TCSADRAIN, (td)) #define tty__gettabs(td) ((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1) #define tty__geteightbit(td) (((td)->c_cflag & CSIZE) == CS8) #define tty__cooked_mode(td) ((td)->c_lflag & ICANON) private int tty__getcharindex(int); private void tty__getchar(struct termios *, unsigned char *); private void tty__setchar(struct termios *, unsigned char *); private speed_t tty__getspeed(struct termios *); private int tty_setup(EditLine *); #define t_qu t_ts /* tty_setup(): * Get the tty parameters and initialize the editing state */ private int tty_setup(EditLine *el) { int rst = 1; if (el->el_flags & EDIT_DISABLED) return (0); if (tty_getty(el, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "tty_setup: tty_getty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return (-1); } el->el_tty.t_ts = el->el_tty.t_ex = el->el_tty.t_ed; el->el_tty.t_speed = tty__getspeed(&el->el_tty.t_ex); el->el_tty.t_tabs = tty__gettabs(&el->el_tty.t_ex); el->el_tty.t_eight = tty__geteightbit(&el->el_tty.t_ex); el->el_tty.t_ex.c_iflag &= ~el->el_tty.t_t[EX_IO][MD_INP].t_clrmask; el->el_tty.t_ex.c_iflag |= el->el_tty.t_t[EX_IO][MD_INP].t_setmask; el->el_tty.t_ex.c_oflag &= ~el->el_tty.t_t[EX_IO][MD_OUT].t_clrmask; el->el_tty.t_ex.c_oflag |= el->el_tty.t_t[EX_IO][MD_OUT].t_setmask; el->el_tty.t_ex.c_cflag &= ~el->el_tty.t_t[EX_IO][MD_CTL].t_clrmask; el->el_tty.t_ex.c_cflag |= el->el_tty.t_t[EX_IO][MD_CTL].t_setmask; el->el_tty.t_ex.c_lflag &= ~el->el_tty.t_t[EX_IO][MD_LIN].t_clrmask; el->el_tty.t_ex.c_lflag |= el->el_tty.t_t[EX_IO][MD_LIN].t_setmask; /* * Reset the tty chars to reasonable defaults * If they are disabled, then enable them. */ if (rst) { if (tty__cooked_mode(&el->el_tty.t_ts)) { tty__getchar(&el->el_tty.t_ts, el->el_tty.t_c[TS_IO]); /* * Don't affect CMIN and CTIME for the editor mode */ for (rst = 0; rst < C_NCC - 2; rst++) if (el->el_tty.t_c[TS_IO][rst] != el->el_tty.t_vdisable && el->el_tty.t_c[ED_IO][rst] != el->el_tty.t_vdisable) el->el_tty.t_c[ED_IO][rst] = el->el_tty.t_c[TS_IO][rst]; for (rst = 0; rst < C_NCC; rst++) if (el->el_tty.t_c[TS_IO][rst] != el->el_tty.t_vdisable) el->el_tty.t_c[EX_IO][rst] = el->el_tty.t_c[TS_IO][rst]; } tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]); if (tty_setty(el, &el->el_tty.t_ex) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "tty_setup: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return (-1); } } else tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]); el->el_tty.t_ed.c_iflag &= ~el->el_tty.t_t[ED_IO][MD_INP].t_clrmask; el->el_tty.t_ed.c_iflag |= el->el_tty.t_t[ED_IO][MD_INP].t_setmask; el->el_tty.t_ed.c_oflag &= ~el->el_tty.t_t[ED_IO][MD_OUT].t_clrmask; el->el_tty.t_ed.c_oflag |= el->el_tty.t_t[ED_IO][MD_OUT].t_setmask; el->el_tty.t_ed.c_cflag &= ~el->el_tty.t_t[ED_IO][MD_CTL].t_clrmask; el->el_tty.t_ed.c_cflag |= el->el_tty.t_t[ED_IO][MD_CTL].t_setmask; el->el_tty.t_ed.c_lflag &= ~el->el_tty.t_t[ED_IO][MD_LIN].t_clrmask; el->el_tty.t_ed.c_lflag |= el->el_tty.t_t[ED_IO][MD_LIN].t_setmask; tty__setchar(&el->el_tty.t_ed, el->el_tty.t_c[ED_IO]); tty_bind_char(el, 1); return (0); } protected int tty_init(EditLine *el) { el->el_tty.t_mode = EX_IO; el->el_tty.t_vdisable = _POSIX_VDISABLE; (void) memcpy(el->el_tty.t_t, ttyperm, sizeof(ttyperm_t)); (void) memcpy(el->el_tty.t_c, ttychar, sizeof(ttychar_t)); return (tty_setup(el)); } /* tty_end(): * Restore the tty to its original settings */ protected void /*ARGSUSED*/ tty_end(EditLine *el __attribute__((__unused__))) { /* XXX: Maybe reset to an initial state? */ } /* tty__getspeed(): * Get the tty speed */ private speed_t tty__getspeed(struct termios *td) { speed_t spd; if ((spd = cfgetispeed(td)) == 0) spd = cfgetospeed(td); return (spd); } /* tty__getspeed(): * Return the index of the asked char in the c_cc array */ private int tty__getcharindex(int i) { switch (i) { #ifdef VINTR case C_INTR: return VINTR; #endif /* VINTR */ #ifdef VQUIT case C_QUIT: return VQUIT; #endif /* VQUIT */ #ifdef VERASE case C_ERASE: return VERASE; #endif /* VERASE */ #ifdef VKILL case C_KILL: return VKILL; #endif /* VKILL */ #ifdef VEOF case C_EOF: return VEOF; #endif /* VEOF */ #ifdef VEOL case C_EOL: return VEOL; #endif /* VEOL */ #ifdef VEOL2 case C_EOL2: return VEOL2; #endif /* VEOL2 */ #ifdef VSWTCH case C_SWTCH: return VSWTCH; #endif /* VSWTCH */ #ifdef VDSWTCH case C_DSWTCH: return VDSWTCH; #endif /* VDSWTCH */ #ifdef VERASE2 case C_ERASE2: return VERASE2; #endif /* VERASE2 */ #ifdef VSTART case C_START: return VSTART; #endif /* VSTART */ #ifdef VSTOP case C_STOP: return VSTOP; #endif /* VSTOP */ #ifdef VWERASE case C_WERASE: return VWERASE; #endif /* VWERASE */ #ifdef VSUSP case C_SUSP: return VSUSP; #endif /* VSUSP */ #ifdef VDSUSP case C_DSUSP: return VDSUSP; #endif /* VDSUSP */ #ifdef VREPRINT case C_REPRINT: return VREPRINT; #endif /* VREPRINT */ #ifdef VDISCARD case C_DISCARD: return VDISCARD; #endif /* VDISCARD */ #ifdef VLNEXT case C_LNEXT: return VLNEXT; #endif /* VLNEXT */ #ifdef VSTATUS case C_STATUS: return VSTATUS; #endif /* VSTATUS */ #ifdef VPAGE case C_PAGE: return VPAGE; #endif /* VPAGE */ #ifdef VPGOFF case C_PGOFF: return VPGOFF; #endif /* VPGOFF */ #ifdef VKILL2 case C_KILL2: return VKILL2; #endif /* KILL2 */ #ifdef VMIN case C_MIN: return VMIN; #endif /* VMIN */ #ifdef VTIME case C_TIME: return VTIME; #endif /* VTIME */ default: return -1; } } /* tty__getchar(): * Get the tty characters */ private void tty__getchar(struct termios *td, unsigned char *s) { #ifdef VINTR s[C_INTR] = td->c_cc[VINTR]; #endif /* VINTR */ #ifdef VQUIT s[C_QUIT] = td->c_cc[VQUIT]; #endif /* VQUIT */ #ifdef VERASE s[C_ERASE] = td->c_cc[VERASE]; #endif /* VERASE */ #ifdef VKILL s[C_KILL] = td->c_cc[VKILL]; #endif /* VKILL */ #ifdef VEOF s[C_EOF] = td->c_cc[VEOF]; #endif /* VEOF */ #ifdef VEOL s[C_EOL] = td->c_cc[VEOL]; #endif /* VEOL */ #ifdef VEOL2 s[C_EOL2] = td->c_cc[VEOL2]; #endif /* VEOL2 */ #ifdef VSWTCH s[C_SWTCH] = td->c_cc[VSWTCH]; #endif /* VSWTCH */ #ifdef VDSWTCH s[C_DSWTCH] = td->c_cc[VDSWTCH]; #endif /* VDSWTCH */ #ifdef VERASE2 s[C_ERASE2] = td->c_cc[VERASE2]; #endif /* VERASE2 */ #ifdef VSTART s[C_START] = td->c_cc[VSTART]; #endif /* VSTART */ #ifdef VSTOP s[C_STOP] = td->c_cc[VSTOP]; #endif /* VSTOP */ #ifdef VWERASE s[C_WERASE] = td->c_cc[VWERASE]; #endif /* VWERASE */ #ifdef VSUSP s[C_SUSP] = td->c_cc[VSUSP]; #endif /* VSUSP */ #ifdef VDSUSP s[C_DSUSP] = td->c_cc[VDSUSP]; #endif /* VDSUSP */ #ifdef VREPRINT s[C_REPRINT] = td->c_cc[VREPRINT]; #endif /* VREPRINT */ #ifdef VDISCARD s[C_DISCARD] = td->c_cc[VDISCARD]; #endif /* VDISCARD */ #ifdef VLNEXT s[C_LNEXT] = td->c_cc[VLNEXT]; #endif /* VLNEXT */ #ifdef VSTATUS s[C_STATUS] = td->c_cc[VSTATUS]; #endif /* VSTATUS */ #ifdef VPAGE s[C_PAGE] = td->c_cc[VPAGE]; #endif /* VPAGE */ #ifdef VPGOFF s[C_PGOFF] = td->c_cc[VPGOFF]; #endif /* VPGOFF */ #ifdef VKILL2 s[C_KILL2] = td->c_cc[VKILL2]; #endif /* KILL2 */ #ifdef VMIN s[C_MIN] = td->c_cc[VMIN]; #endif /* VMIN */ #ifdef VTIME s[C_TIME] = td->c_cc[VTIME]; #endif /* VTIME */ } /* tty__getchar */ /* tty__setchar(): * Set the tty characters */ private void tty__setchar(struct termios *td, unsigned char *s) { #ifdef VINTR td->c_cc[VINTR] = s[C_INTR]; #endif /* VINTR */ #ifdef VQUIT td->c_cc[VQUIT] = s[C_QUIT]; #endif /* VQUIT */ #ifdef VERASE td->c_cc[VERASE] = s[C_ERASE]; #endif /* VERASE */ #ifdef VKILL td->c_cc[VKILL] = s[C_KILL]; #endif /* VKILL */ #ifdef VEOF td->c_cc[VEOF] = s[C_EOF]; #endif /* VEOF */ #ifdef VEOL td->c_cc[VEOL] = s[C_EOL]; #endif /* VEOL */ #ifdef VEOL2 td->c_cc[VEOL2] = s[C_EOL2]; #endif /* VEOL2 */ #ifdef VSWTCH td->c_cc[VSWTCH] = s[C_SWTCH]; #endif /* VSWTCH */ #ifdef VDSWTCH td->c_cc[VDSWTCH] = s[C_DSWTCH]; #endif /* VDSWTCH */ #ifdef VERASE2 td->c_cc[VERASE2] = s[C_ERASE2]; #endif /* VERASE2 */ #ifdef VSTART td->c_cc[VSTART] = s[C_START]; #endif /* VSTART */ #ifdef VSTOP td->c_cc[VSTOP] = s[C_STOP]; #endif /* VSTOP */ #ifdef VWERASE td->c_cc[VWERASE] = s[C_WERASE]; #endif /* VWERASE */ #ifdef VSUSP td->c_cc[VSUSP] = s[C_SUSP]; #endif /* VSUSP */ #ifdef VDSUSP td->c_cc[VDSUSP] = s[C_DSUSP]; #endif /* VDSUSP */ #ifdef VREPRINT td->c_cc[VREPRINT] = s[C_REPRINT]; #endif /* VREPRINT */ #ifdef VDISCARD td->c_cc[VDISCARD] = s[C_DISCARD]; #endif /* VDISCARD */ #ifdef VLNEXT td->c_cc[VLNEXT] = s[C_LNEXT]; #endif /* VLNEXT */ #ifdef VSTATUS td->c_cc[VSTATUS] = s[C_STATUS]; #endif /* VSTATUS */ #ifdef VPAGE td->c_cc[VPAGE] = s[C_PAGE]; #endif /* VPAGE */ #ifdef VPGOFF td->c_cc[VPGOFF] = s[C_PGOFF]; #endif /* VPGOFF */ #ifdef VKILL2 td->c_cc[VKILL2] = s[C_KILL2]; #endif /* VKILL2 */ #ifdef VMIN td->c_cc[VMIN] = s[C_MIN]; #endif /* VMIN */ #ifdef VTIME td->c_cc[VTIME] = s[C_TIME]; #endif /* VTIME */ } /* tty__setchar */ /* tty_bind_char(): * Rebind the editline functions */ protected void tty_bind_char(EditLine *el, int force) { unsigned char *t_n = el->el_tty.t_c[ED_IO]; unsigned char *t_o = el->el_tty.t_ed.c_cc; unsigned char new[2], old[2]; const ttymap_t *tp; el_action_t *map, *alt; const el_action_t *dmap, *dalt; new[1] = old[1] = '\0'; map = el->el_map.key; alt = el->el_map.alt; if (el->el_map.type == MAP_VI) { dmap = el->el_map.vii; dalt = el->el_map.vic; } else { dmap = el->el_map.emacs; dalt = NULL; } for (tp = tty_map; tp->nch != -1; tp++) { new[0] = t_n[tp->nch]; old[0] = t_o[tp->och]; if (new[0] == old[0] && !force) continue; /* Put the old default binding back, and set the new binding */ key_clear(el, map, (char *)old); map[old[0]] = dmap[old[0]]; key_clear(el, map, (char *)new); /* MAP_VI == 1, MAP_EMACS == 0... */ map[new[0]] = tp->bind[el->el_map.type]; if (dalt) { key_clear(el, alt, (char *)old); alt[old[0]] = dalt[old[0]]; key_clear(el, alt, (char *)new); alt[new[0]] = tp->bind[el->el_map.type + 1]; } } } /* tty_rawmode(): * Set terminal into 1 character at a time mode. */ protected int tty_rawmode(EditLine *el) { if (el->el_tty.t_mode == ED_IO || el->el_tty.t_mode == QU_IO) return (0); if (el->el_flags & EDIT_DISABLED) return (0); if (tty_getty(el, &el->el_tty.t_ts) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "tty_rawmode: tty_getty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return (-1); } /* * We always keep up with the eight bit setting and the speed of the * tty. But only we only believe changes that are made to cooked mode! */ el->el_tty.t_eight = tty__geteightbit(&el->el_tty.t_ts); el->el_tty.t_speed = tty__getspeed(&el->el_tty.t_ts); if (tty__getspeed(&el->el_tty.t_ex) != el->el_tty.t_speed || tty__getspeed(&el->el_tty.t_ed) != el->el_tty.t_speed) { (void) cfsetispeed(&el->el_tty.t_ex, el->el_tty.t_speed); (void) cfsetospeed(&el->el_tty.t_ex, el->el_tty.t_speed); (void) cfsetispeed(&el->el_tty.t_ed, el->el_tty.t_speed); (void) cfsetospeed(&el->el_tty.t_ed, el->el_tty.t_speed); } if (tty__cooked_mode(&el->el_tty.t_ts)) { if (el->el_tty.t_ts.c_cflag != el->el_tty.t_ex.c_cflag) { el->el_tty.t_ex.c_cflag = el->el_tty.t_ts.c_cflag; el->el_tty.t_ex.c_cflag &= ~el->el_tty.t_t[EX_IO][MD_CTL].t_clrmask; el->el_tty.t_ex.c_cflag |= el->el_tty.t_t[EX_IO][MD_CTL].t_setmask; el->el_tty.t_ed.c_cflag = el->el_tty.t_ts.c_cflag; el->el_tty.t_ed.c_cflag &= ~el->el_tty.t_t[ED_IO][MD_CTL].t_clrmask; el->el_tty.t_ed.c_cflag |= el->el_tty.t_t[ED_IO][MD_CTL].t_setmask; } if ((el->el_tty.t_ts.c_lflag != el->el_tty.t_ex.c_lflag) && (el->el_tty.t_ts.c_lflag != el->el_tty.t_ed.c_lflag)) { el->el_tty.t_ex.c_lflag = el->el_tty.t_ts.c_lflag; el->el_tty.t_ex.c_lflag &= ~el->el_tty.t_t[EX_IO][MD_LIN].t_clrmask; el->el_tty.t_ex.c_lflag |= el->el_tty.t_t[EX_IO][MD_LIN].t_setmask; el->el_tty.t_ed.c_lflag = el->el_tty.t_ts.c_lflag; el->el_tty.t_ed.c_lflag &= ~el->el_tty.t_t[ED_IO][MD_LIN].t_clrmask; el->el_tty.t_ed.c_lflag |= el->el_tty.t_t[ED_IO][MD_LIN].t_setmask; } if ((el->el_tty.t_ts.c_iflag != el->el_tty.t_ex.c_iflag) && (el->el_tty.t_ts.c_iflag != el->el_tty.t_ed.c_iflag)) { el->el_tty.t_ex.c_iflag = el->el_tty.t_ts.c_iflag; el->el_tty.t_ex.c_iflag &= ~el->el_tty.t_t[EX_IO][MD_INP].t_clrmask; el->el_tty.t_ex.c_iflag |= el->el_tty.t_t[EX_IO][MD_INP].t_setmask; el->el_tty.t_ed.c_iflag = el->el_tty.t_ts.c_iflag; el->el_tty.t_ed.c_iflag &= ~el->el_tty.t_t[ED_IO][MD_INP].t_clrmask; el->el_tty.t_ed.c_iflag |= el->el_tty.t_t[ED_IO][MD_INP].t_setmask; } if ((el->el_tty.t_ts.c_oflag != el->el_tty.t_ex.c_oflag) && (el->el_tty.t_ts.c_oflag != el->el_tty.t_ed.c_oflag)) { el->el_tty.t_ex.c_oflag = el->el_tty.t_ts.c_oflag; el->el_tty.t_ex.c_oflag &= ~el->el_tty.t_t[EX_IO][MD_OUT].t_clrmask; el->el_tty.t_ex.c_oflag |= el->el_tty.t_t[EX_IO][MD_OUT].t_setmask; el->el_tty.t_ed.c_oflag = el->el_tty.t_ts.c_oflag; el->el_tty.t_ed.c_oflag &= ~el->el_tty.t_t[ED_IO][MD_OUT].t_clrmask; el->el_tty.t_ed.c_oflag |= el->el_tty.t_t[ED_IO][MD_OUT].t_setmask; } if (tty__gettabs(&el->el_tty.t_ex) == 0) el->el_tty.t_tabs = 0; else el->el_tty.t_tabs = EL_CAN_TAB ? 1 : 0; { int i; tty__getchar(&el->el_tty.t_ts, el->el_tty.t_c[TS_IO]); /* * Check if the user made any changes. * If he did, then propagate the changes to the * edit and execute data structures. */ for (i = 0; i < C_NCC; i++) if (el->el_tty.t_c[TS_IO][i] != el->el_tty.t_c[EX_IO][i]) break; if (i != C_NCC) { /* * Propagate changes only to the unprotected * chars that have been modified just now. */ for (i = 0; i < C_NCC; i++) { if (!((el->el_tty.t_t[ED_IO][MD_CHAR].t_setmask & C_SH(i))) && (el->el_tty.t_c[TS_IO][i] != el->el_tty.t_c[EX_IO][i])) el->el_tty.t_c[ED_IO][i] = el->el_tty.t_c[TS_IO][i]; if (el->el_tty.t_t[ED_IO][MD_CHAR].t_clrmask & C_SH(i)) el->el_tty.t_c[ED_IO][i] = el->el_tty.t_vdisable; } tty_bind_char(el, 0); tty__setchar(&el->el_tty.t_ed, el->el_tty.t_c[ED_IO]); for (i = 0; i < C_NCC; i++) { if (!((el->el_tty.t_t[EX_IO][MD_CHAR].t_setmask & C_SH(i))) && (el->el_tty.t_c[TS_IO][i] != el->el_tty.t_c[EX_IO][i])) el->el_tty.t_c[EX_IO][i] = el->el_tty.t_c[TS_IO][i]; if (el->el_tty.t_t[EX_IO][MD_CHAR].t_clrmask & C_SH(i)) el->el_tty.t_c[EX_IO][i] = el->el_tty.t_vdisable; } tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]); } } } if (tty_setty(el, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "tty_rawmode: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return (-1); } el->el_tty.t_mode = ED_IO; return (0); } /* tty_cookedmode(): * Set the tty back to normal mode */ protected int tty_cookedmode(EditLine *el) { /* set tty in normal setup */ if (el->el_tty.t_mode == EX_IO) return (0); if (el->el_flags & EDIT_DISABLED) return (0); if (tty_setty(el, &el->el_tty.t_ex) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "tty_cookedmode: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return (-1); } el->el_tty.t_mode = EX_IO; return (0); } /* tty_quotemode(): * Turn on quote mode */ protected int tty_quotemode(EditLine *el) { if (el->el_tty.t_mode == QU_IO) return (0); el->el_tty.t_qu = el->el_tty.t_ed; el->el_tty.t_qu.c_iflag &= ~el->el_tty.t_t[QU_IO][MD_INP].t_clrmask; el->el_tty.t_qu.c_iflag |= el->el_tty.t_t[QU_IO][MD_INP].t_setmask; el->el_tty.t_qu.c_oflag &= ~el->el_tty.t_t[QU_IO][MD_OUT].t_clrmask; el->el_tty.t_qu.c_oflag |= el->el_tty.t_t[QU_IO][MD_OUT].t_setmask; el->el_tty.t_qu.c_cflag &= ~el->el_tty.t_t[QU_IO][MD_CTL].t_clrmask; el->el_tty.t_qu.c_cflag |= el->el_tty.t_t[QU_IO][MD_CTL].t_setmask; el->el_tty.t_qu.c_lflag &= ~el->el_tty.t_t[QU_IO][MD_LIN].t_clrmask; el->el_tty.t_qu.c_lflag |= el->el_tty.t_t[QU_IO][MD_LIN].t_setmask; if (tty_setty(el, &el->el_tty.t_qu) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "QuoteModeOn: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return (-1); } el->el_tty.t_mode = QU_IO; return (0); } /* tty_noquotemode(): * Turn off quote mode */ protected int tty_noquotemode(EditLine *el) { if (el->el_tty.t_mode != QU_IO) return (0); if (tty_setty(el, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "QuoteModeOff: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return (-1); } el->el_tty.t_mode = ED_IO; return (0); } /* tty_stty(): * Stty builtin */ protected int /*ARGSUSED*/ tty_stty(EditLine *el, int argc __attribute__((__unused__)), const char **argv) { const ttymodes_t *m; char x; int aflag = 0; const char *s, *d; const char *name; struct termios *tios = &el->el_tty.t_ex; int z = EX_IO; if (argv == NULL) return (-1); name = *argv++; while (argv && *argv && argv[0][0] == '-' && argv[0][2] == '\0') switch (argv[0][1]) { case 'a': aflag++; argv++; break; case 'd': argv++; tios = &el->el_tty.t_ed; z = ED_IO; break; case 'x': argv++; tios = &el->el_tty.t_ex; z = EX_IO; break; case 'q': argv++; tios = &el->el_tty.t_ts; z = QU_IO; break; default: (void) fprintf(el->el_errfile, "%s: Unknown switch `%c'.\n", name, argv[0][1]); return (-1); } if (!argv || !*argv) { int i = -1; int len = 0, st = 0, cu; for (m = ttymodes; m->m_name; m++) { if (m->m_type != i) { (void) fprintf(el->el_outfile, "%s%s", i != -1 ? "\n" : "", el->el_tty.t_t[z][m->m_type].t_name); i = m->m_type; st = len = strlen(el->el_tty.t_t[z][m->m_type].t_name); } x = (el->el_tty.t_t[z][i].t_setmask & m->m_value) ? '+' : '\0'; x = (el->el_tty.t_t[z][i].t_clrmask & m->m_value) ? '-' : x; if (x != '\0' || aflag) { cu = strlen(m->m_name) + (x != '\0') + 1; if (len + cu >= el->el_term.t_size.h) { (void) fprintf(el->el_outfile, "\n%*s", st, ""); len = st + cu; } else len += cu; if (x != '\0') (void) fprintf(el->el_outfile, "%c%s ", x, m->m_name); else (void) fprintf(el->el_outfile, "%s ", m->m_name); } } (void) fprintf(el->el_outfile, "\n"); return (0); } while (argv && (s = *argv++)) { const char *p; switch (*s) { case '+': case '-': x = *s++; break; default: x = '\0'; break; } d = s; p = strchr(s, '='); for (m = ttymodes; m->m_name; m++) if ((p ? strncmp(m->m_name, d, (size_t)(p - d)) : strcmp(m->m_name, d)) == 0 && (p == NULL || m->m_type == MD_CHAR)) break; if (!m->m_name) { (void) fprintf(el->el_errfile, "%s: Invalid argument `%s'.\n", name, d); return (-1); } if (p) { int c = ffs((int)m->m_value); int v = *++p ? parse__escape((const char **) &p) : el->el_tty.t_vdisable; assert(c-- != 0); c = tty__getcharindex(c); assert(c != -1); tios->c_cc[c] = v; continue; } switch (x) { case '+': el->el_tty.t_t[z][m->m_type].t_setmask |= m->m_value; el->el_tty.t_t[z][m->m_type].t_clrmask &= ~m->m_value; break; case '-': el->el_tty.t_t[z][m->m_type].t_setmask &= ~m->m_value; el->el_tty.t_t[z][m->m_type].t_clrmask |= m->m_value; break; default: el->el_tty.t_t[z][m->m_type].t_setmask &= ~m->m_value; el->el_tty.t_t[z][m->m_type].t_clrmask &= ~m->m_value; break; } } return (0); } #ifdef notyet /* tty_printchar(): * DEbugging routine to print the tty characters */ private void tty_printchar(EditLine *el, unsigned char *s) { ttyperm_t *m; int i; for (i = 0; i < C_NCC; i++) { for (m = el->el_tty.t_t; m->m_name; m++) if (m->m_type == MD_CHAR && C_SH(i) == m->m_value) break; if (m->m_name) (void) fprintf(el->el_errfile, "%s ^%c ", m->m_name, s[i] + 'A' - 1); if (i % 5 == 0) (void) fprintf(el->el_errfile, "\n"); } (void) fprintf(el->el_errfile, "\n"); } #endif /* notyet */ openipmi-2.0.18/libedit/vis.c0000644000175000017500000002753610373140634014775 0ustar chuckchuck/* $NetBSD: vis.c,v 1.34 2005/11/18 08:32:46 martin Exp $ */ /*- * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /*- * Copyright (c) 1999, 2005 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* AIX requires this to be the first thing in the file. */ #if defined (_AIX) && !defined (__GNUC__) #pragma alloca #endif #include "sys.h" #ifdef __GNUC__ # undef alloca # define alloca(n) __builtin_alloca (n) #else # ifdef HAVE_ALLOCA_H # include # else # ifndef _AIX extern char *alloca (); # endif # endif #endif #if defined(LIBC_SCCS) && !defined(lint) __RCSID("$NetBSD: vis.c,v 1.34 2005/11/18 08:32:46 martin Exp $"); #endif /* LIBC_SCCS and not lint */ #include #include #include #include #ifdef __weak_alias __weak_alias(strsvis,_strsvis) __weak_alias(strsvisx,_strsvisx) __weak_alias(strvis,_strvis) __weak_alias(strvisx,_strvisx) __weak_alias(svis,_svis) __weak_alias(vis,_vis) #endif #if !HAVE_VIS || !HAVE_SVIS #include #include #include #include #undef BELL #define BELL '\a' #define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7') #define iswhite(c) (c == ' ' || c == '\t' || c == '\n') #define issafe(c) (c == '\b' || c == BELL || c == '\r') #define xtoa(c) "0123456789abcdef"[c] #define MAXEXTRAS 5 #define MAKEEXTRALIST(flag, extra, orig_str) \ do { \ const char *orig = orig_str; \ const char *o = orig; \ char *e; \ while (*o++) \ continue; \ extra = malloc((size_t)((o - orig) + MAXEXTRAS)); \ if (!extra) break; \ for (o = orig, e = extra; (*e++ = *o++) != '\0';) \ continue; \ e--; \ if (flag & VIS_SP) *e++ = ' '; \ if (flag & VIS_TAB) *e++ = '\t'; \ if (flag & VIS_NL) *e++ = '\n'; \ if ((flag & VIS_NOSLASH) == 0) *e++ = '\\'; \ *e = '\0'; \ } while (/*CONSTCOND*/0) /* * This is HVIS, the macro of vis used to HTTP style (RFC 1808) */ #define HVIS(dst, c, flag, nextc, extra) \ do \ if (!isascii(c) || !isalnum(c) || strchr("$-_.+!*'(),", c) != NULL) { \ *dst++ = '%'; \ *dst++ = xtoa(((unsigned int)c >> 4) & 0xf); \ *dst++ = xtoa((unsigned int)c & 0xf); \ } else { \ SVIS(dst, c, flag, nextc, extra); \ } \ while (/*CONSTCOND*/0) /* * This is SVIS, the central macro of vis. * dst: Pointer to the destination buffer * c: Character to encode * flag: Flag word * nextc: The character following 'c' * extra: Pointer to the list of extra characters to be * backslash-protected. */ #define SVIS(dst, c, flag, nextc, extra) \ do { \ int isextra; \ isextra = strchr(extra, c) != NULL; \ if (!isextra && isascii(c) && (isgraph(c) || iswhite(c) || \ ((flag & VIS_SAFE) && issafe(c)))) { \ *dst++ = c; \ break; \ } \ if (flag & VIS_CSTYLE) { \ switch (c) { \ case '\n': \ *dst++ = '\\'; *dst++ = 'n'; \ continue; \ case '\r': \ *dst++ = '\\'; *dst++ = 'r'; \ continue; \ case '\b': \ *dst++ = '\\'; *dst++ = 'b'; \ continue; \ case BELL: \ *dst++ = '\\'; *dst++ = 'a'; \ continue; \ case '\v': \ *dst++ = '\\'; *dst++ = 'v'; \ continue; \ case '\t': \ *dst++ = '\\'; *dst++ = 't'; \ continue; \ case '\f': \ *dst++ = '\\'; *dst++ = 'f'; \ continue; \ case ' ': \ *dst++ = '\\'; *dst++ = 's'; \ continue; \ case '\0': \ *dst++ = '\\'; *dst++ = '0'; \ if (isoctal(nextc)) { \ *dst++ = '0'; \ *dst++ = '0'; \ } \ continue; \ default: \ if (isgraph(c)) { \ *dst++ = '\\'; *dst++ = c; \ continue; \ } \ } \ } \ if (isextra || ((c & 0177) == ' ') || (flag & VIS_OCTAL)) { \ *dst++ = '\\'; \ *dst++ = (u_char)(((u_int32_t)(u_char)c >> 6) & 03) + '0'; \ *dst++ = (u_char)(((u_int32_t)(u_char)c >> 3) & 07) + '0'; \ *dst++ = (c & 07) + '0'; \ } else { \ if ((flag & VIS_NOSLASH) == 0) *dst++ = '\\'; \ if (c & 0200) { \ c &= 0177; *dst++ = 'M'; \ } \ if (iscntrl(c)) { \ *dst++ = '^'; \ if (c == 0177) \ *dst++ = '?'; \ else \ *dst++ = c + '@'; \ } else { \ *dst++ = '-'; *dst++ = c; \ } \ } \ } while (/*CONSTCOND*/0) /* * svis - visually encode characters, also encoding the characters * pointed to by `extra' */ char * svis(char *dst, int c, int flag, int nextc, const char *extra) { char *nextra = NULL; _DIAGASSERT(dst != NULL); _DIAGASSERT(extra != NULL); MAKEEXTRALIST(flag, nextra, extra); if (!nextra) { *dst = '\0'; /* can't create nextra, return "" */ return dst; } if (flag & VIS_HTTPSTYLE) HVIS(dst, c, flag, nextc, nextra); else SVIS(dst, c, flag, nextc, nextra); free(nextra); *dst = '\0'; return dst; } /* * strsvis, strsvisx - visually encode characters from src into dst * * Extra is a pointer to a \0-terminated list of characters to * be encoded, too. These functions are useful e. g. to * encode strings in such a way so that they are not interpreted * by a shell. * * Dst must be 4 times the size of src to account for possible * expansion. The length of dst, not including the trailing NULL, * is returned. * * Strsvisx encodes exactly len bytes from src into dst. * This is useful for encoding a block of data. */ int strsvis(char *dst, const char *csrc, int flag, const char *extra) { int c; char *start; char *nextra = NULL; const unsigned char *src = (const unsigned char *)csrc; _DIAGASSERT(dst != NULL); _DIAGASSERT(src != NULL); _DIAGASSERT(extra != NULL); MAKEEXTRALIST(flag, nextra, extra); if (!nextra) { *dst = '\0'; /* can't create nextra, return "" */ return 0; } if (flag & VIS_HTTPSTYLE) { for (start = dst; (c = *src++) != '\0'; /* empty */) HVIS(dst, c, flag, *src, nextra); } else { for (start = dst; (c = *src++) != '\0'; /* empty */) SVIS(dst, c, flag, *src, nextra); } free(nextra); *dst = '\0'; return (dst - start); } int strsvisx(char *dst, const char *csrc, size_t len, int flag, const char *extra) { unsigned char c; char *start; char *nextra = NULL; const unsigned char *src = (const unsigned char *)csrc; _DIAGASSERT(dst != NULL); _DIAGASSERT(src != NULL); _DIAGASSERT(extra != NULL); MAKEEXTRALIST(flag, nextra, extra); if (! nextra) { *dst = '\0'; /* can't create nextra, return "" */ return 0; } if (flag & VIS_HTTPSTYLE) { for (start = dst; len > 0; len--) { c = *src++; HVIS(dst, c, flag, len ? *src : '\0', nextra); } } else { for (start = dst; len > 0; len--) { c = *src++; SVIS(dst, c, flag, len ? *src : '\0', nextra); } } free(nextra); *dst = '\0'; return (dst - start); } #endif #if !HAVE_VIS /* * vis - visually encode characters */ char * vis(char *dst, int c, int flag, int nextc) { char *extra = NULL; unsigned char uc = (unsigned char)c; _DIAGASSERT(dst != NULL); MAKEEXTRALIST(flag, extra, ""); if (! extra) { *dst = '\0'; /* can't create extra, return "" */ return dst; } if (flag & VIS_HTTPSTYLE) HVIS(dst, uc, flag, nextc, extra); else SVIS(dst, uc, flag, nextc, extra); free(extra); *dst = '\0'; return dst; } /* * strvis, strvisx - visually encode characters from src into dst * * Dst must be 4 times the size of src to account for possible * expansion. The length of dst, not including the trailing NULL, * is returned. * * Strvisx encodes exactly len bytes from src into dst. * This is useful for encoding a block of data. */ int strvis(char *dst, const char *src, int flag) { char *extra = NULL; int rv; MAKEEXTRALIST(flag, extra, ""); if (!extra) { *dst = '\0'; /* can't create extra, return "" */ return 0; } rv = strsvis(dst, src, flag, extra); free(extra); return rv; } int strvisx(char *dst, const char *src, size_t len, int flag) { char *extra = NULL; int rv; MAKEEXTRALIST(flag, extra, ""); if (!extra) { *dst = '\0'; /* can't create extra, return "" */ return 0; } rv = strsvisx(dst, src, len, flag, extra); free(extra); return rv; } #endif openipmi-2.0.18/libedit/vis.h0000644000175000017500000000634310373140634014773 0ustar chuckchuck/* $NetBSD: vis.h,v 1.16 2005/09/13 01:44:32 christos Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)vis.h 8.1 (Berkeley) 6/2/93 */ #ifndef _VIS_H_ #define _VIS_H_ #include /* * to select alternate encoding format */ #define VIS_OCTAL 0x01 /* use octal \ddd format */ #define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropiate */ /* * to alter set of characters encoded (default is to encode all * non-graphic except space, tab, and newline). */ #define VIS_SP 0x04 /* also encode space */ #define VIS_TAB 0x08 /* also encode tab */ #define VIS_NL 0x10 /* also encode newline */ #define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL) #define VIS_SAFE 0x20 /* only encode "unsafe" characters */ /* * other */ #define VIS_NOSLASH 0x40 /* inhibit printing '\' */ #define VIS_HTTPSTYLE 0x80 /* http-style escape % HEX HEX */ /* * unvis return codes */ #define UNVIS_VALID 1 /* character valid */ #define UNVIS_VALIDPUSH 2 /* character valid, push back passed char */ #define UNVIS_NOCHAR 3 /* valid sequence, no character produced */ #define UNVIS_SYNBAD -1 /* unrecognized escape sequence */ #define UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */ /* * unvis flags */ #define UNVIS_END 1 /* no more characters */ __BEGIN_DECLS char *vis(char *, int, int, int); char *svis(char *, int, int, int, const char *); int strvis(char *, const char *, int); int strsvis(char *, const char *, int, const char *); int strvisx(char *, const char *, size_t, int); int strsvisx(char *, const char *, size_t, int, const char *); int strunvis(char *, const char *); int strunvisx(char *, const char *, int); #ifndef __LIBC12_SOURCE__ int unvis(char *, int, int *, int); #endif __END_DECLS #endif /* !_VIS_H_ */ openipmi-2.0.18/libedit/prompt.h0000644000175000017500000000451610373140634015513 0ustar chuckchuck/* $NetBSD: prompt.h,v 1.6 2003/08/07 16:44:32 agc Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)prompt.h 8.1 (Berkeley) 6/4/93 */ /* * el.prompt.h: Prompt printing stuff */ #ifndef _h_el_prompt #define _h_el_prompt #include "histedit.h" typedef char * (*el_pfunc_t)(EditLine*); typedef struct el_prompt_t { el_pfunc_t p_func; /* Function to return the prompt */ coord_t p_pos; /* position in the line after prompt */ } el_prompt_t; protected void prompt_print(EditLine *, int); protected int prompt_set(EditLine *, el_pfunc_t, int); protected int prompt_get(EditLine *, el_pfunc_t *, int); protected int prompt_init(EditLine *); protected void prompt_end(EditLine *); #endif /* _h_el_prompt */ openipmi-2.0.18/libedit/parse.c0000644000175000017500000001265310373140634015300 0ustar chuckchuck/* $NetBSD: parse.c,v 1.22 2005/05/29 04:58:15 lukem Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: parse.c,v 1.22 2005/05/29 04:58:15 lukem Exp $"); #endif #endif /* not lint && not SCCSID */ /* * parse.c: parse an editline extended command * * commands are: * * bind * echotc * edit * gettc * history * settc * setty */ #include "el.h" #include private const struct { const char *name; int (*func)(EditLine *, int, const char **); } cmds[] = { { "bind", map_bind }, { "echotc", term_echotc }, { "edit", el_editmode }, { "history", hist_command }, { "telltc", term_telltc }, { "settc", term_settc }, { "setty", tty_stty }, { NULL, NULL } }; /* parse_line(): * Parse a line and dispatch it */ protected int parse_line(EditLine *el, const char *line) { const char **argv; int argc; Tokenizer *tok; tok = tok_init(NULL); tok_str(tok, line, &argc, &argv); argc = el_parse(el, argc, argv); tok_end(tok); return (argc); } /* el_parse(): * Command dispatcher */ public int el_parse(EditLine *el, int argc, const char *argv[]) { const char *ptr; int i; if (argc < 1) return (-1); ptr = strchr(argv[0], ':'); if (ptr != NULL) { char *tprog; size_t l; if (ptr == argv[0]) return (0); l = ptr - argv[0] - 1; tprog = (char *) el_malloc(l + 1); if (tprog == NULL) return (0); (void) strncpy(tprog, argv[0], l); tprog[l] = '\0'; ptr++; l = el_match(el->el_prog, tprog); el_free(tprog); if (!l) return (0); } else ptr = argv[0]; for (i = 0; cmds[i].name != NULL; i++) if (strcmp(cmds[i].name, ptr) == 0) { i = (*cmds[i].func) (el, argc, argv); return (-i); } return (-1); } /* parse__escape(): * Parse a string of the form ^ \ \ and return * the appropriate character or -1 if the escape is not valid */ protected int parse__escape(const char **ptr) { const char *p; int c; p = *ptr; if (p[1] == 0) return (-1); if (*p == '\\') { p++; switch (*p) { case 'a': c = '\007'; /* Bell */ break; case 'b': c = '\010'; /* Backspace */ break; case 't': c = '\011'; /* Horizontal Tab */ break; case 'n': c = '\012'; /* New Line */ break; case 'v': c = '\013'; /* Vertical Tab */ break; case 'f': c = '\014'; /* Form Feed */ break; case 'r': c = '\015'; /* Carriage Return */ break; case 'e': c = '\033'; /* Escape */ break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': { int cnt, ch; for (cnt = 0, c = 0; cnt < 3; cnt++) { ch = *p++; if (ch < '0' || ch > '7') { p--; break; } c = (c << 3) | (ch - '0'); } if ((c & 0xffffff00) != 0) return (-1); --p; break; } default: c = *p; break; } } else if (*p == '^') { p++; c = (*p == '?') ? '\177' : (*p & 0237); } else c = *p; *ptr = ++p; return (c); } /* parse__string(): * Parse the escapes from in and put the raw string out */ protected char * parse__string(char *out, const char *in) { char *rv = out; int n; for (;;) switch (*in) { case '\0': *out = '\0'; return (rv); case '\\': case '^': if ((n = parse__escape(&in)) == -1) return (NULL); *out++ = n; break; case 'M': if (in[1] == '-' && in[2] != '\0') { *out++ = '\033'; in += 2; break; } /*FALLTHROUGH*/ default: *out++ = *in++; break; } } /* parse_cmd(): * Return the command number for the command string given * or -1 if one is not found */ protected int parse_cmd(EditLine *el, const char *cmd) { el_bindings_t *b; for (b = el->el_map.help; b->name != NULL; b++) if (strcmp(b->name, cmd) == 0) return (b->func); return (-1); } openipmi-2.0.18/libedit/refresh.c0000644000175000017500000007370710373140634015633 0ustar chuckchuck/* $NetBSD: refresh.c,v 1.27 2005/11/09 22:11:10 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: refresh.c,v 1.27 2005/11/09 22:11:10 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * refresh.c: Lower level screen refreshing functions */ #include #include #include #include #include "el.h" private void re_addc(EditLine *, int); private void re_update_line(EditLine *, char *, char *, int); private void re_insert (EditLine *, char *, int, int, char *, int); private void re_delete(EditLine *, char *, int, int, int); private void re_fastputc(EditLine *, int); private void re_clear_eol(EditLine *, int, int, int); private void re__strncopy(char *, char *, size_t); private void re__copy_and_pad(char *, const char *, size_t); #ifdef DEBUG_REFRESH private void re_printstr(EditLine *, const char *, char *, char *); #define __F el->el_errfile #define ELRE_ASSERT(a, b, c) do \ if (/*CONSTCOND*/ a) { \ (void) fprintf b; \ c; \ } \ while (/*CONSTCOND*/0) #define ELRE_DEBUG(a, b) ELRE_ASSERT(a,b,;) /* re_printstr(): * Print a string on the debugging pty */ private void re_printstr(EditLine *el, const char *str, char *f, char *t) { ELRE_DEBUG(1, (__F, "%s:\"", str)); while (f < t) ELRE_DEBUG(1, (__F, "%c", *f++ & 0177)); ELRE_DEBUG(1, (__F, "\"\r\n")); } #else #define ELRE_ASSERT(a, b, c) #define ELRE_DEBUG(a, b) #endif /* re_addc(): * Draw c, expanding tabs, control chars etc. */ private void re_addc(EditLine *el, int c) { if (isprint(c)) { re_putc(el, c, 1); return; } if (c == '\n') { /* expand the newline */ int oldv = el->el_refresh.r_cursor.v; re_putc(el, '\0', 0); /* assure end of line */ if (oldv == el->el_refresh.r_cursor.v) { /* XXX */ el->el_refresh.r_cursor.h = 0; /* reset cursor pos */ el->el_refresh.r_cursor.v++; } return; } if (c == '\t') { /* expand the tab */ for (;;) { re_putc(el, ' ', 1); if ((el->el_refresh.r_cursor.h & 07) == 0) break; /* go until tab stop */ } } else if (iscntrl(c)) { re_putc(el, '^', 1); if (c == '\177') re_putc(el, '?', 1); else /* uncontrolify it; works only for iso8859-1 like sets */ re_putc(el, (c | 0100), 1); } else { re_putc(el, '\\', 1); re_putc(el, (int) ((((unsigned int) c >> 6) & 07) + '0'), 1); re_putc(el, (int) ((((unsigned int) c >> 3) & 07) + '0'), 1); re_putc(el, (c & 07) + '0', 1); } } /* re_putc(): * Draw the character given */ protected void re_putc(EditLine *el, int c, int shift) { ELRE_DEBUG(1, (__F, "printing %3.3o '%c'\r\n", c, c)); el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_refresh.r_cursor.h] = c; if (!shift) return; el->el_refresh.r_cursor.h++; /* advance to next place */ if (el->el_refresh.r_cursor.h >= el->el_term.t_size.h) { el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_term.t_size.h] = '\0'; /* assure end of line */ el->el_refresh.r_cursor.h = 0; /* reset it. */ /* * If we would overflow (input is longer than terminal size), * emulate scroll by dropping first line and shuffling the rest. * We do this via pointer shuffling - it's safe in this case * and we avoid memcpy(). */ if (el->el_refresh.r_cursor.v + 1 >= el->el_term.t_size.v) { int i, lins = el->el_term.t_size.v; char *firstline = el->el_vdisplay[0]; for(i=1; i < lins; i++) el->el_vdisplay[i-1] = el->el_vdisplay[i]; firstline[0] = '\0'; /* empty the string */ el->el_vdisplay[i-1] = firstline; } else el->el_refresh.r_cursor.v++; ELRE_ASSERT(el->el_refresh.r_cursor.v >= el->el_term.t_size.v, (__F, "\r\nre_putc: overflow! r_cursor.v == %d > %d\r\n", el->el_refresh.r_cursor.v, el->el_term.t_size.v), abort()); } } /* re_refresh(): * draws the new virtual screen image from the current input * line, then goes line-by-line changing the real image to the new * virtual image. The routine to re-draw a line can be replaced * easily in hopes of a smarter one being placed there. */ protected void re_refresh(EditLine *el) { int i, rhdiff; char *cp, *st; coord_t cur; #ifdef notyet size_t termsz; #endif ELRE_DEBUG(1, (__F, "el->el_line.buffer = :%s:\r\n", el->el_line.buffer)); /* reset the Drawing cursor */ el->el_refresh.r_cursor.h = 0; el->el_refresh.r_cursor.v = 0; /* temporarily draw rprompt to calculate its size */ prompt_print(el, EL_RPROMPT); /* reset the Drawing cursor */ el->el_refresh.r_cursor.h = 0; el->el_refresh.r_cursor.v = 0; if (el->el_line.cursor >= el->el_line.lastchar) { if (el->el_map.current == el->el_map.alt && el->el_line.lastchar != el->el_line.buffer) el->el_line.cursor = el->el_line.lastchar - 1; else el->el_line.cursor = el->el_line.lastchar; } cur.h = -1; /* set flag in case I'm not set */ cur.v = 0; prompt_print(el, EL_PROMPT); /* draw the current input buffer */ #if notyet termsz = el->el_term.t_size.h * el->el_term.t_size.v; if (el->el_line.lastchar - el->el_line.buffer > termsz) { /* * If line is longer than terminal, process only part * of line which would influence display. */ size_t rem = (el->el_line.lastchar-el->el_line.buffer)%termsz; st = el->el_line.lastchar - rem - (termsz - (((rem / el->el_term.t_size.v) - 1) * el->el_term.t_size.v)); } else #endif st = el->el_line.buffer; for (cp = st; cp < el->el_line.lastchar; cp++) { if (cp == el->el_line.cursor) { /* save for later */ cur.h = el->el_refresh.r_cursor.h; cur.v = el->el_refresh.r_cursor.v; } re_addc(el, (unsigned char) *cp); } if (cur.h == -1) { /* if I haven't been set yet, I'm at the end */ cur.h = el->el_refresh.r_cursor.h; cur.v = el->el_refresh.r_cursor.v; } rhdiff = el->el_term.t_size.h - el->el_refresh.r_cursor.h - el->el_rprompt.p_pos.h; if (el->el_rprompt.p_pos.h && !el->el_rprompt.p_pos.v && !el->el_refresh.r_cursor.v && rhdiff > 1) { /* * have a right-hand side prompt that will fit * on the end of the first line with at least * one character gap to the input buffer. */ while (--rhdiff > 0) /* pad out with spaces */ re_putc(el, ' ', 1); prompt_print(el, EL_RPROMPT); } else { el->el_rprompt.p_pos.h = 0; /* flag "not using rprompt" */ el->el_rprompt.p_pos.v = 0; } re_putc(el, '\0', 0); /* make line ended with NUL, no cursor shift */ el->el_refresh.r_newcv = el->el_refresh.r_cursor.v; ELRE_DEBUG(1, (__F, "term.h=%d vcur.h=%d vcur.v=%d vdisplay[0]=\r\n:%80.80s:\r\n", el->el_term.t_size.h, el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v, el->el_vdisplay[0])); ELRE_DEBUG(1, (__F, "updating %d lines.\r\n", el->el_refresh.r_newcv)); for (i = 0; i <= el->el_refresh.r_newcv; i++) { /* NOTE THAT re_update_line MAY CHANGE el_display[i] */ re_update_line(el, el->el_display[i], el->el_vdisplay[i], i); /* * Copy the new line to be the current one, and pad out with * spaces to the full width of the terminal so that if we try * moving the cursor by writing the character that is at the * end of the screen line, it won't be a NUL or some old * leftover stuff. */ re__copy_and_pad(el->el_display[i], el->el_vdisplay[i], (size_t) el->el_term.t_size.h); } ELRE_DEBUG(1, (__F, "\r\nel->el_refresh.r_cursor.v=%d,el->el_refresh.r_oldcv=%d i=%d\r\n", el->el_refresh.r_cursor.v, el->el_refresh.r_oldcv, i)); if (el->el_refresh.r_oldcv > el->el_refresh.r_newcv) for (; i <= el->el_refresh.r_oldcv; i++) { term_move_to_line(el, i); term_move_to_char(el, 0); term_clear_EOL(el, (int) strlen(el->el_display[i])); #ifdef DEBUG_REFRESH term_overwrite(el, "C\b", 2); #endif /* DEBUG_REFRESH */ el->el_display[i][0] = '\0'; } el->el_refresh.r_oldcv = el->el_refresh.r_newcv; /* set for next time */ ELRE_DEBUG(1, (__F, "\r\ncursor.h = %d, cursor.v = %d, cur.h = %d, cur.v = %d\r\n", el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v, cur.h, cur.v)); term_move_to_line(el, cur.v); /* go to where the cursor is */ term_move_to_char(el, cur.h); } /* re_goto_bottom(): * used to go to last used screen line */ protected void re_goto_bottom(EditLine *el) { term_move_to_line(el, el->el_refresh.r_oldcv); term__putc('\n'); re_clear_display(el); term__flush(); } /* re_insert(): * insert num characters of s into d (in front of the character) * at dat, maximum length of d is dlen */ private void /*ARGSUSED*/ re_insert(EditLine *el __attribute__((__unused__)), char *d, int dat, int dlen, char *s, int num) { char *a, *b; if (num <= 0) return; if (num > dlen - dat) num = dlen - dat; ELRE_DEBUG(1, (__F, "re_insert() starting: %d at %d max %d, d == \"%s\"\n", num, dat, dlen, d)); ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s)); /* open up the space for num chars */ if (num > 0) { b = d + dlen - 1; a = b - num; while (a >= &d[dat]) *b-- = *a--; d[dlen] = '\0'; /* just in case */ } ELRE_DEBUG(1, (__F, "re_insert() after insert: %d at %d max %d, d == \"%s\"\n", num, dat, dlen, d)); ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s)); /* copy the characters */ for (a = d + dat; (a < d + dlen) && (num > 0); num--) *a++ = *s++; ELRE_DEBUG(1, (__F, "re_insert() after copy: %d at %d max %d, %s == \"%s\"\n", num, dat, dlen, d, s)); ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s)); } /* re_delete(): * delete num characters d at dat, maximum length of d is dlen */ private void /*ARGSUSED*/ re_delete(EditLine *el __attribute__((__unused__)), char *d, int dat, int dlen, int num) { char *a, *b; if (num <= 0) return; if (dat + num >= dlen) { d[dat] = '\0'; return; } ELRE_DEBUG(1, (__F, "re_delete() starting: %d at %d max %d, d == \"%s\"\n", num, dat, dlen, d)); /* open up the space for num chars */ if (num > 0) { b = d + dat; a = b + num; while (a < &d[dlen]) *b++ = *a++; d[dlen] = '\0'; /* just in case */ } ELRE_DEBUG(1, (__F, "re_delete() after delete: %d at %d max %d, d == \"%s\"\n", num, dat, dlen, d)); } /* re__strncopy(): * Like strncpy without padding. */ private void re__strncopy(char *a, char *b, size_t n) { while (n-- && *b) *a++ = *b++; } /* re_clear_eol(): * Find the number of characters we need to clear till the end of line * in order to make sure that we have cleared the previous contents of * the line. fx and sx is the number of characters inserted or deleted * int the first or second diff, diff is the difference between the * number of characters between the new and old line. */ private void re_clear_eol(EditLine *el, int fx, int sx, int diff) { ELRE_DEBUG(1, (__F, "re_clear_eol sx %d, fx %d, diff %d\n", sx, fx, diff)); if (fx < 0) fx = -fx; if (sx < 0) sx = -sx; if (fx > diff) diff = fx; if (sx > diff) diff = sx; ELRE_DEBUG(1, (__F, "re_clear_eol %d\n", diff)); term_clear_EOL(el, diff); } /***************************************************************** re_update_line() is based on finding the middle difference of each line on the screen; vis: /old first difference /beginning of line | /old last same /old EOL v v v v old: eddie> Oh, my little gruntle-buggy is to me, as lurgid as new: eddie> Oh, my little buggy says to me, as lurgid as ^ ^ ^ ^ \beginning of line | \new last same \new end of line \new first difference all are character pointers for the sake of speed. Special cases for no differences, as well as for end of line additions must be handled. **************************************************************** */ /* Minimum at which doing an insert it "worth it". This should be about * half the "cost" of going into insert mode, inserting a character, and * going back out. This should really be calculated from the termcap * data... For the moment, a good number for ANSI terminals. */ #define MIN_END_KEEP 4 private void re_update_line(EditLine *el, char *old, char *new, int i) { char *o, *n, *p, c; char *ofd, *ols, *oe, *nfd, *nls, *ne; char *osb, *ose, *nsb, *nse; int fx, sx; /* * find first diff */ for (o = old, n = new; *o && (*o == *n); o++, n++) continue; ofd = o; nfd = n; /* * Find the end of both old and new */ while (*o) o++; /* * Remove any trailing blanks off of the end, being careful not to * back up past the beginning. */ while (ofd < o) { if (o[-1] != ' ') break; o--; } oe = o; *oe = '\0'; while (*n) n++; /* remove blanks from end of new */ while (nfd < n) { if (n[-1] != ' ') break; n--; } ne = n; *ne = '\0'; /* * if no diff, continue to next line of redraw */ if (*ofd == '\0' && *nfd == '\0') { ELRE_DEBUG(1, (__F, "no difference.\r\n")); return; } /* * find last same pointer */ while ((o > ofd) && (n > nfd) && (*--o == *--n)) continue; ols = ++o; nls = ++n; /* * find same begining and same end */ osb = ols; nsb = nls; ose = ols; nse = nls; /* * case 1: insert: scan from nfd to nls looking for *ofd */ if (*ofd) { for (c = *ofd, n = nfd; n < nls; n++) { if (c == *n) { for (o = ofd, p = n; p < nls && o < ols && *o == *p; o++, p++) continue; /* * if the new match is longer and it's worth * keeping, then we take it */ if (((nse - nsb) < (p - n)) && (2 * (p - n) > n - nfd)) { nsb = n; nse = p; osb = ofd; ose = o; } } } } /* * case 2: delete: scan from ofd to ols looking for *nfd */ if (*nfd) { for (c = *nfd, o = ofd; o < ols; o++) { if (c == *o) { for (n = nfd, p = o; p < ols && n < nls && *p == *n; p++, n++) continue; /* * if the new match is longer and it's worth * keeping, then we take it */ if (((ose - osb) < (p - o)) && (2 * (p - o) > o - ofd)) { nsb = nfd; nse = n; osb = o; ose = p; } } } } /* * Pragmatics I: If old trailing whitespace or not enough characters to * save to be worth it, then don't save the last same info. */ if ((oe - ols) < MIN_END_KEEP) { ols = oe; nls = ne; } /* * Pragmatics II: if the terminal isn't smart enough, make the data * dumber so the smart update doesn't try anything fancy */ /* * fx is the number of characters we need to insert/delete: in the * beginning to bring the two same begins together */ fx = (nsb - nfd) - (osb - ofd); /* * sx is the number of characters we need to insert/delete: in the * end to bring the two same last parts together */ sx = (nls - nse) - (ols - ose); if (!EL_CAN_INSERT) { if (fx > 0) { osb = ols; ose = ols; nsb = nls; nse = nls; } if (sx > 0) { ols = oe; nls = ne; } if ((ols - ofd) < (nls - nfd)) { ols = oe; nls = ne; } } if (!EL_CAN_DELETE) { if (fx < 0) { osb = ols; ose = ols; nsb = nls; nse = nls; } if (sx < 0) { ols = oe; nls = ne; } if ((ols - ofd) > (nls - nfd)) { ols = oe; nls = ne; } } /* * Pragmatics III: make sure the middle shifted pointers are correct if * they don't point to anything (we may have moved ols or nls). */ /* if the change isn't worth it, don't bother */ /* was: if (osb == ose) */ if ((ose - osb) < MIN_END_KEEP) { osb = ols; ose = ols; nsb = nls; nse = nls; } /* * Now that we are done with pragmatics we recompute fx, sx */ fx = (nsb - nfd) - (osb - ofd); sx = (nls - nse) - (ols - ose); ELRE_DEBUG(1, (__F, "fx %d, sx %d\n", fx, sx)); ELRE_DEBUG(1, (__F, "ofd %d, osb %d, ose %d, ols %d, oe %d\n", ofd - old, osb - old, ose - old, ols - old, oe - old)); ELRE_DEBUG(1, (__F, "nfd %d, nsb %d, nse %d, nls %d, ne %d\n", nfd - new, nsb - new, nse - new, nls - new, ne - new)); ELRE_DEBUG(1, (__F, "xxx-xxx:\"00000000001111111111222222222233333333334\"\r\n")); ELRE_DEBUG(1, (__F, "xxx-xxx:\"01234567890123456789012345678901234567890\"\r\n")); #ifdef DEBUG_REFRESH re_printstr(el, "old- oe", old, oe); re_printstr(el, "new- ne", new, ne); re_printstr(el, "old-ofd", old, ofd); re_printstr(el, "new-nfd", new, nfd); re_printstr(el, "ofd-osb", ofd, osb); re_printstr(el, "nfd-nsb", nfd, nsb); re_printstr(el, "osb-ose", osb, ose); re_printstr(el, "nsb-nse", nsb, nse); re_printstr(el, "ose-ols", ose, ols); re_printstr(el, "nse-nls", nse, nls); re_printstr(el, "ols- oe", ols, oe); re_printstr(el, "nls- ne", nls, ne); #endif /* DEBUG_REFRESH */ /* * el_cursor.v to this line i MUST be in this routine so that if we * don't have to change the line, we don't move to it. el_cursor.h to * first diff char */ term_move_to_line(el, i); /* * at this point we have something like this: * * /old /ofd /osb /ose /ols /oe * v.....................v v..................v v........v * eddie> Oh, my fredded gruntle-buggy is to me, as foo var lurgid as * eddie> Oh, my fredded quiux buggy is to me, as gruntle-lurgid as * ^.....................^ ^..................^ ^........^ * \new \nfd \nsb \nse \nls \ne * * fx is the difference in length between the chars between nfd and * nsb, and the chars between ofd and osb, and is thus the number of * characters to delete if < 0 (new is shorter than old, as above), * or insert (new is longer than short). * * sx is the same for the second differences. */ /* * if we have a net insert on the first difference, AND inserting the * net amount ((nsb-nfd) - (osb-ofd)) won't push the last useful * character (which is ne if nls != ne, otherwise is nse) off the edge * of the screen (el->el_term.t_size.h) else we do the deletes first * so that we keep everything we need to. */ /* * if the last same is the same like the end, there is no last same * part, otherwise we want to keep the last same part set p to the * last useful old character */ p = (ols != oe) ? oe : ose; /* * if (There is a diffence in the beginning) && (we need to insert * characters) && (the number of characters to insert is less than * the term width) * We need to do an insert! * else if (we need to delete characters) * We need to delete characters! * else * No insert or delete */ if ((nsb != nfd) && fx > 0 && ((p - old) + fx <= el->el_term.t_size.h)) { ELRE_DEBUG(1, (__F, "first diff insert at %d...\r\n", nfd - new)); /* * Move to the first char to insert, where the first diff is. */ term_move_to_char(el, nfd - new); /* * Check if we have stuff to keep at end */ if (nsb != ne) { ELRE_DEBUG(1, (__F, "with stuff to keep at end\r\n")); /* * insert fx chars of new starting at nfd */ if (fx > 0) { ELRE_DEBUG(!EL_CAN_INSERT, (__F, "ERROR: cannot insert in early first diff\n")); term_insertwrite(el, nfd, fx); re_insert(el, old, ofd - old, el->el_term.t_size.h, nfd, fx); } /* * write (nsb-nfd) - fx chars of new starting at * (nfd + fx) */ term_overwrite(el, nfd + fx, (nsb - nfd) - fx); re__strncopy(ofd + fx, nfd + fx, (size_t) ((nsb - nfd) - fx)); } else { ELRE_DEBUG(1, (__F, "without anything to save\r\n")); term_overwrite(el, nfd, (nsb - nfd)); re__strncopy(ofd, nfd, (size_t) (nsb - nfd)); /* * Done */ return; } } else if (fx < 0) { ELRE_DEBUG(1, (__F, "first diff delete at %d...\r\n", ofd - old)); /* * move to the first char to delete where the first diff is */ term_move_to_char(el, ofd - old); /* * Check if we have stuff to save */ if (osb != oe) { ELRE_DEBUG(1, (__F, "with stuff to save at end\r\n")); /* * fx is less than zero *always* here but we check * for code symmetry */ if (fx < 0) { ELRE_DEBUG(!EL_CAN_DELETE, (__F, "ERROR: cannot delete in first diff\n")); term_deletechars(el, -fx); re_delete(el, old, ofd - old, el->el_term.t_size.h, -fx); } /* * write (nsb-nfd) chars of new starting at nfd */ term_overwrite(el, nfd, (nsb - nfd)); re__strncopy(ofd, nfd, (size_t) (nsb - nfd)); } else { ELRE_DEBUG(1, (__F, "but with nothing left to save\r\n")); /* * write (nsb-nfd) chars of new starting at nfd */ term_overwrite(el, nfd, (nsb - nfd)); re_clear_eol(el, fx, sx, (oe - old) - (ne - new)); /* * Done */ return; } } else fx = 0; if (sx < 0 && (ose - old) + fx < el->el_term.t_size.h) { ELRE_DEBUG(1, (__F, "second diff delete at %d...\r\n", (ose - old) + fx)); /* * Check if we have stuff to delete */ /* * fx is the number of characters inserted (+) or deleted (-) */ term_move_to_char(el, (ose - old) + fx); /* * Check if we have stuff to save */ if (ols != oe) { ELRE_DEBUG(1, (__F, "with stuff to save at end\r\n")); /* * Again a duplicate test. */ if (sx < 0) { ELRE_DEBUG(!EL_CAN_DELETE, (__F, "ERROR: cannot delete in second diff\n")); term_deletechars(el, -sx); } /* * write (nls-nse) chars of new starting at nse */ term_overwrite(el, nse, (nls - nse)); } else { ELRE_DEBUG(1, (__F, "but with nothing left to save\r\n")); term_overwrite(el, nse, (nls - nse)); re_clear_eol(el, fx, sx, (oe - old) - (ne - new)); } } /* * if we have a first insert AND WE HAVEN'T ALREADY DONE IT... */ if ((nsb != nfd) && (osb - ofd) <= (nsb - nfd) && (fx == 0)) { ELRE_DEBUG(1, (__F, "late first diff insert at %d...\r\n", nfd - new)); term_move_to_char(el, nfd - new); /* * Check if we have stuff to keep at the end */ if (nsb != ne) { ELRE_DEBUG(1, (__F, "with stuff to keep at end\r\n")); /* * We have to recalculate fx here because we set it * to zero above as a flag saying that we hadn't done * an early first insert. */ fx = (nsb - nfd) - (osb - ofd); if (fx > 0) { /* * insert fx chars of new starting at nfd */ ELRE_DEBUG(!EL_CAN_INSERT, (__F, "ERROR: cannot insert in late first diff\n")); term_insertwrite(el, nfd, fx); re_insert(el, old, ofd - old, el->el_term.t_size.h, nfd, fx); } /* * write (nsb-nfd) - fx chars of new starting at * (nfd + fx) */ term_overwrite(el, nfd + fx, (nsb - nfd) - fx); re__strncopy(ofd + fx, nfd + fx, (size_t) ((nsb - nfd) - fx)); } else { ELRE_DEBUG(1, (__F, "without anything to save\r\n")); term_overwrite(el, nfd, (nsb - nfd)); re__strncopy(ofd, nfd, (size_t) (nsb - nfd)); } } /* * line is now NEW up to nse */ if (sx >= 0) { ELRE_DEBUG(1, (__F, "second diff insert at %d...\r\n", nse - new)); term_move_to_char(el, nse - new); if (ols != oe) { ELRE_DEBUG(1, (__F, "with stuff to keep at end\r\n")); if (sx > 0) { /* insert sx chars of new starting at nse */ ELRE_DEBUG(!EL_CAN_INSERT, (__F, "ERROR: cannot insert in second diff\n")); term_insertwrite(el, nse, sx); } /* * write (nls-nse) - sx chars of new starting at * (nse + sx) */ term_overwrite(el, nse + sx, (nls - nse) - sx); } else { ELRE_DEBUG(1, (__F, "without anything to save\r\n")); term_overwrite(el, nse, (nls - nse)); /* * No need to do a clear-to-end here because we were * doing a second insert, so we will have over * written all of the old string. */ } } ELRE_DEBUG(1, (__F, "done.\r\n")); } /* re__copy_and_pad(): * Copy string and pad with spaces */ private void re__copy_and_pad(char *dst, const char *src, size_t width) { size_t i; for (i = 0; i < width; i++) { if (*src == '\0') break; *dst++ = *src++; } for (; i < width; i++) *dst++ = ' '; *dst = '\0'; } /* re_refresh_cursor(): * Move to the new cursor position */ protected void re_refresh_cursor(EditLine *el) { char *cp, c; int h, v, th; if (el->el_line.cursor >= el->el_line.lastchar) { if (el->el_map.current == el->el_map.alt && el->el_line.lastchar != el->el_line.buffer) el->el_line.cursor = el->el_line.lastchar - 1; else el->el_line.cursor = el->el_line.lastchar; } /* first we must find where the cursor is... */ h = el->el_prompt.p_pos.h; v = el->el_prompt.p_pos.v; th = el->el_term.t_size.h; /* optimize for speed */ /* do input buffer to el->el_line.cursor */ for (cp = el->el_line.buffer; cp < el->el_line.cursor; cp++) { c = *cp; h++; /* all chars at least this long */ if (c == '\n') {/* handle newline in data part too */ h = 0; v++; } else { if (c == '\t') { /* if a tab, to next tab stop */ while (h & 07) { h++; } } else if (iscntrl((unsigned char) c)) { /* if control char */ h++; if (h > th) { /* if overflow, compensate */ h = 1; v++; } } else if (!isprint((unsigned char) c)) { h += 3; if (h > th) { /* if overflow, compensate */ h = h - th; v++; } } } if (h >= th) { /* check, extra long tabs picked up here also */ h = 0; v++; } } /* now go there */ term_move_to_line(el, v); term_move_to_char(el, h); term__flush(); } /* re_fastputc(): * Add a character fast. */ private void re_fastputc(EditLine *el, int c) { term__putc(c); el->el_display[el->el_cursor.v][el->el_cursor.h++] = c; if (el->el_cursor.h >= el->el_term.t_size.h) { /* if we must overflow */ el->el_cursor.h = 0; /* * If we would overflow (input is longer than terminal size), * emulate scroll by dropping first line and shuffling the rest. * We do this via pointer shuffling - it's safe in this case * and we avoid memcpy(). */ if (el->el_cursor.v + 1 >= el->el_term.t_size.v) { int i, lins = el->el_term.t_size.v; char *firstline = el->el_display[0]; for(i=1; i < lins; i++) el->el_display[i-1] = el->el_display[i]; re__copy_and_pad(firstline, "", 0); el->el_display[i-1] = firstline; } else { el->el_cursor.v++; el->el_refresh.r_oldcv++; } if (EL_HAS_AUTO_MARGINS) { if (EL_HAS_MAGIC_MARGINS) { term__putc(' '); term__putc('\b'); } } else { term__putc('\r'); term__putc('\n'); } } } /* re_fastaddc(): * we added just one char, handle it fast. * Assumes that screen cursor == real cursor */ protected void re_fastaddc(EditLine *el) { char c; int rhdiff; c = el->el_line.cursor[-1]; if (c == '\t' || el->el_line.cursor != el->el_line.lastchar) { re_refresh(el); /* too hard to handle */ return; } rhdiff = el->el_term.t_size.h - el->el_cursor.h - el->el_rprompt.p_pos.h; if (el->el_rprompt.p_pos.h && rhdiff < 3) { re_refresh(el); /* clear out rprompt if less than 1 char gap */ return; } /* else (only do at end of line, no TAB) */ if (iscntrl((unsigned char) c)) { /* if control char, do caret */ char mc = (c == '\177') ? '?' : (c | 0100); re_fastputc(el, '^'); re_fastputc(el, mc); } else if (isprint((unsigned char) c)) { /* normal char */ re_fastputc(el, c); } else { re_fastputc(el, '\\'); re_fastputc(el, (int)(((((unsigned int)c) >> 6) & 3) + '0')); re_fastputc(el, (int)(((((unsigned int)c) >> 3) & 7) + '0')); re_fastputc(el, (c & 7) + '0'); } term__flush(); } /* re_clear_display(): * clear the screen buffers so that new new prompt starts fresh. */ protected void re_clear_display(EditLine *el) { int i; el->el_cursor.v = 0; el->el_cursor.h = 0; for (i = 0; i < el->el_term.t_size.v; i++) el->el_display[i][0] = '\0'; el->el_refresh.r_oldcv = 0; } /* re_clear_lines(): * Make sure all lines are *really* blank */ protected void re_clear_lines(EditLine *el) { if (EL_CAN_CEOL) { int i; term_move_to_char(el, 0); for (i = 0; i <= el->el_refresh.r_oldcv; i++) { /* for each line on the screen */ term_move_to_line(el, i); term_clear_EOL(el, el->el_term.t_size.h); } term_move_to_line(el, 0); } else { term_move_to_line(el, el->el_refresh.r_oldcv); /* go to last line */ term__putc('\r'); /* go to BOL */ term__putc('\n'); /* go to new line */ } } openipmi-2.0.18/libedit/refresh.h0000644000175000017500000000453210373140634015626 0ustar chuckchuck/* $NetBSD: refresh.h,v 1.5 2003/08/07 16:44:33 agc Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)refresh.h 8.1 (Berkeley) 6/4/93 */ /* * el.refresh.h: Screen refresh functions */ #ifndef _h_el_refresh #define _h_el_refresh #include "histedit.h" typedef struct { coord_t r_cursor; /* Refresh cursor position */ int r_oldcv; /* Vertical locations */ int r_newcv; } el_refresh_t; protected void re_putc(EditLine *, int, int); protected void re_clear_lines(EditLine *); protected void re_clear_display(EditLine *); protected void re_refresh(EditLine *); protected void re_refresh_cursor(EditLine *); protected void re_fastaddc(EditLine *); protected void re_goto_bottom(EditLine *); #endif /* _h_el_refresh */ openipmi-2.0.18/libedit/makelist0000644000175000017500000001500110745427511015551 0ustar chuckchuck#!/bin/sh - # $NetBSD: makelist,v 1.11 2005/10/22 16:45:03 christos Exp $ # # Copyright (c) 1992, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Christos Zoulas of Cornell University. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)makelist 5.3 (Berkeley) 6/4/93 # makelist.sh: Automatically generate header files... AWK=awk USAGE="Usage: $0 -h|-e|-fc|-fh|-bc|-bh|-m " # Avoid locale dependent case conversions and always use ascii. # (for example the script won't work in Turkish locale without this setting) LC_ALL=C; LANG=C export LC_ALL LANG if [ "x$1" = "x" ] then echo $USAGE 1>&2 exit 1 fi FLAG="$1" shift FILES="$@" case $FLAG in # generate foo.h file from foo.c # -h) set - `echo $FILES | sed -e 's/\\./_/g'` hdr="_h_`basename $1`" cat $FILES | $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("#ifndef %s\n#define %s\n", "'$hdr'", "'$hdr'"); } /\(\):/ { pr = substr($2, 1, 2); if (pr == "vi" || pr == "em" || pr == "ed") { name = substr($2, 1, length($2) - 3); # # XXX: need a space between name and prototype so that -fc and -fh # parsing is much easier # printf("protected el_action_t\t%s (EditLine *, int);\n", name); } } END { printf("#endif /* %s */\n", "'$hdr'"); }' ;; # generate help.c from various .c files # -bc) cat $FILES | $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("#include \"sys.h\"\n#include \"el.h\"\n"); printf("private const struct el_bindings_t el_func_help[] = {\n"); low = "abcdefghijklmnopqrstuvwxyz_"; high = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_"; for (i = 1; i <= length(low); i++) tr[substr(low, i, 1)] = substr(high, i, 1); } /\(\):/ { pr = substr($2, 1, 2); if (pr == "vi" || pr == "em" || pr == "ed") { name = substr($2, 1, length($2) - 3); uname = ""; fname = ""; for (i = 1; i <= length(name); i++) { s = substr(name, i, 1); uname = uname tr[s]; if (s == "_") s = "-"; fname = fname s; } printf(" { %-30.30s %-30.30s\n","\"" fname "\",", uname ","); ok = 1; } } /^ \*/ { if (ok) { printf(" \""); for (i = 2; i < NF; i++) printf("%s ", $i); printf("%s\" },\n", $i); ok = 0; } } END { printf("};\n"); printf("\nprotected const el_bindings_t* help__get()"); printf("{ return el_func_help; }\n"); }' ;; # generate help.h from various .c files # -bh) $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("#ifndef _h_help_c\n#define _h_help_c\n"); printf("protected const el_bindings_t *help__get(void);\n"); printf("#endif /* _h_help_c */\n"); }' /dev/null ;; # generate fcns.h from various .h files # -fh) cat $FILES | $AWK '/el_action_t/ { print $3 }' | \ sort | tr '[:lower:]' '[:upper:]' | $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("#ifndef _h_fcns_c\n#define _h_fcns_c\n"); count = 0; } { printf("#define\t%-30.30s\t%3d\n", $1, count++); } END { printf("#define\t%-30.30s\t%3d\n", "EL_NUM_FCNS", count); printf("typedef el_action_t (*el_func_t)(EditLine *, int);"); printf("\nprotected const el_func_t* func__get(void);\n"); printf("#endif /* _h_fcns_c */\n"); }' ;; # generate fcns.c from various .h files # -fc) cat $FILES | $AWK '/el_action_t/ { print $3 }' | sort | $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("#include \"sys.h\"\n#include \"el.h\"\n"); printf("private const el_func_t el_func[] = {"); maxlen = 80; needn = 1; len = 0; } { clen = 25 + 2; len += clen; if (len >= maxlen) needn = 1; if (needn) { printf("\n "); needn = 0; len = 4 + clen; } s = $1 ","; printf("%-26.26s ", s); } END { printf("\n};\n"); printf("\nprotected const el_func_t* func__get() { return el_func; }\n"); }' ;; # generate editline.c from various .c files # -e) echo "$FILES" | tr ' ' '\012' | $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("#define protected static\n"); printf("#define SCCSID\n"); } { printf("#include \"%s\"\n", $1); }' ;; # generate man page fragment from various .c files # -m) cat $FILES | $AWK ' BEGIN { printf(".\\\" Section automatically generated with makelist\n"); printf(".Bl -tag -width 4n\n"); } /\(\):/ { pr = substr($2, 1, 2); if (pr == "vi" || pr == "em" || pr == "ed") { name = substr($2, 1, length($2) - 3); fname = ""; for (i = 1; i <= length(name); i++) { s = substr(name, i, 1); if (s == "_") s = "-"; fname = fname s; } printf(".It Ic %s\n", fname); ok = 1; } } /^ \*/ { if (ok) { for (i = 2; i < NF; i++) printf("%s ", $i); printf("%s.\n", $i); ok = 0; } } END { printf(".El\n"); printf(".\\\" End of section automatically generated with makelist\n"); }' ;; *) echo $USAGE 1>&2 exit 1 ;; esac openipmi-2.0.18/libedit/hist.c0000644000175000017500000001255710373140634015140 0ustar chuckchuck/* $NetBSD: hist.c,v 1.15 2003/11/01 23:36:39 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: hist.c,v 1.15 2003/11/01 23:36:39 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * hist.c: History access functions */ #include #include "el.h" /* hist_init(): * Initialization function. */ protected int hist_init(EditLine *el) { el->el_history.fun = NULL; el->el_history.ref = NULL; el->el_history.buf = (char *) el_malloc(EL_BUFSIZ); el->el_history.sz = EL_BUFSIZ; if (el->el_history.buf == NULL) return (-1); el->el_history.last = el->el_history.buf; return (0); } /* hist_end(): * clean up history; */ protected void hist_end(EditLine *el) { el_free((ptr_t) el->el_history.buf); el->el_history.buf = NULL; } /* hist_set(): * Set new history interface */ protected int hist_set(EditLine *el, hist_fun_t fun, ptr_t ptr) { el->el_history.ref = ptr; el->el_history.fun = fun; return (0); } /* hist_get(): * Get a history line and update it in the buffer. * eventno tells us the event to get. */ protected el_action_t hist_get(EditLine *el) { const char *hp; int h; if (el->el_history.eventno == 0) { /* if really the current line */ (void) strncpy(el->el_line.buffer, el->el_history.buf, el->el_history.sz); el->el_line.lastchar = el->el_line.buffer + (el->el_history.last - el->el_history.buf); #ifdef KSHVI if (el->el_map.type == MAP_VI) el->el_line.cursor = el->el_line.buffer; else #endif /* KSHVI */ el->el_line.cursor = el->el_line.lastchar; return (CC_REFRESH); } if (el->el_history.ref == NULL) return (CC_ERROR); hp = HIST_FIRST(el); if (hp == NULL) return (CC_ERROR); for (h = 1; h < el->el_history.eventno; h++) if ((hp = HIST_NEXT(el)) == NULL) { el->el_history.eventno = h; return (CC_ERROR); } (void) strlcpy(el->el_line.buffer, hp, (size_t)(el->el_line.limit - el->el_line.buffer)); el->el_line.lastchar = el->el_line.buffer + strlen(el->el_line.buffer); if (el->el_line.lastchar > el->el_line.buffer && el->el_line.lastchar[-1] == '\n') el->el_line.lastchar--; if (el->el_line.lastchar > el->el_line.buffer && el->el_line.lastchar[-1] == ' ') el->el_line.lastchar--; #ifdef KSHVI if (el->el_map.type == MAP_VI) el->el_line.cursor = el->el_line.buffer; else #endif /* KSHVI */ el->el_line.cursor = el->el_line.lastchar; return (CC_REFRESH); } /* hist_command() * process a history command */ protected int hist_command(EditLine *el, int argc, const char **argv) { const char *str; int num; HistEvent ev; if (el->el_history.ref == NULL) return (-1); if (argc == 1 || strcmp(argv[1], "list") == 0) { /* List history entries */ for (str = HIST_LAST(el); str != NULL; str = HIST_PREV(el)) (void) fprintf(el->el_outfile, "%d %s", el->el_history.ev.num, str); return (0); } if (argc != 3) return (-1); num = (int)strtol(argv[2], NULL, 0); if (strcmp(argv[1], "size") == 0) return history(el->el_history.ref, &ev, H_SETSIZE, num); if (strcmp(argv[1], "unique") == 0) return history(el->el_history.ref, &ev, H_SETUNIQUE, num); return -1; } /* hist_enlargebuf() * Enlarge history buffer to specified value. Called from el_enlargebufs(). * Return 0 for failure, 1 for success. */ protected int /*ARGSUSED*/ hist_enlargebuf(EditLine *el, size_t oldsz, size_t newsz) { char *newbuf; newbuf = realloc(el->el_history.buf, newsz); if (!newbuf) return 0; (void) memset(&newbuf[oldsz], '\0', newsz - oldsz); el->el_history.last = newbuf + (el->el_history.last - el->el_history.buf); el->el_history.buf = newbuf; el->el_history.sz = newsz; return 1; } openipmi-2.0.18/libedit/term.c0000644000175000017500000011247410373140634015137 0ustar chuckchuck/* $NetBSD: term.c,v 1.41 2005/08/08 14:05:37 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95"; #else __RCSID("$NetBSD: term.c,v 1.41 2005/08/08 14:05:37 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * term.c: Editor/termcap-curses interface * We have to declare a static variable here, since the * termcap putchar routine does not take an argument! */ #include #include #include #include #include #ifdef HAVE_CURSES_H # include #elif HAVE_NCURSES_H # include #endif /* Solaris's term.h does horrid things. */ #if (defined(HAVE_TERM_H) && !defined(_SUNOS)) # include #endif #include #include #include "el.h" /* * IMPORTANT NOTE: these routines are allowed to look at the current screen * and the current possition assuming that it is correct. If this is not * true, then the update will be WRONG! This is (should be) a valid * assumption... */ #define TC_BUFSIZE 2048 #define GoodStr(a) (el->el_term.t_str[a] != NULL && \ el->el_term.t_str[a][0] != '\0') #define Str(a) el->el_term.t_str[a] #define Val(a) el->el_term.t_val[a] #ifdef notdef private const struct { const char *b_name; int b_rate; } baud_rate[] = { #ifdef B0 { "0", B0 }, #endif #ifdef B50 { "50", B50 }, #endif #ifdef B75 { "75", B75 }, #endif #ifdef B110 { "110", B110 }, #endif #ifdef B134 { "134", B134 }, #endif #ifdef B150 { "150", B150 }, #endif #ifdef B200 { "200", B200 }, #endif #ifdef B300 { "300", B300 }, #endif #ifdef B600 { "600", B600 }, #endif #ifdef B900 { "900", B900 }, #endif #ifdef B1200 { "1200", B1200 }, #endif #ifdef B1800 { "1800", B1800 }, #endif #ifdef B2400 { "2400", B2400 }, #endif #ifdef B3600 { "3600", B3600 }, #endif #ifdef B4800 { "4800", B4800 }, #endif #ifdef B7200 { "7200", B7200 }, #endif #ifdef B9600 { "9600", B9600 }, #endif #ifdef EXTA { "19200", EXTA }, #endif #ifdef B19200 { "19200", B19200 }, #endif #ifdef EXTB { "38400", EXTB }, #endif #ifdef B38400 { "38400", B38400 }, #endif { NULL, 0 } }; #endif private const struct termcapstr { const char *name; const char *long_name; } tstr[] = { #define T_al 0 { "al", "add new blank line" }, #define T_bl 1 { "bl", "audible bell" }, #define T_cd 2 { "cd", "clear to bottom" }, #define T_ce 3 { "ce", "clear to end of line" }, #define T_ch 4 { "ch", "cursor to horiz pos" }, #define T_cl 5 { "cl", "clear screen" }, #define T_dc 6 { "dc", "delete a character" }, #define T_dl 7 { "dl", "delete a line" }, #define T_dm 8 { "dm", "start delete mode" }, #define T_ed 9 { "ed", "end delete mode" }, #define T_ei 10 { "ei", "end insert mode" }, #define T_fs 11 { "fs", "cursor from status line" }, #define T_ho 12 { "ho", "home cursor" }, #define T_ic 13 { "ic", "insert character" }, #define T_im 14 { "im", "start insert mode" }, #define T_ip 15 { "ip", "insert padding" }, #define T_kd 16 { "kd", "sends cursor down" }, #define T_kl 17 { "kl", "sends cursor left" }, #define T_kr 18 { "kr", "sends cursor right" }, #define T_ku 19 { "ku", "sends cursor up" }, #define T_md 20 { "md", "begin bold" }, #define T_me 21 { "me", "end attributes" }, #define T_nd 22 { "nd", "non destructive space" }, #define T_se 23 { "se", "end standout" }, #define T_so 24 { "so", "begin standout" }, #define T_ts 25 { "ts", "cursor to status line" }, #define T_up 26 { "up", "cursor up one" }, #define T_us 27 { "us", "begin underline" }, #define T_ue 28 { "ue", "end underline" }, #define T_vb 29 { "vb", "visible bell" }, #define T_DC 30 { "DC", "delete multiple chars" }, #define T_DO 31 { "DO", "cursor down multiple" }, #define T_IC 32 { "IC", "insert multiple chars" }, #define T_LE 33 { "LE", "cursor left multiple" }, #define T_RI 34 { "RI", "cursor right multiple" }, #define T_UP 35 { "UP", "cursor up multiple" }, #define T_kh 36 { "kh", "send cursor home" }, #define T_at7 37 { "@7", "send cursor end" }, #define T_str 38 { NULL, NULL } }; private const struct termcapval { const char *name; const char *long_name; } tval[] = { #define T_am 0 { "am", "has automatic margins" }, #define T_pt 1 { "pt", "has physical tabs" }, #define T_li 2 { "li", "Number of lines" }, #define T_co 3 { "co", "Number of columns" }, #define T_km 4 { "km", "Has meta key" }, #define T_xt 5 { "xt", "Tab chars destructive" }, #define T_xn 6 { "xn", "newline ignored at right margin" }, #define T_MT 7 { "MT", "Has meta key" }, /* XXX? */ #define T_val 8 { NULL, NULL, } }; /* do two or more of the attributes use me */ private void term_setflags(EditLine *); private int term_rebuffer_display(EditLine *); private void term_free_display(EditLine *); private int term_alloc_display(EditLine *); private void term_alloc(EditLine *, const struct termcapstr *, const char *); private void term_init_arrow(EditLine *); private void term_reset_arrow(EditLine *); private FILE *term_outfile = NULL; /* XXX: How do we fix that? */ /* term_setflags(): * Set the terminal capability flags */ private void term_setflags(EditLine *el) { EL_FLAGS = 0; if (el->el_tty.t_tabs) EL_FLAGS |= (Val(T_pt) && !Val(T_xt)) ? TERM_CAN_TAB : 0; EL_FLAGS |= (Val(T_km) || Val(T_MT)) ? TERM_HAS_META : 0; EL_FLAGS |= GoodStr(T_ce) ? TERM_CAN_CEOL : 0; EL_FLAGS |= (GoodStr(T_dc) || GoodStr(T_DC)) ? TERM_CAN_DELETE : 0; EL_FLAGS |= (GoodStr(T_im) || GoodStr(T_ic) || GoodStr(T_IC)) ? TERM_CAN_INSERT : 0; EL_FLAGS |= (GoodStr(T_up) || GoodStr(T_UP)) ? TERM_CAN_UP : 0; EL_FLAGS |= Val(T_am) ? TERM_HAS_AUTO_MARGINS : 0; EL_FLAGS |= Val(T_xn) ? TERM_HAS_MAGIC_MARGINS : 0; if (GoodStr(T_me) && GoodStr(T_ue)) EL_FLAGS |= (strcmp(Str(T_me), Str(T_ue)) == 0) ? TERM_CAN_ME : 0; else EL_FLAGS &= ~TERM_CAN_ME; if (GoodStr(T_me) && GoodStr(T_se)) EL_FLAGS |= (strcmp(Str(T_me), Str(T_se)) == 0) ? TERM_CAN_ME : 0; #ifdef DEBUG_SCREEN if (!EL_CAN_UP) { (void) fprintf(el->el_errfile, "WARNING: Your terminal cannot move up.\n"); (void) fprintf(el->el_errfile, "Editing may be odd for long lines.\n"); } if (!EL_CAN_CEOL) (void) fprintf(el->el_errfile, "no clear EOL capability.\n"); if (!EL_CAN_DELETE) (void) fprintf(el->el_errfile, "no delete char capability.\n"); if (!EL_CAN_INSERT) (void) fprintf(el->el_errfile, "no insert char capability.\n"); #endif /* DEBUG_SCREEN */ } /* term_init(): * Initialize the terminal stuff */ protected int term_init(EditLine *el) { el->el_term.t_buf = (char *) el_malloc(TC_BUFSIZE); if (el->el_term.t_buf == NULL) return (-1); el->el_term.t_cap = (char *) el_malloc(TC_BUFSIZE); if (el->el_term.t_cap == NULL) return (-1); el->el_term.t_fkey = (fkey_t *) el_malloc(A_K_NKEYS * sizeof(fkey_t)); if (el->el_term.t_fkey == NULL) return (-1); el->el_term.t_loc = 0; el->el_term.t_str = (char **) el_malloc(T_str * sizeof(char *)); if (el->el_term.t_str == NULL) return (-1); (void) memset(el->el_term.t_str, 0, T_str * sizeof(char *)); el->el_term.t_val = (int *) el_malloc(T_val * sizeof(int)); if (el->el_term.t_val == NULL) return (-1); (void) memset(el->el_term.t_val, 0, T_val * sizeof(int)); term_outfile = el->el_outfile; (void) term_set(el, NULL); term_init_arrow(el); return (0); } /* term_end(): * Clean up the terminal stuff */ protected void term_end(EditLine *el) { el_free((ptr_t) el->el_term.t_buf); el->el_term.t_buf = NULL; el_free((ptr_t) el->el_term.t_cap); el->el_term.t_cap = NULL; el->el_term.t_loc = 0; el_free((ptr_t) el->el_term.t_str); el->el_term.t_str = NULL; el_free((ptr_t) el->el_term.t_val); el->el_term.t_val = NULL; el_free((ptr_t) el->el_term.t_fkey); el->el_term.t_fkey = NULL; term_free_display(el); } /* term_alloc(): * Maintain a string pool for termcap strings */ private void term_alloc(EditLine *el, const struct termcapstr *t, const char *cap) { char termbuf[TC_BUFSIZE]; int tlen, clen; char **tlist = el->el_term.t_str; char **tmp, **str = &tlist[t - tstr]; if (cap == NULL || *cap == '\0') { *str = NULL; return; } else clen = strlen(cap); tlen = *str == NULL ? 0 : strlen(*str); /* * New string is shorter; no need to allocate space */ if (clen <= tlen) { (void) strcpy(*str, cap); /* XXX strcpy is safe */ return; } /* * New string is longer; see if we have enough space to append */ if (el->el_term.t_loc + 3 < TC_BUFSIZE) { /* XXX strcpy is safe */ (void) strcpy(*str = &el->el_term.t_buf[el->el_term.t_loc], cap); el->el_term.t_loc += clen + 1; /* one for \0 */ return; } /* * Compact our buffer; no need to check compaction, cause we know it * fits... */ tlen = 0; for (tmp = tlist; tmp < &tlist[T_str]; tmp++) if (*tmp != NULL && *tmp != '\0' && *tmp != *str) { char *ptr; for (ptr = *tmp; *ptr != '\0'; termbuf[tlen++] = *ptr++) continue; termbuf[tlen++] = '\0'; } memcpy(el->el_term.t_buf, termbuf, TC_BUFSIZE); el->el_term.t_loc = tlen; if (el->el_term.t_loc + 3 >= TC_BUFSIZE) { (void) fprintf(el->el_errfile, "Out of termcap string space.\n"); return; } /* XXX strcpy is safe */ (void) strcpy(*str = &el->el_term.t_buf[el->el_term.t_loc], cap); el->el_term.t_loc += clen + 1; /* one for \0 */ return; } /* term_rebuffer_display(): * Rebuffer the display after the screen changed size */ private int term_rebuffer_display(EditLine *el) { coord_t *c = &el->el_term.t_size; term_free_display(el); c->h = Val(T_co); c->v = Val(T_li); if (term_alloc_display(el) == -1) return (-1); return (0); } /* term_alloc_display(): * Allocate a new display. */ private int term_alloc_display(EditLine *el) { int i; char **b; coord_t *c = &el->el_term.t_size; b = (char **) el_malloc((size_t) (sizeof(char *) * (c->v + 1))); if (b == NULL) return (-1); for (i = 0; i < c->v; i++) { b[i] = (char *) el_malloc((size_t) (sizeof(char) * (c->h + 1))); if (b[i] == NULL) return (-1); } b[c->v] = NULL; el->el_display = b; b = (char **) el_malloc((size_t) (sizeof(char *) * (c->v + 1))); if (b == NULL) return (-1); for (i = 0; i < c->v; i++) { b[i] = (char *) el_malloc((size_t) (sizeof(char) * (c->h + 1))); if (b[i] == NULL) return (-1); } b[c->v] = NULL; el->el_vdisplay = b; return (0); } /* term_free_display(): * Free the display buffers */ private void term_free_display(EditLine *el) { char **b; char **bufp; b = el->el_display; el->el_display = NULL; if (b != NULL) { for (bufp = b; *bufp != NULL; bufp++) el_free((ptr_t) * bufp); el_free((ptr_t) b); } b = el->el_vdisplay; el->el_vdisplay = NULL; if (b != NULL) { for (bufp = b; *bufp != NULL; bufp++) el_free((ptr_t) * bufp); el_free((ptr_t) b); } } /* term_move_to_line(): * move to line (first line == 0) * as efficiently as possible */ protected void term_move_to_line(EditLine *el, int where) { int del; if (where == el->el_cursor.v) return; if (where > el->el_term.t_size.v) { #ifdef DEBUG_SCREEN (void) fprintf(el->el_errfile, "term_move_to_line: where is ridiculous: %d\r\n", where); #endif /* DEBUG_SCREEN */ return; } if ((del = where - el->el_cursor.v) > 0) { while (del > 0) { if (EL_HAS_AUTO_MARGINS && el->el_display[el->el_cursor.v][0] != '\0') { /* move without newline */ term_move_to_char(el, el->el_term.t_size.h - 1); term_overwrite(el, &el->el_display[el->el_cursor.v][el->el_cursor.h], 1); /* updates Cursor */ del--; } else { if ((del > 1) && GoodStr(T_DO)) { (void) tputs(tgoto(Str(T_DO), del, del), del, term__putc); del = 0; } else { for (; del > 0; del--) term__putc('\n'); /* because the \n will become \r\n */ el->el_cursor.h = 0; } } } } else { /* del < 0 */ if (GoodStr(T_UP) && (-del > 1 || !GoodStr(T_up))) (void) tputs(tgoto(Str(T_UP), -del, -del), -del, term__putc); else { if (GoodStr(T_up)) for (; del < 0; del++) (void) tputs(Str(T_up), 1, term__putc); } } el->el_cursor.v = where;/* now where is here */ } /* term_move_to_char(): * Move to the character position specified */ protected void term_move_to_char(EditLine *el, int where) { int del, i; mc_again: if (where == el->el_cursor.h) return; if (where > el->el_term.t_size.h) { #ifdef DEBUG_SCREEN (void) fprintf(el->el_errfile, "term_move_to_char: where is riduculous: %d\r\n", where); #endif /* DEBUG_SCREEN */ return; } if (!where) { /* if where is first column */ term__putc('\r'); /* do a CR */ el->el_cursor.h = 0; return; } del = where - el->el_cursor.h; if ((del < -4 || del > 4) && GoodStr(T_ch)) /* go there directly */ (void) tputs(tgoto(Str(T_ch), where, where), where, term__putc); else { if (del > 0) { /* moving forward */ if ((del > 4) && GoodStr(T_RI)) (void) tputs(tgoto(Str(T_RI), del, del), del, term__putc); else { /* if I can do tabs, use them */ if (EL_CAN_TAB) { if ((el->el_cursor.h & 0370) != (where & 0370)) { /* if not within tab stop */ for (i = (el->el_cursor.h & 0370); i < (where & 0370); i += 8) term__putc('\t'); /* then tab over */ el->el_cursor.h = where & 0370; } } /* * it's usually cheaper to just write the * chars, so we do. */ /* * NOTE THAT term_overwrite() WILL CHANGE * el->el_cursor.h!!! */ term_overwrite(el, &el->el_display[el->el_cursor.v][el->el_cursor.h], where - el->el_cursor.h); } } else { /* del < 0 := moving backward */ if ((-del > 4) && GoodStr(T_LE)) (void) tputs(tgoto(Str(T_LE), -del, -del), -del, term__putc); else { /* can't go directly there */ /* * if the "cost" is greater than the "cost" * from col 0 */ if (EL_CAN_TAB ? ((unsigned int)-del > (((unsigned int) where >> 3) + (where & 07))) : (-del > where)) { term__putc('\r'); /* do a CR */ el->el_cursor.h = 0; goto mc_again; /* and try again */ } for (i = 0; i < -del; i++) term__putc('\b'); } } } el->el_cursor.h = where; /* now where is here */ } /* term_overwrite(): * Overstrike num characters */ protected void term_overwrite(EditLine *el, const char *cp, int n) { if (n <= 0) return; /* catch bugs */ if (n > el->el_term.t_size.h) { #ifdef DEBUG_SCREEN (void) fprintf(el->el_errfile, "term_overwrite: n is riduculous: %d\r\n", n); #endif /* DEBUG_SCREEN */ return; } do { term__putc(*cp++); el->el_cursor.h++; } while (--n); if (el->el_cursor.h >= el->el_term.t_size.h) { /* wrap? */ if (EL_HAS_AUTO_MARGINS) { /* yes */ el->el_cursor.h = 0; el->el_cursor.v++; if (EL_HAS_MAGIC_MARGINS) { /* force the wrap to avoid the "magic" * situation */ char c; if ((c = el->el_display[el->el_cursor.v][el->el_cursor.h]) != '\0') term_overwrite(el, &c, 1); else term__putc(' '); el->el_cursor.h = 1; } } else /* no wrap, but cursor stays on screen */ el->el_cursor.h = el->el_term.t_size.h; } } /* term_deletechars(): * Delete num characters */ protected void term_deletechars(EditLine *el, int num) { if (num <= 0) return; if (!EL_CAN_DELETE) { #ifdef DEBUG_EDIT (void) fprintf(el->el_errfile, " ERROR: cannot delete \n"); #endif /* DEBUG_EDIT */ return; } if (num > el->el_term.t_size.h) { #ifdef DEBUG_SCREEN (void) fprintf(el->el_errfile, "term_deletechars: num is riduculous: %d\r\n", num); #endif /* DEBUG_SCREEN */ return; } if (GoodStr(T_DC)) /* if I have multiple delete */ if ((num > 1) || !GoodStr(T_dc)) { /* if dc would be more * expen. */ (void) tputs(tgoto(Str(T_DC), num, num), num, term__putc); return; } if (GoodStr(T_dm)) /* if I have delete mode */ (void) tputs(Str(T_dm), 1, term__putc); if (GoodStr(T_dc)) /* else do one at a time */ while (num--) (void) tputs(Str(T_dc), 1, term__putc); if (GoodStr(T_ed)) /* if I have delete mode */ (void) tputs(Str(T_ed), 1, term__putc); } /* term_insertwrite(): * Puts terminal in insert character mode or inserts num * characters in the line */ protected void term_insertwrite(EditLine *el, char *cp, int num) { if (num <= 0) return; if (!EL_CAN_INSERT) { #ifdef DEBUG_EDIT (void) fprintf(el->el_errfile, " ERROR: cannot insert \n"); #endif /* DEBUG_EDIT */ return; } if (num > el->el_term.t_size.h) { #ifdef DEBUG_SCREEN (void) fprintf(el->el_errfile, "StartInsert: num is riduculous: %d\r\n", num); #endif /* DEBUG_SCREEN */ return; } if (GoodStr(T_IC)) /* if I have multiple insert */ if ((num > 1) || !GoodStr(T_ic)) { /* if ic would be more expensive */ (void) tputs(tgoto(Str(T_IC), num, num), num, term__putc); term_overwrite(el, cp, num); /* this updates el_cursor.h */ return; } if (GoodStr(T_im) && GoodStr(T_ei)) { /* if I have insert mode */ (void) tputs(Str(T_im), 1, term__putc); el->el_cursor.h += num; do term__putc(*cp++); while (--num); if (GoodStr(T_ip)) /* have to make num chars insert */ (void) tputs(Str(T_ip), 1, term__putc); (void) tputs(Str(T_ei), 1, term__putc); return; } do { if (GoodStr(T_ic)) /* have to make num chars insert */ (void) tputs(Str(T_ic), 1, term__putc); /* insert a char */ term__putc(*cp++); el->el_cursor.h++; if (GoodStr(T_ip)) /* have to make num chars insert */ (void) tputs(Str(T_ip), 1, term__putc); /* pad the inserted char */ } while (--num); } /* term_clear_EOL(): * clear to end of line. There are num characters to clear */ protected void term_clear_EOL(EditLine *el, int num) { int i; if (EL_CAN_CEOL && GoodStr(T_ce)) (void) tputs(Str(T_ce), 1, term__putc); else { for (i = 0; i < num; i++) term__putc(' '); el->el_cursor.h += num; /* have written num spaces */ } } /* term_clear_screen(): * Clear the screen */ protected void term_clear_screen(EditLine *el) { /* clear the whole screen and home */ if (GoodStr(T_cl)) /* send the clear screen code */ (void) tputs(Str(T_cl), Val(T_li), term__putc); else if (GoodStr(T_ho) && GoodStr(T_cd)) { (void) tputs(Str(T_ho), Val(T_li), term__putc); /* home */ /* clear to bottom of screen */ (void) tputs(Str(T_cd), Val(T_li), term__putc); } else { term__putc('\r'); term__putc('\n'); } } /* term_beep(): * Beep the way the terminal wants us */ protected void term_beep(EditLine *el) { if (GoodStr(T_bl)) /* what termcap says we should use */ (void) tputs(Str(T_bl), 1, term__putc); else term__putc('\007'); /* an ASCII bell; ^G */ } #ifdef notdef /* term_clear_to_bottom(): * Clear to the bottom of the screen */ protected void term_clear_to_bottom(EditLine *el) { if (GoodStr(T_cd)) (void) tputs(Str(T_cd), Val(T_li), term__putc); else if (GoodStr(T_ce)) (void) tputs(Str(T_ce), Val(T_li), term__putc); } #endif protected void term_get(EditLine *el, const char **term) { *term = el->el_term.t_name; } /* term_set(): * Read in the terminal capabilities from the requested terminal */ protected int term_set(EditLine *el, const char *term) { int i; char buf[TC_BUFSIZE]; char *area; const struct termcapstr *t; sigset_t oset, nset; int lins, cols; (void) sigemptyset(&nset); (void) sigaddset(&nset, SIGWINCH); (void) sigprocmask(SIG_BLOCK, &nset, &oset); area = buf; if (term == NULL) term = getenv("TERM"); if (!term || !term[0]) term = "dumb"; if (strcmp(term, "emacs") == 0) el->el_flags |= EDIT_DISABLED; memset(el->el_term.t_cap, 0, TC_BUFSIZE); i = tgetent(el->el_term.t_cap, term); if (i <= 0) { if (i == -1) (void) fprintf(el->el_errfile, "Cannot read termcap database;\n"); else if (i == 0) (void) fprintf(el->el_errfile, "No entry for terminal type \"%s\";\n", term); (void) fprintf(el->el_errfile, "using dumb terminal settings.\n"); Val(T_co) = 80; /* do a dumb terminal */ Val(T_pt) = Val(T_km) = Val(T_li) = 0; Val(T_xt) = Val(T_MT); for (t = tstr; t->name != NULL; t++) term_alloc(el, t, NULL); } else { /* auto/magic margins */ Val(T_am) = tgetflag("am"); Val(T_xn) = tgetflag("xn"); /* Can we tab */ Val(T_pt) = tgetflag("pt"); Val(T_xt) = tgetflag("xt"); /* do we have a meta? */ Val(T_km) = tgetflag("km"); Val(T_MT) = tgetflag("MT"); /* Get the size */ Val(T_co) = tgetnum("co"); Val(T_li) = tgetnum("li"); for (t = tstr; t->name != NULL; t++) { /* XXX: some systems' tgetstr needs non const */ term_alloc(el, t, tgetstr(strchr(t->name, *t->name), &area)); } } if (Val(T_co) < 2) Val(T_co) = 80; /* just in case */ if (Val(T_li) < 1) Val(T_li) = 24; el->el_term.t_size.v = Val(T_co); el->el_term.t_size.h = Val(T_li); term_setflags(el); /* get the correct window size */ (void) term_get_size(el, &lins, &cols); if (term_change_size(el, lins, cols) == -1) return (-1); (void) sigprocmask(SIG_SETMASK, &oset, NULL); term_bind_arrow(el); el->el_term.t_name = term; return (i <= 0 ? -1 : 0); } /* term_get_size(): * Return the new window size in lines and cols, and * true if the size was changed. */ protected int term_get_size(EditLine *el, int *lins, int *cols) { *cols = Val(T_co); *lins = Val(T_li); #ifdef TIOCGWINSZ { struct winsize ws; if (ioctl(el->el_infd, TIOCGWINSZ, (ioctl_t) & ws) != -1) { if (ws.ws_col) *cols = ws.ws_col; if (ws.ws_row) *lins = ws.ws_row; } } #endif #ifdef TIOCGSIZE { struct ttysize ts; if (ioctl(el->el_infd, TIOCGSIZE, (ioctl_t) & ts) != -1) { if (ts.ts_cols) *cols = ts.ts_cols; if (ts.ts_lines) *lins = ts.ts_lines; } } #endif return (Val(T_co) != *cols || Val(T_li) != *lins); } /* term_change_size(): * Change the size of the terminal */ protected int term_change_size(EditLine *el, int lins, int cols) { /* * Just in case */ Val(T_co) = (cols < 2) ? 80 : cols; Val(T_li) = (lins < 1) ? 24 : lins; /* re-make display buffers */ if (term_rebuffer_display(el) == -1) return (-1); re_clear_display(el); return (0); } /* term_init_arrow(): * Initialize the arrow key bindings from termcap */ private void term_init_arrow(EditLine *el) { fkey_t *arrow = el->el_term.t_fkey; arrow[A_K_DN].name = "down"; arrow[A_K_DN].key = T_kd; arrow[A_K_DN].fun.cmd = ED_NEXT_HISTORY; arrow[A_K_DN].type = XK_CMD; arrow[A_K_UP].name = "up"; arrow[A_K_UP].key = T_ku; arrow[A_K_UP].fun.cmd = ED_PREV_HISTORY; arrow[A_K_UP].type = XK_CMD; arrow[A_K_LT].name = "left"; arrow[A_K_LT].key = T_kl; arrow[A_K_LT].fun.cmd = ED_PREV_CHAR; arrow[A_K_LT].type = XK_CMD; arrow[A_K_RT].name = "right"; arrow[A_K_RT].key = T_kr; arrow[A_K_RT].fun.cmd = ED_NEXT_CHAR; arrow[A_K_RT].type = XK_CMD; arrow[A_K_HO].name = "home"; arrow[A_K_HO].key = T_kh; arrow[A_K_HO].fun.cmd = ED_MOVE_TO_BEG; arrow[A_K_HO].type = XK_CMD; arrow[A_K_EN].name = "end"; arrow[A_K_EN].key = T_at7; arrow[A_K_EN].fun.cmd = ED_MOVE_TO_END; arrow[A_K_EN].type = XK_CMD; } /* term_reset_arrow(): * Reset arrow key bindings */ private void term_reset_arrow(EditLine *el) { fkey_t *arrow = el->el_term.t_fkey; static const char strA[] = {033, '[', 'A', '\0'}; static const char strB[] = {033, '[', 'B', '\0'}; static const char strC[] = {033, '[', 'C', '\0'}; static const char strD[] = {033, '[', 'D', '\0'}; static const char strH[] = {033, '[', 'H', '\0'}; static const char strF[] = {033, '[', 'F', '\0'}; static const char stOA[] = {033, 'O', 'A', '\0'}; static const char stOB[] = {033, 'O', 'B', '\0'}; static const char stOC[] = {033, 'O', 'C', '\0'}; static const char stOD[] = {033, 'O', 'D', '\0'}; static const char stOH[] = {033, 'O', 'H', '\0'}; static const char stOF[] = {033, 'O', 'F', '\0'}; key_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type); key_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type); key_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type); key_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type); key_add(el, strH, &arrow[A_K_HO].fun, arrow[A_K_HO].type); key_add(el, strF, &arrow[A_K_EN].fun, arrow[A_K_EN].type); key_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type); key_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type); key_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type); key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type); key_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type); key_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type); if (el->el_map.type == MAP_VI) { key_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type); key_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type); key_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type); key_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type); key_add(el, &strH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type); key_add(el, &strF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type); key_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type); key_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type); key_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type); key_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type); key_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type); key_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type); } } /* term_set_arrow(): * Set an arrow key binding */ protected int term_set_arrow(EditLine *el, const char *name, key_value_t *fun, int type) { fkey_t *arrow = el->el_term.t_fkey; int i; for (i = 0; i < A_K_NKEYS; i++) if (strcmp(name, arrow[i].name) == 0) { arrow[i].fun = *fun; arrow[i].type = type; return (0); } return (-1); } /* term_clear_arrow(): * Clear an arrow key binding */ protected int term_clear_arrow(EditLine *el, const char *name) { fkey_t *arrow = el->el_term.t_fkey; int i; for (i = 0; i < A_K_NKEYS; i++) if (strcmp(name, arrow[i].name) == 0) { arrow[i].type = XK_NOD; return (0); } return (-1); } /* term_print_arrow(): * Print the arrow key bindings */ protected void term_print_arrow(EditLine *el, const char *name) { int i; fkey_t *arrow = el->el_term.t_fkey; for (i = 0; i < A_K_NKEYS; i++) if (*name == '\0' || strcmp(name, arrow[i].name) == 0) if (arrow[i].type != XK_NOD) key_kprint(el, arrow[i].name, &arrow[i].fun, arrow[i].type); } /* term_bind_arrow(): * Bind the arrow keys */ protected void term_bind_arrow(EditLine *el) { el_action_t *map; const el_action_t *dmap; int i, j; char *p; fkey_t *arrow = el->el_term.t_fkey; /* Check if the components needed are initialized */ if (el->el_term.t_buf == NULL || el->el_map.key == NULL) return; map = el->el_map.type == MAP_VI ? el->el_map.alt : el->el_map.key; dmap = el->el_map.type == MAP_VI ? el->el_map.vic : el->el_map.emacs; term_reset_arrow(el); for (i = 0; i < A_K_NKEYS; i++) { p = el->el_term.t_str[arrow[i].key]; if (p && *p) { j = (unsigned char) *p; /* * Assign the arrow keys only if: * * 1. They are multi-character arrow keys and the user * has not re-assigned the leading character, or * has re-assigned the leading character to be * ED_SEQUENCE_LEAD_IN * 2. They are single arrow keys pointing to an * unassigned key. */ if (arrow[i].type == XK_NOD) key_clear(el, map, p); else { if (p[1] && (dmap[j] == map[j] || map[j] == ED_SEQUENCE_LEAD_IN)) { key_add(el, p, &arrow[i].fun, arrow[i].type); map[j] = ED_SEQUENCE_LEAD_IN; } else if (map[j] == ED_UNASSIGNED) { key_clear(el, map, p); if (arrow[i].type == XK_CMD) map[j] = arrow[i].fun.cmd; else key_add(el, p, &arrow[i].fun, arrow[i].type); } } } } } /* term__putc(): * Add a character */ protected int term__putc(int c) { return (fputc(c, term_outfile)); } /* term__flush(): * Flush output */ protected void term__flush(void) { (void) fflush(term_outfile); } /* term_telltc(): * Print the current termcap characteristics */ protected int /*ARGSUSED*/ term_telltc(EditLine *el, int argc __attribute__((__unused__)), const char **argv __attribute__((__unused__))) { const struct termcapstr *t; char **ts; char upbuf[EL_BUFSIZ]; (void) fprintf(el->el_outfile, "\n\tYour terminal has the\n"); (void) fprintf(el->el_outfile, "\tfollowing characteristics:\n\n"); (void) fprintf(el->el_outfile, "\tIt has %d columns and %d lines\n", Val(T_co), Val(T_li)); (void) fprintf(el->el_outfile, "\tIt has %s meta key\n", EL_HAS_META ? "a" : "no"); (void) fprintf(el->el_outfile, "\tIt can%suse tabs\n", EL_CAN_TAB ? " " : "not "); (void) fprintf(el->el_outfile, "\tIt %s automatic margins\n", EL_HAS_AUTO_MARGINS ? "has" : "does not have"); if (EL_HAS_AUTO_MARGINS) (void) fprintf(el->el_outfile, "\tIt %s magic margins\n", EL_HAS_MAGIC_MARGINS ? "has" : "does not have"); for (t = tstr, ts = el->el_term.t_str; t->name != NULL; t++, ts++) (void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n", t->long_name, t->name, *ts && **ts ? key__decode_str(*ts, upbuf, "") : "(empty)"); (void) fputc('\n', el->el_outfile); return (0); } /* term_settc(): * Change the current terminal characteristics */ protected int /*ARGSUSED*/ term_settc(EditLine *el, int argc __attribute__((__unused__)), const char **argv) { const struct termcapstr *ts; const struct termcapval *tv; const char *what, *how; if (argv == NULL || argv[1] == NULL || argv[2] == NULL) return (-1); what = argv[1]; how = argv[2]; /* * Do the strings first */ for (ts = tstr; ts->name != NULL; ts++) if (strcmp(ts->name, what) == 0) break; if (ts->name != NULL) { term_alloc(el, ts, how); term_setflags(el); return (0); } /* * Do the numeric ones second */ for (tv = tval; tv->name != NULL; tv++) if (strcmp(tv->name, what) == 0) break; if (tv->name != NULL) { if (tv == &tval[T_pt] || tv == &tval[T_km] || tv == &tval[T_am] || tv == &tval[T_xn]) { if (strcmp(how, "yes") == 0) el->el_term.t_val[tv - tval] = 1; else if (strcmp(how, "no") == 0) el->el_term.t_val[tv - tval] = 0; else { (void) fprintf(el->el_errfile, "settc: Bad value `%s'.\n", how); return (-1); } term_setflags(el); if (term_change_size(el, Val(T_li), Val(T_co)) == -1) return (-1); return (0); } else { long i; char *ep; i = strtol(how, &ep, 10); if (*ep != '\0') { (void) fprintf(el->el_errfile, "settc: Bad value `%s'.\n", how); return (-1); } el->el_term.t_val[tv - tval] = (int) i; el->el_term.t_size.v = Val(T_co); el->el_term.t_size.h = Val(T_li); if (tv == &tval[T_co] || tv == &tval[T_li]) if (term_change_size(el, Val(T_li), Val(T_co)) == -1) return (-1); return (0); } } return (-1); } /* term_echotc(): * Print the termcap string out with variable substitution */ protected int /*ARGSUSED*/ term_echotc(EditLine *el, int argc __attribute__((__unused__)), const char **argv) { char *cap, *scap, *ep; int arg_need, arg_cols, arg_rows; int verbose = 0, silent = 0; char *area; static const char fmts[] = "%s\n", fmtd[] = "%d\n"; const struct termcapstr *t; char buf[TC_BUFSIZE]; long i; area = buf; if (argv == NULL || argv[1] == NULL) return (-1); argv++; if (argv[0][0] == '-') { switch (argv[0][1]) { case 'v': verbose = 1; break; case 's': silent = 1; break; default: /* stderror(ERR_NAME | ERR_TCUSAGE); */ break; } argv++; } if (!*argv || *argv[0] == '\0') return (0); if (strcmp(*argv, "tabs") == 0) { (void) fprintf(el->el_outfile, fmts, EL_CAN_TAB ? "yes" : "no"); return (0); } else if (strcmp(*argv, "meta") == 0) { (void) fprintf(el->el_outfile, fmts, Val(T_km) ? "yes" : "no"); return (0); } else if (strcmp(*argv, "xn") == 0) { (void) fprintf(el->el_outfile, fmts, EL_HAS_MAGIC_MARGINS ? "yes" : "no"); return (0); } else if (strcmp(*argv, "am") == 0) { (void) fprintf(el->el_outfile, fmts, EL_HAS_AUTO_MARGINS ? "yes" : "no"); return (0); } else if (strcmp(*argv, "baud") == 0) { #ifdef notdef int i; for (i = 0; baud_rate[i].b_name != NULL; i++) if (el->el_tty.t_speed == baud_rate[i].b_rate) { (void) fprintf(el->el_outfile, fmts, baud_rate[i].b_name); return (0); } (void) fprintf(el->el_outfile, fmtd, 0); #else (void) fprintf(el->el_outfile, fmtd, (int)el->el_tty.t_speed); #endif return (0); } else if (strcmp(*argv, "rows") == 0 || strcmp(*argv, "lines") == 0) { (void) fprintf(el->el_outfile, fmtd, Val(T_li)); return (0); } else if (strcmp(*argv, "cols") == 0) { (void) fprintf(el->el_outfile, fmtd, Val(T_co)); return (0); } /* * Try to use our local definition first */ scap = NULL; for (t = tstr; t->name != NULL; t++) if (strcmp(t->name, *argv) == 0) { scap = el->el_term.t_str[t - tstr]; break; } if (t->name == NULL) { /* XXX: some systems' tgetstr needs non const */ scap = tgetstr(strchr(*argv, **argv), &area); } if (!scap || scap[0] == '\0') { if (!silent) (void) fprintf(el->el_errfile, "echotc: Termcap parameter `%s' not found.\n", *argv); return (-1); } /* * Count home many values we need for this capability. */ for (cap = scap, arg_need = 0; *cap; cap++) if (*cap == '%') switch (*++cap) { case 'd': case '2': case '3': case '.': case '+': arg_need++; break; case '%': case '>': case 'i': case 'r': case 'n': case 'B': case 'D': break; default: /* * hpux has lot's of them... */ if (verbose) (void) fprintf(el->el_errfile, "echotc: Warning: unknown termcap %% `%c'.\n", *cap); /* This is bad, but I won't complain */ break; } switch (arg_need) { case 0: argv++; if (*argv && *argv[0]) { if (!silent) (void) fprintf(el->el_errfile, "echotc: Warning: Extra argument `%s'.\n", *argv); return (-1); } (void) tputs(scap, 1, term__putc); break; case 1: argv++; if (!*argv || *argv[0] == '\0') { if (!silent) (void) fprintf(el->el_errfile, "echotc: Warning: Missing argument.\n"); return (-1); } arg_cols = 0; i = strtol(*argv, &ep, 10); if (*ep != '\0' || i < 0) { if (!silent) (void) fprintf(el->el_errfile, "echotc: Bad value `%s' for rows.\n", *argv); return (-1); } arg_rows = (int) i; argv++; if (*argv && *argv[0]) { if (!silent) (void) fprintf(el->el_errfile, "echotc: Warning: Extra argument `%s'.\n", *argv); return (-1); } (void) tputs(tgoto(scap, arg_cols, arg_rows), 1, term__putc); break; default: /* This is wrong, but I will ignore it... */ if (verbose) (void) fprintf(el->el_errfile, "echotc: Warning: Too many required arguments (%d).\n", arg_need); /* FALLTHROUGH */ case 2: argv++; if (!*argv || *argv[0] == '\0') { if (!silent) (void) fprintf(el->el_errfile, "echotc: Warning: Missing argument.\n"); return (-1); } i = strtol(*argv, &ep, 10); if (*ep != '\0' || i < 0) { if (!silent) (void) fprintf(el->el_errfile, "echotc: Bad value `%s' for cols.\n", *argv); return (-1); } arg_cols = (int) i; argv++; if (!*argv || *argv[0] == '\0') { if (!silent) (void) fprintf(el->el_errfile, "echotc: Warning: Missing argument.\n"); return (-1); } i = strtol(*argv, &ep, 10); if (*ep != '\0' || i < 0) { if (!silent) (void) fprintf(el->el_errfile, "echotc: Bad value `%s' for rows.\n", *argv); return (-1); } arg_rows = (int) i; if (*ep != '\0') { if (!silent) (void) fprintf(el->el_errfile, "echotc: Bad value `%s'.\n", *argv); return (-1); } argv++; if (*argv && *argv[0]) { if (!silent) (void) fprintf(el->el_errfile, "echotc: Warning: Extra argument `%s'.\n", *argv); return (-1); } (void) tputs(tgoto(scap, arg_cols, arg_rows), arg_rows, term__putc); break; } return (0); } openipmi-2.0.18/libedit/emacs.c0000644000175000017500000003030010373140634015243 0ustar chuckchuck/* $NetBSD: emacs.c,v 1.20 2005/08/08 14:05:37 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: emacs.c,v 1.20 2005/08/08 14:05:37 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * emacs.c: Emacs functions */ #include "el.h" /* em_delete_or_list(): * Delete character under cursor or list completions if at end of line * [^D] */ protected el_action_t /*ARGSUSED*/ em_delete_or_list(EditLine *el, int c __attribute__((__unused__))) { if (el->el_line.cursor == el->el_line.lastchar) { /* if I'm at the end */ if (el->el_line.cursor == el->el_line.buffer) { /* and the beginning */ term_overwrite(el, STReof, 4); /* then do an EOF */ term__flush(); return (CC_EOF); } else { /* * Here we could list completions, but it is an * error right now */ term_beep(el); return (CC_ERROR); } } else { if (el->el_state.doingarg) c_delafter(el, el->el_state.argument); else c_delafter1(el); if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; /* bounds check */ return (CC_REFRESH); } } /* em_delete_next_word(): * Cut from cursor to end of current word * [M-d] */ protected el_action_t /*ARGSUSED*/ em_delete_next_word(EditLine *el, int c __attribute__((__unused__))) { char *cp, *p, *kp; if (el->el_line.cursor == el->el_line.lastchar) return (CC_ERROR); cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (p = el->el_line.cursor, kp = el->el_chared.c_kill.buf; p < cp; p++) /* save the text */ *kp++ = *p; el->el_chared.c_kill.last = kp; c_delafter(el, cp - el->el_line.cursor); /* delete after dot */ if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; /* bounds check */ return (CC_REFRESH); } /* em_yank(): * Paste cut buffer at cursor position * [^Y] */ protected el_action_t /*ARGSUSED*/ em_yank(EditLine *el, int c __attribute__((__unused__))) { char *kp, *cp; if (el->el_chared.c_kill.last == el->el_chared.c_kill.buf) return (CC_NORM); if (el->el_line.lastchar + (el->el_chared.c_kill.last - el->el_chared.c_kill.buf) >= el->el_line.limit) return (CC_ERROR); el->el_chared.c_kill.mark = el->el_line.cursor; cp = el->el_line.cursor; /* open the space, */ c_insert(el, el->el_chared.c_kill.last - el->el_chared.c_kill.buf); /* copy the chars */ for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++) *cp++ = *kp; /* if an arg, cursor at beginning else cursor at end */ if (el->el_state.argument == 1) el->el_line.cursor = cp; return (CC_REFRESH); } /* em_kill_line(): * Cut the entire line and save in cut buffer * [^U] */ protected el_action_t /*ARGSUSED*/ em_kill_line(EditLine *el, int c __attribute__((__unused__))) { char *kp, *cp; cp = el->el_line.buffer; kp = el->el_chared.c_kill.buf; while (cp < el->el_line.lastchar) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; /* zap! -- delete all of it */ el->el_line.lastchar = el->el_line.buffer; el->el_line.cursor = el->el_line.buffer; return (CC_REFRESH); } /* em_kill_region(): * Cut area between mark and cursor and save in cut buffer * [^W] */ protected el_action_t /*ARGSUSED*/ em_kill_region(EditLine *el, int c __attribute__((__unused__))) { char *kp, *cp; if (!el->el_chared.c_kill.mark) return (CC_ERROR); if (el->el_chared.c_kill.mark > el->el_line.cursor) { cp = el->el_line.cursor; kp = el->el_chared.c_kill.buf; while (cp < el->el_chared.c_kill.mark) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; c_delafter(el, cp - el->el_line.cursor); } else { /* mark is before cursor */ cp = el->el_chared.c_kill.mark; kp = el->el_chared.c_kill.buf; while (cp < el->el_line.cursor) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; c_delbefore(el, cp - el->el_chared.c_kill.mark); el->el_line.cursor = el->el_chared.c_kill.mark; } return (CC_REFRESH); } /* em_copy_region(): * Copy area between mark and cursor to cut buffer * [M-W] */ protected el_action_t /*ARGSUSED*/ em_copy_region(EditLine *el, int c __attribute__((__unused__))) { char *kp, *cp; if (!el->el_chared.c_kill.mark) return (CC_ERROR); if (el->el_chared.c_kill.mark > el->el_line.cursor) { cp = el->el_line.cursor; kp = el->el_chared.c_kill.buf; while (cp < el->el_chared.c_kill.mark) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; } else { cp = el->el_chared.c_kill.mark; kp = el->el_chared.c_kill.buf; while (cp < el->el_line.cursor) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; } return (CC_NORM); } /* em_gosmacs_transpose(): * Exchange the two characters before the cursor * Gosling emacs transpose chars [^T] */ protected el_action_t em_gosmacs_transpose(EditLine *el, int c) { if (el->el_line.cursor > &el->el_line.buffer[1]) { /* must have at least two chars entered */ c = el->el_line.cursor[-2]; el->el_line.cursor[-2] = el->el_line.cursor[-1]; el->el_line.cursor[-1] = c; return (CC_REFRESH); } else return (CC_ERROR); } /* em_next_word(): * Move next to end of current word * [M-f] */ protected el_action_t /*ARGSUSED*/ em_next_word(EditLine *el, int c __attribute__((__unused__))) { if (el->el_line.cursor == el->el_line.lastchar) return (CC_ERROR); el->el_line.cursor = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); if (el->el_map.type == MAP_VI) if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); } return (CC_CURSOR); } /* em_upper_case(): * Uppercase the characters from cursor to end of current word * [M-u] */ protected el_action_t /*ARGSUSED*/ em_upper_case(EditLine *el, int c __attribute__((__unused__))) { char *cp, *ep; ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (cp = el->el_line.cursor; cp < ep; cp++) if (islower((unsigned char)*cp)) *cp = toupper((unsigned char)*cp); el->el_line.cursor = ep; if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; return (CC_REFRESH); } /* em_capitol_case(): * Capitalize the characters from cursor to end of current word * [M-c] */ protected el_action_t /*ARGSUSED*/ em_capitol_case(EditLine *el, int c __attribute__((__unused__))) { char *cp, *ep; ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (cp = el->el_line.cursor; cp < ep; cp++) { if (isalpha((unsigned char)*cp)) { if (islower((unsigned char)*cp)) *cp = toupper((unsigned char)*cp); cp++; break; } } for (; cp < ep; cp++) if (isupper((unsigned char)*cp)) *cp = tolower((unsigned char)*cp); el->el_line.cursor = ep; if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; return (CC_REFRESH); } /* em_lower_case(): * Lowercase the characters from cursor to end of current word * [M-l] */ protected el_action_t /*ARGSUSED*/ em_lower_case(EditLine *el, int c __attribute__((__unused__))) { char *cp, *ep; ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (cp = el->el_line.cursor; cp < ep; cp++) if (isupper((unsigned char)*cp)) *cp = tolower((unsigned char)*cp); el->el_line.cursor = ep; if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; return (CC_REFRESH); } /* em_set_mark(): * Set the mark at cursor * [^@] */ protected el_action_t /*ARGSUSED*/ em_set_mark(EditLine *el, int c __attribute__((__unused__))) { el->el_chared.c_kill.mark = el->el_line.cursor; return (CC_NORM); } /* em_exchange_mark(): * Exchange the cursor and mark * [^X^X] */ protected el_action_t /*ARGSUSED*/ em_exchange_mark(EditLine *el, int c __attribute__((__unused__))) { char *cp; cp = el->el_line.cursor; el->el_line.cursor = el->el_chared.c_kill.mark; el->el_chared.c_kill.mark = cp; return (CC_CURSOR); } /* em_universal_argument(): * Universal argument (argument times 4) * [^U] */ protected el_action_t /*ARGSUSED*/ em_universal_argument(EditLine *el, int c __attribute__((__unused__))) { /* multiply current argument by 4 */ if (el->el_state.argument > 1000000) return (CC_ERROR); el->el_state.doingarg = 1; el->el_state.argument *= 4; return (CC_ARGHACK); } /* em_meta_next(): * Add 8th bit to next character typed * [] */ protected el_action_t /*ARGSUSED*/ em_meta_next(EditLine *el, int c __attribute__((__unused__))) { el->el_state.metanext = 1; return (CC_ARGHACK); } /* em_toggle_overwrite(): * Switch from insert to overwrite mode or vice versa */ protected el_action_t /*ARGSUSED*/ em_toggle_overwrite(EditLine *el, int c __attribute__((__unused__))) { el->el_state.inputmode = (el->el_state.inputmode == MODE_INSERT) ? MODE_REPLACE : MODE_INSERT; return (CC_NORM); } /* em_copy_prev_word(): * Copy current word to cursor */ protected el_action_t /*ARGSUSED*/ em_copy_prev_word(EditLine *el, int c __attribute__((__unused__))) { char *cp, *oldc, *dp; if (el->el_line.cursor == el->el_line.buffer) return (CC_ERROR); oldc = el->el_line.cursor; /* does a bounds check */ cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, el->el_state.argument, ce__isword); c_insert(el, oldc - cp); for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++) *dp++ = *cp; el->el_line.cursor = dp;/* put cursor at end */ return (CC_REFRESH); } /* em_inc_search_next(): * Emacs incremental next search */ protected el_action_t /*ARGSUSED*/ em_inc_search_next(EditLine *el, int c __attribute__((__unused__))) { el->el_search.patlen = 0; return (ce_inc_search(el, ED_SEARCH_NEXT_HISTORY)); } /* em_inc_search_prev(): * Emacs incremental reverse search */ protected el_action_t /*ARGSUSED*/ em_inc_search_prev(EditLine *el, int c __attribute__((__unused__))) { el->el_search.patlen = 0; return (ce_inc_search(el, ED_SEARCH_PREV_HISTORY)); } /* em_delete_prev_char(): * Delete the character to the left of the cursor * [^?] */ protected el_action_t /*ARGSUSED*/ em_delete_prev_char(EditLine *el, int c __attribute__((__unused__))) { if (el->el_line.cursor <= el->el_line.buffer) return (CC_ERROR); if (el->el_state.doingarg) c_delbefore(el, el->el_state.argument); else c_delbefore1(el); el->el_line.cursor -= el->el_state.argument; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; return (CC_REFRESH); } openipmi-2.0.18/libedit/parse.h0000644000175000017500000000410510373140634015276 0ustar chuckchuck/* $NetBSD: parse.h,v 1.6 2005/05/29 04:58:15 lukem Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)parse.h 8.1 (Berkeley) 6/4/93 */ /* * el.parse.h: Parser functions */ #ifndef _h_el_parse #define _h_el_parse protected int parse_line(EditLine *, const char *); protected int parse__escape(const char **); protected char *parse__string(char *, const char *); protected int parse_cmd(EditLine *, const char *); #endif /* _h_el_parse */ openipmi-2.0.18/libedit/sys.h0000644000175000017500000001050310373140634015001 0ustar chuckchuck/* $NetBSD: sys.h,v 1.9 2004/01/17 17:57:40 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)sys.h 8.1 (Berkeley) 6/4/93 */ /* * sys.h: Put all the stupid compiler and system dependencies here... */ #ifndef _h_sys #define _h_sys #include #ifdef HAVE_SYS_CDEFS_H #include #endif #if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8) # define __attribute__(A) #endif #ifndef __P # define __P(x) x #endif #ifndef _DIAGASSERT # define _DIAGASSERT(x) #endif #ifndef __BEGIN_DECLS # ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # define __END_DECLS } # else # define __BEGIN_DECLS # define __END_DECLS # endif #endif #ifndef public # define public /* Externally visible functions/variables */ #endif #ifndef private # define private static /* Always hidden internals */ #endif #ifndef protected # define protected /* Redefined from elsewhere to "static" */ /* When we want to hide everything */ #endif #ifndef HAVE_U_INT32_T typedef unsigned int u_int32_t; #endif #ifndef _PTR_T # define _PTR_T typedef void *ptr_t; #endif #ifndef _IOCTL_T # define _IOCTL_T typedef void *ioctl_t; #endif #include #ifndef HAVE_STRLCAT #define strlcat libedit_strlcat size_t strlcat(char *dst, const char *src, size_t size); #endif #ifndef HAVE_STRLCPY #define strlcpy libedit_strlcpy size_t strlcpy(char *dst, const char *src, size_t size); #endif #ifndef HAVE_FGETLN #define fgetln libedit_fgetln char *fgetln(FILE *fp, size_t *len); #endif #define REGEX /* Use POSIX.2 regular expression functions */ #undef REGEXP /* Use UNIX V8 regular expression functions */ #ifdef notdef # undef REGEX # undef REGEXP # include # ifdef __GNUC__ /* * Broken hdrs. */ extern int tgetent(const char *bp, char *name); extern int tgetflag(const char *id); extern int tgetnum(const char *id); extern char *tgetstr(const char *id, char **area); extern char *tgoto(const char *cap, int col, int row); extern int tputs(const char *str, int affcnt, int (*putc)(int)); extern char *getenv(const char *); extern int fprintf(FILE *, const char *, ...); extern int sigsetmask(int); extern int sigblock(int); extern int fputc(int, FILE *); extern int fgetc(FILE *); extern int fflush(FILE *); extern int tolower(int); extern int toupper(int); extern int errno, sys_nerr; extern char *sys_errlist[]; extern void perror(const char *); # include # define strerror(e) sys_errlist[e] # endif # ifdef SABER extern ptr_t memcpy(ptr_t, const ptr_t, size_t); extern ptr_t memset(ptr_t, int, size_t); # endif extern char *fgetline(FILE *, int *); #endif #define SCCSID #undef LIBC_SCCS #endif /* _h_sys */ openipmi-2.0.18/libedit/search.c0000644000175000017500000003553010373140634015432 0ustar chuckchuck/* $NetBSD: search.c,v 1.20 2004/11/04 01:16:03 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: search.c,v 1.20 2004/11/04 01:16:03 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * search.c: History and character search functions */ #include #include #if defined(REGEX) #include #elif defined(REGEXP) #include #endif #include "el.h" /* * Adjust cursor in vi mode to include the character under it */ #define EL_CURSOR(el) \ ((el)->el_line.cursor + (((el)->el_map.type == MAP_VI) && \ ((el)->el_map.current == (el)->el_map.alt))) /* search_init(): * Initialize the search stuff */ protected int search_init(EditLine *el) { el->el_search.patbuf = (char *) el_malloc(EL_BUFSIZ); if (el->el_search.patbuf == NULL) return (-1); el->el_search.patlen = 0; el->el_search.patdir = -1; el->el_search.chacha = '\0'; el->el_search.chadir = CHAR_FWD; el->el_search.chatflg = 0; return (0); } /* search_end(): * Initialize the search stuff */ protected void search_end(EditLine *el) { el_free((ptr_t) el->el_search.patbuf); el->el_search.patbuf = NULL; } #ifdef REGEXP /* regerror(): * Handle regular expression errors */ public void /*ARGSUSED*/ regerror(const char *msg) { } #endif /* el_match(): * Return if string matches pattern */ protected int el_match(const char *str, const char *pat) { #if defined (REGEX) regex_t re; int rv; #elif defined (REGEXP) regexp *rp; int rv; #else extern char *re_comp(const char *); extern int re_exec(const char *); #endif if (strstr(str, pat) != NULL) return (1); #if defined(REGEX) if (regcomp(&re, pat, 0) == 0) { rv = regexec(&re, str, 0, NULL, 0) == 0; regfree(&re); } else { rv = 0; } return (rv); #elif defined(REGEXP) if ((re = regcomp(pat)) != NULL) { rv = regexec(re, str); free((ptr_t) re); } else { rv = 0; } return (rv); #else if (re_comp(pat) != NULL) return (0); else return (re_exec(str) == 1); #endif } /* c_hmatch(): * return True if the pattern matches the prefix */ protected int c_hmatch(EditLine *el, const char *str) { #ifdef SDEBUG (void) fprintf(el->el_errfile, "match `%s' with `%s'\n", el->el_search.patbuf, str); #endif /* SDEBUG */ return (el_match(str, el->el_search.patbuf)); } /* c_setpat(): * Set the history seatch pattern */ protected void c_setpat(EditLine *el) { if (el->el_state.lastcmd != ED_SEARCH_PREV_HISTORY && el->el_state.lastcmd != ED_SEARCH_NEXT_HISTORY) { el->el_search.patlen = EL_CURSOR(el) - el->el_line.buffer; if (el->el_search.patlen >= EL_BUFSIZ) el->el_search.patlen = EL_BUFSIZ - 1; if (el->el_search.patlen != 0) { (void) strncpy(el->el_search.patbuf, el->el_line.buffer, el->el_search.patlen); el->el_search.patbuf[el->el_search.patlen] = '\0'; } else el->el_search.patlen = strlen(el->el_search.patbuf); } #ifdef SDEBUG (void) fprintf(el->el_errfile, "\neventno = %d\n", el->el_history.eventno); (void) fprintf(el->el_errfile, "patlen = %d\n", el->el_search.patlen); (void) fprintf(el->el_errfile, "patbuf = \"%s\"\n", el->el_search.patbuf); (void) fprintf(el->el_errfile, "cursor %d lastchar %d\n", EL_CURSOR(el) - el->el_line.buffer, el->el_line.lastchar - el->el_line.buffer); #endif } /* ce_inc_search(): * Emacs incremental search */ protected el_action_t ce_inc_search(EditLine *el, int dir) { static const char STRfwd[] = {'f', 'w', 'd', '\0'}, STRbck[] = {'b', 'c', 'k', '\0'}; static char pchar = ':';/* ':' = normal, '?' = failed */ static char endcmd[2] = {'\0', '\0'}; char ch, *ocursor = el->el_line.cursor, oldpchar = pchar; const char *cp; el_action_t ret = CC_NORM; int ohisteventno = el->el_history.eventno; int oldpatlen = el->el_search.patlen; int newdir = dir; int done, redo; if (el->el_line.lastchar + sizeof(STRfwd) / sizeof(char) + 2 + el->el_search.patlen >= el->el_line.limit) return (CC_ERROR); for (;;) { if (el->el_search.patlen == 0) { /* first round */ pchar = ':'; #ifdef ANCHOR #define LEN 2 el->el_search.patbuf[el->el_search.patlen++] = '.'; el->el_search.patbuf[el->el_search.patlen++] = '*'; #else #define LEN 0 #endif } done = redo = 0; *el->el_line.lastchar++ = '\n'; for (cp = (newdir == ED_SEARCH_PREV_HISTORY) ? STRbck : STRfwd; *cp; *el->el_line.lastchar++ = *cp++) continue; *el->el_line.lastchar++ = pchar; for (cp = &el->el_search.patbuf[LEN]; cp < &el->el_search.patbuf[el->el_search.patlen]; *el->el_line.lastchar++ = *cp++) continue; *el->el_line.lastchar = '\0'; re_refresh(el); if (el_getc(el, &ch) != 1) return (ed_end_of_file(el, 0)); switch (el->el_map.current[(unsigned char) ch]) { case ED_INSERT: case ED_DIGIT: if (el->el_search.patlen >= EL_BUFSIZ - LEN) term_beep(el); else { el->el_search.patbuf[el->el_search.patlen++] = ch; *el->el_line.lastchar++ = ch; *el->el_line.lastchar = '\0'; re_refresh(el); } break; case EM_INC_SEARCH_NEXT: newdir = ED_SEARCH_NEXT_HISTORY; redo++; break; case EM_INC_SEARCH_PREV: newdir = ED_SEARCH_PREV_HISTORY; redo++; break; case EM_DELETE_PREV_CHAR: case ED_DELETE_PREV_CHAR: if (el->el_search.patlen > LEN) done++; else term_beep(el); break; default: switch (ch) { case 0007: /* ^G: Abort */ ret = CC_ERROR; done++; break; case 0027: /* ^W: Append word */ /* No can do if globbing characters in pattern */ for (cp = &el->el_search.patbuf[LEN];; cp++) if (cp >= &el->el_search.patbuf[ el->el_search.patlen]) { el->el_line.cursor += el->el_search.patlen - LEN - 1; cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, 1, ce__isword); while (el->el_line.cursor < cp && *el->el_line.cursor != '\n') { if (el->el_search.patlen >= EL_BUFSIZ - LEN) { term_beep(el); break; } el->el_search.patbuf[el->el_search.patlen++] = *el->el_line.cursor; *el->el_line.lastchar++ = *el->el_line.cursor++; } el->el_line.cursor = ocursor; *el->el_line.lastchar = '\0'; re_refresh(el); break; } else if (isglob(*cp)) { term_beep(el); break; } break; default: /* Terminate and execute cmd */ endcmd[0] = ch; el_push(el, endcmd); /* FALLTHROUGH */ case 0033: /* ESC: Terminate */ ret = CC_REFRESH; done++; break; } break; } while (el->el_line.lastchar > el->el_line.buffer && *el->el_line.lastchar != '\n') *el->el_line.lastchar-- = '\0'; *el->el_line.lastchar = '\0'; if (!done) { /* Can't search if unmatched '[' */ for (cp = &el->el_search.patbuf[el->el_search.patlen-1], ch = ']'; cp >= &el->el_search.patbuf[LEN]; cp--) if (*cp == '[' || *cp == ']') { ch = *cp; break; } if (el->el_search.patlen > LEN && ch != '[') { if (redo && newdir == dir) { if (pchar == '?') { /* wrap around */ el->el_history.eventno = newdir == ED_SEARCH_PREV_HISTORY ? 0 : 0x7fffffff; if (hist_get(el) == CC_ERROR) /* el->el_history.event * no was fixed by * first call */ (void) hist_get(el); el->el_line.cursor = newdir == ED_SEARCH_PREV_HISTORY ? el->el_line.lastchar : el->el_line.buffer; } else el->el_line.cursor += newdir == ED_SEARCH_PREV_HISTORY ? -1 : 1; } #ifdef ANCHOR el->el_search.patbuf[el->el_search.patlen++] = '.'; el->el_search.patbuf[el->el_search.patlen++] = '*'; #endif el->el_search.patbuf[el->el_search.patlen] = '\0'; if (el->el_line.cursor < el->el_line.buffer || el->el_line.cursor > el->el_line.lastchar || (ret = ce_search_line(el, newdir)) == CC_ERROR) { /* avoid c_setpat */ el->el_state.lastcmd = (el_action_t) newdir; ret = newdir == ED_SEARCH_PREV_HISTORY ? ed_search_prev_history(el, 0) : ed_search_next_history(el, 0); if (ret != CC_ERROR) { el->el_line.cursor = newdir == ED_SEARCH_PREV_HISTORY ? el->el_line.lastchar : el->el_line.buffer; (void) ce_search_line(el, newdir); } } el->el_search.patlen -= LEN; el->el_search.patbuf[el->el_search.patlen] = '\0'; if (ret == CC_ERROR) { term_beep(el); if (el->el_history.eventno != ohisteventno) { el->el_history.eventno = ohisteventno; if (hist_get(el) == CC_ERROR) return (CC_ERROR); } el->el_line.cursor = ocursor; pchar = '?'; } else { pchar = ':'; } } ret = ce_inc_search(el, newdir); if (ret == CC_ERROR && pchar == '?' && oldpchar == ':') /* * break abort of failed search at last * non-failed */ ret = CC_NORM; } if (ret == CC_NORM || (ret == CC_ERROR && oldpatlen == 0)) { /* restore on normal return or error exit */ pchar = oldpchar; el->el_search.patlen = oldpatlen; if (el->el_history.eventno != ohisteventno) { el->el_history.eventno = ohisteventno; if (hist_get(el) == CC_ERROR) return (CC_ERROR); } el->el_line.cursor = ocursor; if (ret == CC_ERROR) re_refresh(el); } if (done || ret != CC_NORM) return (ret); } } /* cv_search(): * Vi search. */ protected el_action_t cv_search(EditLine *el, int dir) { char ch; char tmpbuf[EL_BUFSIZ]; int tmplen; #ifdef ANCHOR tmpbuf[0] = '.'; tmpbuf[1] = '*'; #endif tmplen = LEN; el->el_search.patdir = dir; tmplen = c_gets(el, &tmpbuf[LEN], dir == ED_SEARCH_PREV_HISTORY ? "\n/" : "\n?" ); if (tmplen == -1) return CC_REFRESH; tmplen += LEN; ch = tmpbuf[tmplen]; tmpbuf[tmplen] = '\0'; if (tmplen == LEN) { /* * Use the old pattern, but wild-card it. */ if (el->el_search.patlen == 0) { re_refresh(el); return (CC_ERROR); } #ifdef ANCHOR if (el->el_search.patbuf[0] != '.' && el->el_search.patbuf[0] != '*') { (void) strncpy(tmpbuf, el->el_search.patbuf, sizeof(tmpbuf) - 1); el->el_search.patbuf[0] = '.'; el->el_search.patbuf[1] = '*'; (void) strncpy(&el->el_search.patbuf[2], tmpbuf, EL_BUFSIZ - 3); el->el_search.patlen++; el->el_search.patbuf[el->el_search.patlen++] = '.'; el->el_search.patbuf[el->el_search.patlen++] = '*'; el->el_search.patbuf[el->el_search.patlen] = '\0'; } #endif } else { #ifdef ANCHOR tmpbuf[tmplen++] = '.'; tmpbuf[tmplen++] = '*'; #endif tmpbuf[tmplen] = '\0'; (void) strncpy(el->el_search.patbuf, tmpbuf, EL_BUFSIZ - 1); el->el_search.patlen = tmplen; } el->el_state.lastcmd = (el_action_t) dir; /* avoid c_setpat */ el->el_line.cursor = el->el_line.lastchar = el->el_line.buffer; if ((dir == ED_SEARCH_PREV_HISTORY ? ed_search_prev_history(el, 0) : ed_search_next_history(el, 0)) == CC_ERROR) { re_refresh(el); return (CC_ERROR); } if (ch == 0033) { re_refresh(el); return ed_newline(el, 0); } return (CC_REFRESH); } /* ce_search_line(): * Look for a pattern inside a line */ protected el_action_t ce_search_line(EditLine *el, int dir) { char *cp = el->el_line.cursor; char *pattern = el->el_search.patbuf; char oc, *ocp; #ifdef ANCHOR ocp = &pattern[1]; oc = *ocp; *ocp = '^'; #else ocp = pattern; oc = *ocp; #endif if (dir == ED_SEARCH_PREV_HISTORY) { for (; cp >= el->el_line.buffer; cp--) { if (el_match(cp, ocp)) { *ocp = oc; el->el_line.cursor = cp; return (CC_NORM); } } *ocp = oc; return (CC_ERROR); } else { for (; *cp != '\0' && cp < el->el_line.limit; cp++) { if (el_match(cp, ocp)) { *ocp = oc; el->el_line.cursor = cp; return (CC_NORM); } } *ocp = oc; return (CC_ERROR); } } /* cv_repeat_srch(): * Vi repeat search */ protected el_action_t cv_repeat_srch(EditLine *el, int c) { #ifdef SDEBUG (void) fprintf(el->el_errfile, "dir %d patlen %d patbuf %s\n", c, el->el_search.patlen, el->el_search.patbuf); #endif el->el_state.lastcmd = (el_action_t) c; /* Hack to stop c_setpat */ el->el_line.lastchar = el->el_line.buffer; switch (c) { case ED_SEARCH_NEXT_HISTORY: return (ed_search_next_history(el, 0)); case ED_SEARCH_PREV_HISTORY: return (ed_search_prev_history(el, 0)); default: return (CC_ERROR); } } /* cv_csearch(): * Vi character search */ protected el_action_t cv_csearch(EditLine *el, int direction, int ch, int count, int tflag) { char *cp; if (ch == 0) return CC_ERROR; if (ch == -1) { char c; if (el_getc(el, &c) != 1) return ed_end_of_file(el, 0); ch = c; } /* Save for ';' and ',' commands */ el->el_search.chacha = ch; el->el_search.chadir = direction; el->el_search.chatflg = tflag; cp = el->el_line.cursor; while (count--) { if (*cp == ch) cp += direction; for (;;cp += direction) { if (cp >= el->el_line.lastchar) return CC_ERROR; if (cp < el->el_line.buffer) return CC_ERROR; if (*cp == ch) break; } } if (tflag) cp -= direction; el->el_line.cursor = cp; if (el->el_chared.c_vcmd.action != NOP) { if (direction > 0) el->el_line.cursor++; cv_delfini(el); return CC_REFRESH; } return CC_CURSOR; } openipmi-2.0.18/libedit/histedit.h0000644000175000017500000001424110373140634016003 0ustar chuckchuck/* $NetBSD: histedit.h,v 1.28 2005/07/14 15:00:58 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)histedit.h 8.2 (Berkeley) 1/3/94 */ /* * histedit.h: Line editor and history interface. */ #ifndef _HISTEDIT_H_ #define _HISTEDIT_H_ #define LIBEDIT_MAJOR 2 #define LIBEDIT_MINOR 9 #include #include #ifdef __cplusplus extern "C" { #endif /* * ==== Editing ==== */ typedef struct editline EditLine; /* * For user-defined function interface */ typedef struct lineinfo { const char *buffer; const char *cursor; const char *lastchar; } LineInfo; /* * EditLine editor function return codes. * For user-defined function interface */ #define CC_NORM 0 #define CC_NEWLINE 1 #define CC_EOF 2 #define CC_ARGHACK 3 #define CC_REFRESH 4 #define CC_CURSOR 5 #define CC_ERROR 6 #define CC_FATAL 7 #define CC_REDISPLAY 8 #define CC_REFRESH_BEEP 9 /* * Initialization, cleanup, and resetting */ EditLine *el_init(const char *, FILE *, FILE *, FILE *); void el_end(EditLine *); void el_reset(EditLine *); /* * Get a line, a character or push a string back in the input queue */ const char *el_gets(EditLine *, int *); int el_getc(EditLine *, char *); void el_push(EditLine *, char *); /* * Beep! */ void el_beep(EditLine *); /* * High level function internals control * Parses argc, argv array and executes builtin editline commands */ int el_parse(EditLine *, int, const char **); /* * Low level editline access functions */ int el_set(EditLine *, int, ...); int el_get(EditLine *, int, void *); unsigned char _el_fn_complete(EditLine *, int); /* * el_set/el_get parameters */ #define EL_PROMPT 0 /* , el_pfunc_t); */ #define EL_TERMINAL 1 /* , const char *); */ #define EL_EDITOR 2 /* , const char *); */ #define EL_SIGNAL 3 /* , int); */ #define EL_BIND 4 /* , const char *, ..., NULL); */ #define EL_TELLTC 5 /* , const char *, ..., NULL); */ #define EL_SETTC 6 /* , const char *, ..., NULL); */ #define EL_ECHOTC 7 /* , const char *, ..., NULL); */ #define EL_SETTY 8 /* , const char *, ..., NULL); */ #define EL_ADDFN 9 /* , const char *, const char * */ /* , el_func_t); */ #define EL_HIST 10 /* , hist_fun_t, const char *); */ #define EL_EDITMODE 11 /* , int); */ #define EL_RPROMPT 12 /* , el_pfunc_t); */ #define EL_GETCFN 13 /* , el_rfunc_t); */ #define EL_CLIENTDATA 14 /* , void *); */ #define EL_UNBUFFERED 15 /* , int); */ #define EL_PREP_TERM 16 /* , int); */ #define EL_BUILTIN_GETCFN (NULL) /* * Source named file or $PWD/.editrc or $HOME/.editrc */ int el_source(EditLine *, const char *); /* * Must be called when the terminal changes size; If EL_SIGNAL * is set this is done automatically otherwise it is the responsibility * of the application */ void el_resize(EditLine *); /* * User-defined function interface. */ const LineInfo *el_line(EditLine *); int el_insertstr(EditLine *, const char *); void el_deletestr(EditLine *, int); /* * ==== History ==== */ typedef struct history History; typedef struct HistEvent { int num; const char *str; } HistEvent; /* * History access functions. */ History * history_init(void); void history_end(History *); int history(History *, HistEvent *, int, ...); #define H_FUNC 0 /* , UTSL */ #define H_SETSIZE 1 /* , const int); */ #define H_GETSIZE 2 /* , void); */ #define H_FIRST 3 /* , void); */ #define H_LAST 4 /* , void); */ #define H_PREV 5 /* , void); */ #define H_NEXT 6 /* , void); */ #define H_CURR 8 /* , const int); */ #define H_SET 7 /* , int); */ #define H_ADD 9 /* , const char *); */ #define H_ENTER 10 /* , const char *); */ #define H_APPEND 11 /* , const char *); */ #define H_END 12 /* , void); */ #define H_NEXT_STR 13 /* , const char *); */ #define H_PREV_STR 14 /* , const char *); */ #define H_NEXT_EVENT 15 /* , const int); */ #define H_PREV_EVENT 16 /* , const int); */ #define H_LOAD 17 /* , const char *); */ #define H_SAVE 18 /* , const char *); */ #define H_CLEAR 19 /* , void); */ #define H_SETUNIQUE 20 /* , int); */ #define H_GETUNIQUE 21 /* , void); */ #define H_DEL 22 /* , int); */ /* * ==== Tokenization ==== */ typedef struct tokenizer Tokenizer; /* * String tokenization functions, using simplified sh(1) quoting rules */ Tokenizer *tok_init(const char *); void tok_end(Tokenizer *); void tok_reset(Tokenizer *); int tok_line(Tokenizer *, const LineInfo *, int *, const char ***, int *, int *); int tok_str(Tokenizer *, const char *, int *, const char ***); #ifdef __cplusplus } #endif #endif /* _HISTEDIT_H_ */ openipmi-2.0.18/libedit/fgetln.c0000644000175000017500000000535010373140634015441 0ustar chuckchuck/* $NetBSD: fgetln.c,v 1.2 2003/12/10 01:30:27 lukem Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Christos Zoulas. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include "sys.h" #include #include #include #include #include char * fgetln(FILE *fp, size_t *len) { static char *buf = NULL; static size_t bufsiz = 0; char *ptr; if (buf == NULL) { bufsiz = BUFSIZ; if ((buf = malloc(bufsiz)) == NULL) return NULL; } if (fgets(buf, bufsiz, fp) == NULL) return NULL; *len = 0; while ((ptr = strchr(&buf[*len], '\n')) == NULL) { size_t nbufsiz = bufsiz + BUFSIZ; char *nbuf = realloc(buf, nbufsiz); if (nbuf == NULL) { int oerrno = errno; free(buf); errno = oerrno; buf = NULL; return NULL; } else buf = nbuf; *len = bufsiz; if (fgets(&buf[bufsiz], BUFSIZ, fp) == NULL) return buf; bufsiz = nbufsiz; } *len = (ptr - buf) + 1; return buf; } openipmi-2.0.18/libedit/unvis.c0000644000175000017500000001520210373140634015323 0ustar chuckchuck/* $NetBSD: unvis.c,v 1.28 2005/09/13 01:44:09 christos Exp $ */ /*- * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if defined(LIBC_SCCS) && !defined(lint) #if 0 static char sccsid[] = "@(#)unvis.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: unvis.c,v 1.28 2005/09/13 01:44:09 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ #include #include #include #include #include #ifdef __weak_alias __weak_alias(strunvis,_strunvis) #endif #if !HAVE_VIS /* * decode driven by state machine */ #define S_GROUND 0 /* haven't seen escape char */ #define S_START 1 /* start decoding special sequence */ #define S_META 2 /* metachar started (M) */ #define S_META1 3 /* metachar more, regular char (-) */ #define S_CTRL 4 /* control char started (^) */ #define S_OCTAL2 5 /* octal digit 2 */ #define S_OCTAL3 6 /* octal digit 3 */ #define S_HEX1 7 /* hex digit */ #define S_HEX2 8 /* hex digit 2 */ #define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7') #define xtod(c) (isdigit(c) ? (c - '0') : ((tolower(c) - 'a') + 10)) /* * unvis - decode characters previously encoded by vis */ int unvis(cp, c, astate, flag) char *cp; int c; int *astate, flag; { unsigned char uc = (unsigned char)c; _DIAGASSERT(cp != NULL); _DIAGASSERT(astate != NULL); if (flag & UNVIS_END) { if (*astate == S_OCTAL2 || *astate == S_OCTAL3 || *astate == S_HEX2) { *astate = S_GROUND; return (UNVIS_VALID); } return (*astate == S_GROUND ? UNVIS_NOCHAR : UNVIS_SYNBAD); } switch (*astate) { case S_GROUND: *cp = 0; if (c == '\\') { *astate = S_START; return (0); } if ((flag & VIS_HTTPSTYLE) && c == '%') { *astate = S_HEX1; return (0); } *cp = c; return (UNVIS_VALID); case S_START: switch(c) { case '\\': *cp = c; *astate = S_GROUND; return (UNVIS_VALID); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': *cp = (c - '0'); *astate = S_OCTAL2; return (0); case 'M': *cp = (char)0200; *astate = S_META; return (0); case '^': *astate = S_CTRL; return (0); case 'n': *cp = '\n'; *astate = S_GROUND; return (UNVIS_VALID); case 'r': *cp = '\r'; *astate = S_GROUND; return (UNVIS_VALID); case 'b': *cp = '\b'; *astate = S_GROUND; return (UNVIS_VALID); case 'a': *cp = '\007'; *astate = S_GROUND; return (UNVIS_VALID); case 'v': *cp = '\v'; *astate = S_GROUND; return (UNVIS_VALID); case 't': *cp = '\t'; *astate = S_GROUND; return (UNVIS_VALID); case 'f': *cp = '\f'; *astate = S_GROUND; return (UNVIS_VALID); case 's': *cp = ' '; *astate = S_GROUND; return (UNVIS_VALID); case 'E': *cp = '\033'; *astate = S_GROUND; return (UNVIS_VALID); case '\n': /* * hidden newline */ *astate = S_GROUND; return (UNVIS_NOCHAR); case '$': /* * hidden marker */ *astate = S_GROUND; return (UNVIS_NOCHAR); } *astate = S_GROUND; return (UNVIS_SYNBAD); case S_META: if (c == '-') *astate = S_META1; else if (c == '^') *astate = S_CTRL; else { *astate = S_GROUND; return (UNVIS_SYNBAD); } return (0); case S_META1: *astate = S_GROUND; *cp |= c; return (UNVIS_VALID); case S_CTRL: if (c == '?') *cp |= 0177; else *cp |= c & 037; *astate = S_GROUND; return (UNVIS_VALID); case S_OCTAL2: /* second possible octal digit */ if (isoctal(uc)) { /* * yes - and maybe a third */ *cp = (*cp << 3) + (c - '0'); *astate = S_OCTAL3; return (0); } /* * no - done with current sequence, push back passed char */ *astate = S_GROUND; return (UNVIS_VALIDPUSH); case S_OCTAL3: /* third possible octal digit */ *astate = S_GROUND; if (isoctal(uc)) { *cp = (*cp << 3) + (c - '0'); return (UNVIS_VALID); } /* * we were done, push back passed char */ return (UNVIS_VALIDPUSH); case S_HEX1: if (isxdigit(uc)) { *cp = xtod(uc); *astate = S_HEX2; return (0); } /* * no - done with current sequence, push back passed char */ *astate = S_GROUND; return (UNVIS_VALIDPUSH); case S_HEX2: *astate = S_GROUND; if (isxdigit(uc)) { *cp = xtod(uc) | (*cp << 4); return (UNVIS_VALID); } return (UNVIS_VALIDPUSH); default: /* * decoder in unknown state - (probably uninitialized) */ *astate = S_GROUND; return (UNVIS_SYNBAD); } } /* * strunvis - decode src into dst * * Number of chars decoded into dst is returned, -1 on error. * Dst is null terminated. */ int strunvisx(dst, src, flag) char *dst; const char *src; int flag; { char c; char *start = dst; int state = 0; _DIAGASSERT(src != NULL); _DIAGASSERT(dst != NULL); while ((c = *src++) != '\0') { again: switch (unvis(dst, c, &state, flag)) { case UNVIS_VALID: dst++; break; case UNVIS_VALIDPUSH: dst++; goto again; case 0: case UNVIS_NOCHAR: break; default: return (-1); } } if (unvis(dst, c, &state, UNVIS_END) == UNVIS_VALID) dst++; *dst = '\0'; return (dst - start); } int strunvis(dst, src) char *dst; const char *src; { return strunvisx(dst, src, 0); } #endif openipmi-2.0.18/libedit/chared.h0000644000175000017500000001146510373140634015421 0ustar chuckchuck/* $NetBSD: chared.h,v 1.16 2005/08/08 14:05:37 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)chared.h 8.1 (Berkeley) 6/4/93 */ /* * el.chared.h: Character editor interface */ #ifndef _h_el_chared #define _h_el_chared #include #include #include "histedit.h" #define EL_MAXMACRO 10 /* * This is an issue of basic "vi" look-and-feel. Defining VI_MOVE works * like real vi: i.e. the transition from command<->insert modes moves * the cursor. * * On the other hand we really don't want to move the cursor, because * all the editing commands don't include the character under the cursor. * Probably the best fix is to make all the editing commands aware of * this fact. */ #define VI_MOVE typedef struct c_macro_t { int level; int offset; char **macro; } c_macro_t; /* * Undo information for vi - no undo in emacs (yet) */ typedef struct c_undo_t { int len; /* length of saved line */ int cursor; /* position of saved cursor */ char *buf; /* full saved text */ } c_undo_t; /* redo for vi */ typedef struct c_redo_t { char *buf; /* redo insert key sequence */ char *pos; char *lim; el_action_t cmd; /* command to redo */ char ch; /* char that invoked it */ int count; int action; /* from cv_action() */ } c_redo_t; /* * Current action information for vi */ typedef struct c_vcmd_t { int action; char *pos; } c_vcmd_t; /* * Kill buffer for emacs */ typedef struct c_kill_t { char *buf; char *last; char *mark; } c_kill_t; /* * Note that we use both data structures because the user can bind * commands from both editors! */ typedef struct el_chared_t { c_undo_t c_undo; c_kill_t c_kill; c_redo_t c_redo; c_vcmd_t c_vcmd; c_macro_t c_macro; } el_chared_t; #define STReof "^D\b\b" #define STRQQ "\"\"" #define isglob(a) (strchr("*[]?", (a)) != NULL) #define isword(a) (isprint(a)) #define NOP 0x00 #define DELETE 0x01 #define INSERT 0x02 #define YANK 0x04 #define CHAR_FWD (+1) #define CHAR_BACK (-1) #define MODE_INSERT 0 #define MODE_REPLACE 1 #define MODE_REPLACE_1 2 #include "common.h" #include "vi.h" #include "emacs.h" #include "search.h" #include "fcns.h" protected int cv__isword(int); protected int cv__isWord(int); protected void cv_delfini(EditLine *); protected char *cv__endword(char *, char *, int, int (*)(int)); protected int ce__isword(int); protected void cv_undo(EditLine *); protected void cv_yank(EditLine *, const char *, int); protected char *cv_next_word(EditLine*, char *, char *, int, int (*)(int)); protected char *cv_prev_word(char *, char *, int, int (*)(int)); protected char *c__next_word(char *, char *, int, int (*)(int)); protected char *c__prev_word(char *, char *, int, int (*)(int)); protected void c_insert(EditLine *, int); protected void c_delbefore(EditLine *, int); protected void c_delbefore1(EditLine *); protected void c_delafter(EditLine *, int); protected void c_delafter1(EditLine *); protected int c_gets(EditLine *, char *, const char *); protected int c_hpos(EditLine *); protected int ch_init(EditLine *); protected void ch_reset(EditLine *, int); protected int ch_enlargebufs(EditLine *, size_t); protected void ch_end(EditLine *); #endif /* _h_el_chared */ openipmi-2.0.18/libedit/search.h0000644000175000017500000000535410373140634015440 0ustar chuckchuck/* $NetBSD: search.h,v 1.8 2003/10/18 23:27:36 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)search.h 8.1 (Berkeley) 6/4/93 */ /* * el.search.h: Line and history searching utilities */ #ifndef _h_el_search #define _h_el_search #include "histedit.h" typedef struct el_search_t { char *patbuf; /* The pattern buffer */ size_t patlen; /* Length of the pattern buffer */ int patdir; /* Direction of the last search */ int chadir; /* Character search direction */ char chacha; /* Character we are looking for */ char chatflg; /* 0 if f, 1 if t */ } el_search_t; protected int el_match(const char *, const char *); protected int search_init(EditLine *); protected void search_end(EditLine *); protected int c_hmatch(EditLine *, const char *); protected void c_setpat(EditLine *); protected el_action_t ce_inc_search(EditLine *, int); protected el_action_t cv_search(EditLine *, int); protected el_action_t ce_search_line(EditLine *, int); protected el_action_t cv_repeat_srch(EditLine *, int); protected el_action_t cv_csearch(EditLine *, int, int, int, int); #endif /* _h_el_search */ openipmi-2.0.18/libedit/common.c0000644000175000017500000004700010373140634015450 0ustar chuckchuck/* $NetBSD: common.c,v 1.18 2005/08/08 14:05:37 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: common.c,v 1.18 2005/08/08 14:05:37 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * common.c: Common Editor functions */ #include "el.h" /* ed_end_of_file(): * Indicate end of file * [^D] */ protected el_action_t /*ARGSUSED*/ ed_end_of_file(EditLine *el, int c __attribute__((__unused__))) { re_goto_bottom(el); *el->el_line.lastchar = '\0'; return (CC_EOF); } /* ed_insert(): * Add character to the line * Insert a character [bound to all insert keys] */ protected el_action_t ed_insert(EditLine *el, int c) { int count = el->el_state.argument; if (c == '\0') return (CC_ERROR); if (el->el_line.lastchar + el->el_state.argument >= el->el_line.limit) { /* end of buffer space, try to allocate more */ if (!ch_enlargebufs(el, (size_t) count)) return CC_ERROR; /* error allocating more */ } if (count == 1) { if (el->el_state.inputmode == MODE_INSERT || el->el_line.cursor >= el->el_line.lastchar) c_insert(el, 1); *el->el_line.cursor++ = c; re_fastaddc(el); /* fast refresh for one char. */ } else { if (el->el_state.inputmode != MODE_REPLACE_1) c_insert(el, el->el_state.argument); while (count-- && el->el_line.cursor < el->el_line.lastchar) *el->el_line.cursor++ = c; re_refresh(el); } if (el->el_state.inputmode == MODE_REPLACE_1) return vi_command_mode(el, 0); return (CC_NORM); } /* ed_delete_prev_word(): * Delete from beginning of current word to cursor * [M-^?] [^W] */ protected el_action_t /*ARGSUSED*/ ed_delete_prev_word(EditLine *el, int c __attribute__((__unused__))) { char *cp, *p, *kp; if (el->el_line.cursor == el->el_line.buffer) return (CC_ERROR); cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, el->el_state.argument, ce__isword); for (p = cp, kp = el->el_chared.c_kill.buf; p < el->el_line.cursor; p++) *kp++ = *p; el->el_chared.c_kill.last = kp; c_delbefore(el, el->el_line.cursor - cp); /* delete before dot */ el->el_line.cursor = cp; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; /* bounds check */ return (CC_REFRESH); } /* ed_delete_next_char(): * Delete character under cursor * [^D] [x] */ protected el_action_t /*ARGSUSED*/ ed_delete_next_char(EditLine *el, int c __attribute__((__unused__))) { #ifdef notdef /* XXX */ #define EL el->el_line (void) fprintf(el->el_errlfile, "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar, EL.lastchar, EL.limit, EL.limit); #endif if (el->el_line.cursor == el->el_line.lastchar) { /* if I'm at the end */ if (el->el_map.type == MAP_VI) { if (el->el_line.cursor == el->el_line.buffer) { /* if I'm also at the beginning */ #ifdef KSHVI return (CC_ERROR); #else term_overwrite(el, STReof, 4); /* then do an EOF */ term__flush(); return (CC_EOF); #endif } else { #ifdef KSHVI el->el_line.cursor--; #else return (CC_ERROR); #endif } } else { if (el->el_line.cursor != el->el_line.buffer) el->el_line.cursor--; else return (CC_ERROR); } } c_delafter(el, el->el_state.argument); /* delete after dot */ if (el->el_line.cursor >= el->el_line.lastchar && el->el_line.cursor > el->el_line.buffer) /* bounds check */ el->el_line.cursor = el->el_line.lastchar - 1; return (CC_REFRESH); } /* ed_kill_line(): * Cut to the end of line * [^K] [^K] */ protected el_action_t /*ARGSUSED*/ ed_kill_line(EditLine *el, int c __attribute__((__unused__))) { char *kp, *cp; cp = el->el_line.cursor; kp = el->el_chared.c_kill.buf; while (cp < el->el_line.lastchar) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; /* zap! -- delete to end */ el->el_line.lastchar = el->el_line.cursor; return (CC_REFRESH); } /* ed_move_to_end(): * Move cursor to the end of line * [^E] [^E] */ protected el_action_t /*ARGSUSED*/ ed_move_to_end(EditLine *el, int c __attribute__((__unused__))) { el->el_line.cursor = el->el_line.lastchar; if (el->el_map.type == MAP_VI) { #ifdef VI_MOVE el->el_line.cursor--; #endif if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); } } return (CC_CURSOR); } /* ed_move_to_beg(): * Move cursor to the beginning of line * [^A] [^A] */ protected el_action_t /*ARGSUSED*/ ed_move_to_beg(EditLine *el, int c __attribute__((__unused__))) { el->el_line.cursor = el->el_line.buffer; if (el->el_map.type == MAP_VI) { /* We want FIRST non space character */ while (isspace((unsigned char) *el->el_line.cursor)) el->el_line.cursor++; if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); } } return (CC_CURSOR); } /* ed_transpose_chars(): * Exchange the character to the left of the cursor with the one under it * [^T] [^T] */ protected el_action_t ed_transpose_chars(EditLine *el, int c) { if (el->el_line.cursor < el->el_line.lastchar) { if (el->el_line.lastchar <= &el->el_line.buffer[1]) return (CC_ERROR); else el->el_line.cursor++; } if (el->el_line.cursor > &el->el_line.buffer[1]) { /* must have at least two chars entered */ c = el->el_line.cursor[-2]; el->el_line.cursor[-2] = el->el_line.cursor[-1]; el->el_line.cursor[-1] = c; return (CC_REFRESH); } else return (CC_ERROR); } /* ed_next_char(): * Move to the right one character * [^F] [^F] */ protected el_action_t /*ARGSUSED*/ ed_next_char(EditLine *el, int c __attribute__((__unused__))) { char *lim = el->el_line.lastchar; if (el->el_line.cursor >= lim || (el->el_line.cursor == lim - 1 && el->el_map.type == MAP_VI && el->el_chared.c_vcmd.action == NOP)) return (CC_ERROR); el->el_line.cursor += el->el_state.argument; if (el->el_line.cursor > lim) el->el_line.cursor = lim; if (el->el_map.type == MAP_VI) if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); } return (CC_CURSOR); } /* ed_prev_word(): * Move to the beginning of the current word * [M-b] [b] */ protected el_action_t /*ARGSUSED*/ ed_prev_word(EditLine *el, int c __attribute__((__unused__))) { if (el->el_line.cursor == el->el_line.buffer) return (CC_ERROR); el->el_line.cursor = c__prev_word(el->el_line.cursor, el->el_line.buffer, el->el_state.argument, ce__isword); if (el->el_map.type == MAP_VI) if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); } return (CC_CURSOR); } /* ed_prev_char(): * Move to the left one character * [^B] [^B] */ protected el_action_t /*ARGSUSED*/ ed_prev_char(EditLine *el, int c __attribute__((__unused__))) { if (el->el_line.cursor > el->el_line.buffer) { el->el_line.cursor -= el->el_state.argument; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; if (el->el_map.type == MAP_VI) if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); } return (CC_CURSOR); } else return (CC_ERROR); } /* ed_quoted_insert(): * Add the next character typed verbatim * [^V] [^V] */ protected el_action_t ed_quoted_insert(EditLine *el, int c) { int num; char tc; tty_quotemode(el); num = el_getc(el, &tc); c = (unsigned char) tc; tty_noquotemode(el); if (num == 1) return (ed_insert(el, c)); else return (ed_end_of_file(el, 0)); } /* ed_digit(): * Adds to argument or enters a digit */ protected el_action_t ed_digit(EditLine *el, int c) { if (!isdigit(c)) return (CC_ERROR); if (el->el_state.doingarg) { /* if doing an arg, add this in... */ if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT) el->el_state.argument = c - '0'; else { if (el->el_state.argument > 1000000) return (CC_ERROR); el->el_state.argument = (el->el_state.argument * 10) + (c - '0'); } return (CC_ARGHACK); } return ed_insert(el, c); } /* ed_argument_digit(): * Digit that starts argument * For ESC-n */ protected el_action_t ed_argument_digit(EditLine *el, int c) { if (!isdigit(c)) return (CC_ERROR); if (el->el_state.doingarg) { if (el->el_state.argument > 1000000) return (CC_ERROR); el->el_state.argument = (el->el_state.argument * 10) + (c - '0'); } else { /* else starting an argument */ el->el_state.argument = c - '0'; el->el_state.doingarg = 1; } return (CC_ARGHACK); } /* ed_unassigned(): * Indicates unbound character * Bound to keys that are not assigned */ protected el_action_t /*ARGSUSED*/ ed_unassigned(EditLine *el, int c __attribute__((__unused__))) { return (CC_ERROR); } /** ** TTY key handling. **/ /* ed_tty_sigint(): * Tty interrupt character * [^C] */ protected el_action_t /*ARGSUSED*/ ed_tty_sigint(EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) { return (CC_NORM); } /* ed_tty_dsusp(): * Tty delayed suspend character * [^Y] */ protected el_action_t /*ARGSUSED*/ ed_tty_dsusp(EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) { return (CC_NORM); } /* ed_tty_flush_output(): * Tty flush output characters * [^O] */ protected el_action_t /*ARGSUSED*/ ed_tty_flush_output(EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) { return (CC_NORM); } /* ed_tty_sigquit(): * Tty quit character * [^\] */ protected el_action_t /*ARGSUSED*/ ed_tty_sigquit(EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) { return (CC_NORM); } /* ed_tty_sigtstp(): * Tty suspend character * [^Z] */ protected el_action_t /*ARGSUSED*/ ed_tty_sigtstp(EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) { return (CC_NORM); } /* ed_tty_stop_output(): * Tty disallow output characters * [^S] */ protected el_action_t /*ARGSUSED*/ ed_tty_stop_output(EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) { return (CC_NORM); } /* ed_tty_start_output(): * Tty allow output characters * [^Q] */ protected el_action_t /*ARGSUSED*/ ed_tty_start_output(EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) { return (CC_NORM); } /* ed_newline(): * Execute command * [^J] */ protected el_action_t /*ARGSUSED*/ ed_newline(EditLine *el, int c __attribute__((__unused__))) { re_goto_bottom(el); *el->el_line.lastchar++ = '\n'; *el->el_line.lastchar = '\0'; return (CC_NEWLINE); } /* ed_delete_prev_char(): * Delete the character to the left of the cursor * [^?] */ protected el_action_t /*ARGSUSED*/ ed_delete_prev_char(EditLine *el, int c __attribute__((__unused__))) { if (el->el_line.cursor <= el->el_line.buffer) return (CC_ERROR); c_delbefore(el, el->el_state.argument); el->el_line.cursor -= el->el_state.argument; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; return (CC_REFRESH); } /* ed_clear_screen(): * Clear screen leaving current line at the top * [^L] */ protected el_action_t /*ARGSUSED*/ ed_clear_screen(EditLine *el, int c __attribute__((__unused__))) { term_clear_screen(el); /* clear the whole real screen */ re_clear_display(el); /* reset everything */ return (CC_REFRESH); } /* ed_redisplay(): * Redisplay everything * ^R */ protected el_action_t /*ARGSUSED*/ ed_redisplay(EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) { return (CC_REDISPLAY); } /* ed_start_over(): * Erase current line and start from scratch * [^G] */ protected el_action_t /*ARGSUSED*/ ed_start_over(EditLine *el, int c __attribute__((__unused__))) { ch_reset(el, 0); return (CC_REFRESH); } /* ed_sequence_lead_in(): * First character in a bound sequence * Placeholder for external keys */ protected el_action_t /*ARGSUSED*/ ed_sequence_lead_in(EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) { return (CC_NORM); } /* ed_prev_history(): * Move to the previous history line * [^P] [k] */ protected el_action_t /*ARGSUSED*/ ed_prev_history(EditLine *el, int c __attribute__((__unused__))) { char beep = 0; int sv_event = el->el_history.eventno; el->el_chared.c_undo.len = -1; *el->el_line.lastchar = '\0'; /* just in case */ if (el->el_history.eventno == 0) { /* save the current buffer * away */ (void) strncpy(el->el_history.buf, el->el_line.buffer, EL_BUFSIZ); el->el_history.last = el->el_history.buf + (el->el_line.lastchar - el->el_line.buffer); } el->el_history.eventno += el->el_state.argument; if (hist_get(el) == CC_ERROR) { if (el->el_map.type == MAP_VI) { el->el_history.eventno = sv_event; return CC_ERROR; } beep = 1; /* el->el_history.eventno was fixed by first call */ (void) hist_get(el); } if (beep) return CC_REFRESH_BEEP; return CC_REFRESH; } /* ed_next_history(): * Move to the next history line * [^N] [j] */ protected el_action_t /*ARGSUSED*/ ed_next_history(EditLine *el, int c __attribute__((__unused__))) { el_action_t beep = CC_REFRESH, rval; el->el_chared.c_undo.len = -1; *el->el_line.lastchar = '\0'; /* just in case */ el->el_history.eventno -= el->el_state.argument; if (el->el_history.eventno < 0) { el->el_history.eventno = 0; beep = CC_REFRESH_BEEP; } rval = hist_get(el); if (rval == CC_REFRESH) return beep; return rval; } /* ed_search_prev_history(): * Search previous in history for a line matching the current * next search history [M-P] [K] */ protected el_action_t /*ARGSUSED*/ ed_search_prev_history(EditLine *el, int c __attribute__((__unused__))) { const char *hp; int h; bool_t found = 0; el->el_chared.c_vcmd.action = NOP; el->el_chared.c_undo.len = -1; *el->el_line.lastchar = '\0'; /* just in case */ if (el->el_history.eventno < 0) { #ifdef DEBUG_EDIT (void) fprintf(el->el_errfile, "e_prev_search_hist(): eventno < 0;\n"); #endif el->el_history.eventno = 0; return (CC_ERROR); } if (el->el_history.eventno == 0) { (void) strncpy(el->el_history.buf, el->el_line.buffer, EL_BUFSIZ); el->el_history.last = el->el_history.buf + (el->el_line.lastchar - el->el_line.buffer); } if (el->el_history.ref == NULL) return (CC_ERROR); hp = HIST_FIRST(el); if (hp == NULL) return (CC_ERROR); c_setpat(el); /* Set search pattern !! */ for (h = 1; h <= el->el_history.eventno; h++) hp = HIST_NEXT(el); while (hp != NULL) { #ifdef SDEBUG (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); #endif if ((strncmp(hp, el->el_line.buffer, (size_t) (el->el_line.lastchar - el->el_line.buffer)) || hp[el->el_line.lastchar - el->el_line.buffer]) && c_hmatch(el, hp)) { found++; break; } h++; hp = HIST_NEXT(el); } if (!found) { #ifdef SDEBUG (void) fprintf(el->el_errfile, "not found\n"); #endif return (CC_ERROR); } el->el_history.eventno = h; return (hist_get(el)); } /* ed_search_next_history(): * Search next in history for a line matching the current * [M-N] [J] */ protected el_action_t /*ARGSUSED*/ ed_search_next_history(EditLine *el, int c __attribute__((__unused__))) { const char *hp; int h; bool_t found = 0; el->el_chared.c_vcmd.action = NOP; el->el_chared.c_undo.len = -1; *el->el_line.lastchar = '\0'; /* just in case */ if (el->el_history.eventno == 0) return (CC_ERROR); if (el->el_history.ref == NULL) return (CC_ERROR); hp = HIST_FIRST(el); if (hp == NULL) return (CC_ERROR); c_setpat(el); /* Set search pattern !! */ for (h = 1; h < el->el_history.eventno && hp; h++) { #ifdef SDEBUG (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); #endif if ((strncmp(hp, el->el_line.buffer, (size_t) (el->el_line.lastchar - el->el_line.buffer)) || hp[el->el_line.lastchar - el->el_line.buffer]) && c_hmatch(el, hp)) found = h; hp = HIST_NEXT(el); } if (!found) { /* is it the current history number? */ if (!c_hmatch(el, el->el_history.buf)) { #ifdef SDEBUG (void) fprintf(el->el_errfile, "not found\n"); #endif return (CC_ERROR); } } el->el_history.eventno = found; return (hist_get(el)); } /* ed_prev_line(): * Move up one line * Could be [k] [^p] */ protected el_action_t /*ARGSUSED*/ ed_prev_line(EditLine *el, int c __attribute__((__unused__))) { char *ptr; int nchars = c_hpos(el); /* * Move to the line requested */ if (*(ptr = el->el_line.cursor) == '\n') ptr--; for (; ptr >= el->el_line.buffer; ptr--) if (*ptr == '\n' && --el->el_state.argument <= 0) break; if (el->el_state.argument > 0) return (CC_ERROR); /* * Move to the beginning of the line */ for (ptr--; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--) continue; /* * Move to the character requested */ for (ptr++; nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; ptr++) continue; el->el_line.cursor = ptr; return (CC_CURSOR); } /* ed_next_line(): * Move down one line * Could be [j] [^n] */ protected el_action_t /*ARGSUSED*/ ed_next_line(EditLine *el, int c __attribute__((__unused__))) { char *ptr; int nchars = c_hpos(el); /* * Move to the line requested */ for (ptr = el->el_line.cursor; ptr < el->el_line.lastchar; ptr++) if (*ptr == '\n' && --el->el_state.argument <= 0) break; if (el->el_state.argument > 0) return (CC_ERROR); /* * Move to the character requested */ for (ptr++; nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; ptr++) continue; el->el_line.cursor = ptr; return (CC_CURSOR); } /* ed_command(): * Editline extended command * [M-X] [:] */ protected el_action_t /*ARGSUSED*/ ed_command(EditLine *el, int c __attribute__((__unused__))) { char tmpbuf[EL_BUFSIZ]; int tmplen; tmplen = c_gets(el, tmpbuf, "\n: "); term__putc('\n'); if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1) term_beep(el); el->el_map.current = el->el_map.key; re_clear_display(el); return CC_REFRESH; } openipmi-2.0.18/libedit/editline/0000755000175000017500000000000011367555457015631 5ustar chuckchuckopenipmi-2.0.18/libedit/editline/readline.h0000644000175000017500000001475410373140634017557 0ustar chuckchuck/* $NetBSD: readline.h,v 1.17 2005/07/14 15:00:58 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Jaromir Dolecek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _READLINE_H_ #define _READLINE_H_ #include /* list of readline stuff supported by editline library's readline wrapper */ /* typedefs */ typedef int Function(const char *, int); typedef void VFunction(void); typedef void VCPFunction(char *); typedef char *CPFunction(const char *, int); typedef char **CPPFunction(const char *, int, int); typedef void *histdata_t; typedef struct _hist_entry { const char *line; histdata_t *data; } HIST_ENTRY; typedef struct _keymap_entry { char type; #define ISFUNC 0 #define ISKMAP 1 #define ISMACR 2 Function *function; } KEYMAP_ENTRY; #define KEYMAP_SIZE 256 typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE]; typedef KEYMAP_ENTRY *Keymap; #define control_character_threshold 0x20 #define control_character_bit 0x40 #ifndef CTRL #include #ifdef __GLIBC__ #include #endif #ifndef CTRL #define CTRL(c) ((c) & 037) #endif #endif #ifndef UNCTRL #define UNCTRL(c) (((c) - 'a' + 'A')|control_character_bit) #endif #define RUBOUT 0x7f #define ABORT_CHAR CTRL('G') /* global variables used by readline enabled applications */ #ifdef __cplusplus extern "C" { #endif extern const char *rl_library_version; extern char *rl_readline_name; extern FILE *rl_instream; extern FILE *rl_outstream; extern char *rl_line_buffer; extern int rl_point, rl_end; extern int history_base, history_length; extern int max_input_history; extern char *rl_basic_word_break_characters; extern char *rl_completer_word_break_characters; extern char *rl_completer_quote_characters; extern Function *rl_completion_entry_function; extern CPPFunction *rl_attempted_completion_function; extern int rl_attempted_completion_over; extern int rl_completion_type; extern int rl_completion_query_items; extern char *rl_special_prefixes; extern int rl_completion_append_character; extern int rl_inhibit_completion; extern Function *rl_pre_input_hook; extern Function *rl_startup_hook; extern char *rl_terminal_name; extern int rl_already_prompted; extern char *rl_prompt; /* * The following is not implemented */ extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap; extern int rl_filename_completion_desired; extern int rl_ignore_completion_duplicates; extern Function *rl_getc_function; extern VFunction *rl_redisplay_function; extern VFunction *rl_completion_display_matches_hook; extern VFunction *rl_prep_term_function; extern VFunction *rl_deprep_term_function; /* supported functions */ char *readline(const char *); int rl_initialize(void); void using_history(void); int add_history(const char *); void clear_history(void); void stifle_history(int); int unstifle_history(void); int history_is_stifled(void); int where_history(void); HIST_ENTRY *current_history(void); HIST_ENTRY *history_get(int); HIST_ENTRY *remove_history(int); int history_total_bytes(void); int history_set_pos(int); HIST_ENTRY *previous_history(void); HIST_ENTRY *next_history(void); int history_search(const char *, int); int history_search_prefix(const char *, int); int history_search_pos(const char *, int, int); int read_history(const char *); int write_history(const char *); int history_expand(char *, char **); char **history_tokenize(const char *); const char *get_history_event(const char *, int *, int); char *history_arg_extract(int, int, const char *); char *tilde_expand(char *); char *filename_completion_function(const char *, int); char *username_completion_function(const char *, int); int rl_complete(int, int); int rl_read_key(void); char **completion_matches(const char *, CPFunction *); void rl_display_match_list(char **, int, int); int rl_insert(int, int); void rl_reset_terminal(const char *); int rl_bind_key(int, int (*)(int, int)); int rl_newline(int, int); void rl_callback_read_char(void); void rl_callback_handler_install(const char *, VCPFunction *); void rl_callback_handler_remove(void); void rl_redisplay(void); int rl_get_previous_history(int, int); void rl_prep_terminal(int); void rl_deprep_terminal(void); int rl_read_init_file(const char *); int rl_parse_and_bind(const char *); int rl_variable_bind(const char *, const char *); void rl_stuff_char(int); int rl_add_defun(const char *, Function *, int); /* * The following are not implemented */ Keymap rl_get_keymap(void); Keymap rl_make_bare_keymap(void); int rl_generic_bind(int, const char *, const char *, Keymap); int rl_bind_key_in_map(int, Function *, Keymap); #ifdef __cplusplus } #endif #endif /* _READLINE_H_ */ openipmi-2.0.18/libedit/hist.h0000644000175000017500000000612610373140634015140 0ustar chuckchuck/* $NetBSD: hist.h,v 1.10 2003/08/07 16:44:31 agc Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)hist.h 8.1 (Berkeley) 6/4/93 */ /* * el.hist.c: History functions */ #ifndef _h_el_hist #define _h_el_hist #include "histedit.h" typedef int (*hist_fun_t)(ptr_t, HistEvent *, int, ...); typedef struct el_history_t { char *buf; /* The history buffer */ size_t sz; /* Size of history buffer */ char *last; /* The last character */ int eventno; /* Event we are looking for */ ptr_t ref; /* Argument for history fcns */ hist_fun_t fun; /* Event access */ HistEvent ev; /* Event cookie */ } el_history_t; #define HIST_FUN(el, fn, arg) \ ((((*(el)->el_history.fun) ((el)->el_history.ref, &(el)->el_history.ev, \ fn, arg)) == -1) ? NULL : (el)->el_history.ev.str) #define HIST_NEXT(el) HIST_FUN(el, H_NEXT, NULL) #define HIST_FIRST(el) HIST_FUN(el, H_FIRST, NULL) #define HIST_LAST(el) HIST_FUN(el, H_LAST, NULL) #define HIST_PREV(el) HIST_FUN(el, H_PREV, NULL) #define HIST_SET(el, num) HIST_FUN(el, H_SET, num) #define HIST_LOAD(el, fname) HIST_FUN(el, H_LOAD fname) #define HIST_SAVE(el, fname) HIST_FUN(el, H_SAVE fname) protected int hist_init(EditLine *); protected void hist_end(EditLine *); protected el_action_t hist_get(EditLine *); protected int hist_set(EditLine *, hist_fun_t, ptr_t); protected int hist_command(EditLine *, int, const char **); protected int hist_enlargebuf(EditLine *, size_t, size_t); #endif /* _h_el_hist */ openipmi-2.0.18/libedit/read.h0000644000175000017500000000466610373140634015113 0ustar chuckchuck/* $NetBSD: read.h,v 1.4 2004/02/27 14:52:18 christos Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Anthony Mallet. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* * el.read.h: Character reading functions */ #ifndef _h_el_read #define _h_el_read typedef int (*el_rfunc_t)(EditLine *, char *); typedef struct el_read_t { el_rfunc_t read_char; /* Function to read a character */ } el_read_t; protected int read_init(EditLine *); protected void read_prepare(EditLine *); protected void read_finish(EditLine *); protected int el_read_setfn(EditLine *, el_rfunc_t); protected el_rfunc_t el_read_getfn(EditLine *); #endif /* _h_el_read */ openipmi-2.0.18/libedit/filecomplete.h0000644000175000017500000000455510373140634016645 0ustar chuckchuck/* $NetBSD: filecomplete.h,v 1.4 2005/06/11 18:18:59 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Jaromir Dolecek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _FILECOMPLETE_H_ #define _FILECOMPLETE_H_ int fn_complete(EditLine *, char *(*)(const char *, int), char **(*)(const char *, int, int), const char *, const char *, const char *(*)(const char *), int, int *, int *, int *, int *); void fn_display_match_list(EditLine *, char **, int, int); char *fn_tilde_expand(const char *); char *fn_filename_completion_function(const char *, int); #endif openipmi-2.0.18/libedit/read.c0000644000175000017500000003400110401070007015054 0ustar chuckchuck/* $NetBSD: read.c,v 1.39 2005/08/02 12:11:14 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: read.c,v 1.39 2005/08/02 12:11:14 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * read.c: Clean this junk up! This is horrible code. * Terminal read functions */ #include #include #include #include #include "el.h" #define OKCMD -1 private int read__fixio(int, int); private int read_preread(EditLine *); private int read_char(EditLine *, char *); private int read_getcmd(EditLine *, el_action_t *, char *); /* read_init(): * Initialize the read stuff */ protected int read_init(EditLine *el) { /* builtin read_char */ el->el_read.read_char = read_char; return 0; } /* el_read_setfn(): * Set the read char function to the one provided. * If it is set to EL_BUILTIN_GETCFN, then reset to the builtin one. */ protected int el_read_setfn(EditLine *el, el_rfunc_t rc) { el->el_read.read_char = (rc == EL_BUILTIN_GETCFN) ? read_char : rc; return 0; } /* el_read_getfn(): * return the current read char function, or EL_BUILTIN_GETCFN * if it is the default one */ protected el_rfunc_t el_read_getfn(EditLine *el) { return (el->el_read.read_char == read_char) ? EL_BUILTIN_GETCFN : el->el_read.read_char; } #ifndef MIN #define MIN(A,B) ((A) < (B) ? (A) : (B)) #endif #ifdef DEBUG_EDIT private void read_debug(EditLine *el) { if (el->el_line.cursor > el->el_line.lastchar) (void) fprintf(el->el_errfile, "cursor > lastchar\r\n"); if (el->el_line.cursor < el->el_line.buffer) (void) fprintf(el->el_errfile, "cursor < buffer\r\n"); if (el->el_line.cursor > el->el_line.limit) (void) fprintf(el->el_errfile, "cursor > limit\r\n"); if (el->el_line.lastchar > el->el_line.limit) (void) fprintf(el->el_errfile, "lastchar > limit\r\n"); if (el->el_line.limit != &el->el_line.buffer[EL_BUFSIZ - 2]) (void) fprintf(el->el_errfile, "limit != &buffer[EL_BUFSIZ-2]\r\n"); } #endif /* DEBUG_EDIT */ /* read__fixio(): * Try to recover from a read error */ /* ARGSUSED */ private int read__fixio(int fd __attribute__((__unused__)), int e) { switch (e) { case -1: /* Make sure that the code is reachable */ #ifdef EWOULDBLOCK case EWOULDBLOCK: #ifndef TRY_AGAIN #define TRY_AGAIN #endif #endif /* EWOULDBLOCK */ #if defined(POSIX) && defined(EAGAIN) #if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN case EAGAIN: #ifndef TRY_AGAIN #define TRY_AGAIN #endif #endif /* EWOULDBLOCK && EWOULDBLOCK != EAGAIN */ #endif /* POSIX && EAGAIN */ e = 0; #ifdef TRY_AGAIN #if defined(F_SETFL) && defined(O_NDELAY) if ((e = fcntl(fd, F_GETFL, 0)) == -1) return (-1); if (fcntl(fd, F_SETFL, e & ~O_NDELAY) == -1) return (-1); else e = 1; #endif /* F_SETFL && O_NDELAY */ #ifdef FIONBIO { int zero = 0; if (ioctl(fd, FIONBIO, (ioctl_t) & zero) == -1) return (-1); else e = 1; } #endif /* FIONBIO */ #endif /* TRY_AGAIN */ return (e ? 0 : -1); case EINTR: return (0); default: return (-1); } } /* read_preread(): * Try to read the stuff in the input queue; */ private int read_preread(EditLine *el) { int chrs = 0; if (el->el_tty.t_mode == ED_IO) return (0); #ifdef FIONREAD (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs); if (chrs > 0) { char buf[EL_BUFSIZ]; chrs = read(el->el_infd, buf, (size_t) MIN(chrs, EL_BUFSIZ - 1)); if (chrs > 0) { buf[chrs] = '\0'; el_push(el, buf); } } #endif /* FIONREAD */ return (chrs > 0); } /* el_push(): * Push a macro */ public void el_push(EditLine *el, char *str) { c_macro_t *ma = &el->el_chared.c_macro; if (str != NULL && ma->level + 1 < EL_MAXMACRO) { ma->level++; if ((ma->macro[ma->level] = el_strdup(str)) != NULL) return; ma->level--; } #if 0 /* TCM - why on earth would you beep here? */ term_beep(el); #endif term__flush(); } /* read_getcmd(): * Return next command from the input stream. */ private int read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch) { el_action_t cmd; int num; do { if ((num = el_getc(el, ch)) != 1) /* if EOF or error */ return (num); #ifdef KANJI if ((*ch & 0200)) { el->el_state.metanext = 0; cmd = CcViMap[' ']; break; } else #endif /* KANJI */ if (el->el_state.metanext) { el->el_state.metanext = 0; *ch |= 0200; } cmd = el->el_map.current[(unsigned char) *ch]; if (cmd == ED_SEQUENCE_LEAD_IN) { key_value_t val; switch (key_get(el, ch, &val)) { case XK_CMD: cmd = val.cmd; break; case XK_STR: el_push(el, val.str); break; #ifdef notyet case XK_EXE: /* XXX: In the future to run a user function */ RunCommand(val.str); break; #endif default: EL_ABORT((el->el_errfile, "Bad XK_ type \n")); break; } } if (el->el_map.alt == NULL) el->el_map.current = el->el_map.key; } while (cmd == ED_SEQUENCE_LEAD_IN); *cmdnum = cmd; return (OKCMD); } /* read_char(): * Read a character from the tty. */ private int read_char(EditLine *el, char *cp) { int num_read; int tried = 0; while ((num_read = read(el->el_infd, cp, 1)) == -1) if (!tried && read__fixio(el->el_infd, errno) == 0) tried = 1; else { *cp = '\0'; return (-1); } return (num_read); } /* el_getc(): * Read a character */ public int el_getc(EditLine *el, char *cp) { int num_read; c_macro_t *ma = &el->el_chared.c_macro; term__flush(); for (;;) { if (ma->level < 0) { if (!read_preread(el)) break; } if (ma->level < 0) break; if (ma->macro[ma->level][ma->offset] == '\0') { el_free(ma->macro[ma->level--]); ma->offset = 0; continue; } *cp = ma->macro[ma->level][ma->offset++] & 0377; if (ma->macro[ma->level][ma->offset] == '\0') { /* Needed for QuoteMode On */ el_free(ma->macro[ma->level--]); ma->offset = 0; } return (1); } #ifdef DEBUG_READ (void) fprintf(el->el_errfile, "Turning raw mode on\n"); #endif /* DEBUG_READ */ if (tty_rawmode(el) < 0)/* make sure the tty is set up correctly */ return (0); #ifdef DEBUG_READ (void) fprintf(el->el_errfile, "Reading a character\n"); #endif /* DEBUG_READ */ num_read = (*el->el_read.read_char)(el, cp); #ifdef DEBUG_READ (void) fprintf(el->el_errfile, "Got it %c\n", *cp); #endif /* DEBUG_READ */ return (num_read); } protected void read_prepare(EditLine *el) { if (el->el_flags & HANDLE_SIGNALS) sig_set(el); if (el->el_flags & NO_TTY) return; if ((el->el_flags & (UNBUFFERED|EDIT_DISABLED)) == UNBUFFERED) tty_rawmode(el); /* This is relatively cheap, and things go terribly wrong if we have the wrong size. */ el_resize(el); re_clear_display(el); /* reset the display stuff */ ch_reset(el, 0); re_refresh(el); /* print the prompt */ if (el->el_flags & UNBUFFERED) term__flush(); } protected void read_finish(EditLine *el) { if ((el->el_flags & UNBUFFERED) == 0) (void) tty_cookedmode(el); if (el->el_flags & HANDLE_SIGNALS) sig_clr(el); } public const char * el_gets(EditLine *el, int *nread) { int retval; el_action_t cmdnum = 0; int num; /* how many chars we have read at NL */ char ch; int crlf = 0; #ifdef FIONREAD c_macro_t *ma = &el->el_chared.c_macro; #endif /* FIONREAD */ if (el->el_flags & NO_TTY) { char *cp = el->el_line.buffer; size_t idx; while ((*el->el_read.read_char)(el, cp) == 1) { /* make sure there is space for next character */ if (cp + 1 >= el->el_line.limit) { idx = (cp - el->el_line.buffer); if (!ch_enlargebufs(el, 2)) break; cp = &el->el_line.buffer[idx]; } cp++; if (el->el_flags & UNBUFFERED) break; if (cp[-1] == '\r' || cp[-1] == '\n') break; } el->el_line.cursor = el->el_line.lastchar = cp; *cp = '\0'; if (nread) *nread = el->el_line.cursor - el->el_line.buffer; return (el->el_line.buffer); } #ifdef FIONREAD if (el->el_tty.t_mode == EX_IO && ma->level < 0) { long chrs = 0; (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs); if (chrs == 0) { if (tty_rawmode(el) < 0) { if (nread) *nread = 0; return (NULL); } } } #endif /* FIONREAD */ if ((el->el_flags & UNBUFFERED) == 0) read_prepare(el); if (el->el_flags & EDIT_DISABLED) { char *cp; size_t idx; if ((el->el_flags & UNBUFFERED) == 0) cp = el->el_line.buffer; else cp = el->el_line.lastchar; term__flush(); while ((*el->el_read.read_char)(el, cp) == 1) { /* make sure there is space next character */ if (cp + 1 >= el->el_line.limit) { idx = (cp - el->el_line.buffer); if (!ch_enlargebufs(el, 2)) break; cp = &el->el_line.buffer[idx]; } if (*cp == 4) /* ought to be stty eof */ break; cp++; crlf = cp[-1] == '\r' || cp[-1] == '\n'; if (el->el_flags & UNBUFFERED) break; if (crlf) break; } el->el_line.cursor = el->el_line.lastchar = cp; *cp = '\0'; if (nread) *nread = el->el_line.cursor - el->el_line.buffer; return (el->el_line.buffer); } for (num = OKCMD; num == OKCMD;) { /* while still editing this * line */ #ifdef DEBUG_EDIT read_debug(el); #endif /* DEBUG_EDIT */ /* if EOF or error */ if ((num = read_getcmd(el, &cmdnum, &ch)) != OKCMD) { #ifdef DEBUG_READ (void) fprintf(el->el_errfile, "Returning from el_gets %d\n", num); #endif /* DEBUG_READ */ break; } if ((unsigned int)cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */ #ifdef DEBUG_EDIT (void) fprintf(el->el_errfile, "ERROR: illegal command from key 0%o\r\n", ch); #endif /* DEBUG_EDIT */ continue; /* try again */ } /* now do the real command */ #ifdef DEBUG_READ { el_bindings_t *b; for (b = el->el_map.help; b->name; b++) if (b->func == cmdnum) break; if (b->name) (void) fprintf(el->el_errfile, "Executing %s\n", b->name); else (void) fprintf(el->el_errfile, "Error command = %d\n", cmdnum); } #endif /* DEBUG_READ */ /* vi redo needs these way down the levels... */ el->el_state.thiscmd = cmdnum; el->el_state.thisch = ch; if (el->el_map.type == MAP_VI && el->el_map.current == el->el_map.key && el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) { if (cmdnum == VI_DELETE_PREV_CHAR && el->el_chared.c_redo.pos != el->el_chared.c_redo.buf && isprint((unsigned char)el->el_chared.c_redo.pos[-1])) el->el_chared.c_redo.pos--; else *el->el_chared.c_redo.pos++ = ch; } retval = (*el->el_map.func[cmdnum]) (el, ch); #ifdef DEBUG_READ (void) fprintf(el->el_errfile, "Returned state %d\n", retval ); #endif /* DEBUG_READ */ /* save the last command here */ el->el_state.lastcmd = cmdnum; /* use any return value */ switch (retval) { case CC_CURSOR: re_refresh_cursor(el); break; case CC_REDISPLAY: re_clear_lines(el); re_clear_display(el); /* FALLTHROUGH */ case CC_REFRESH: re_refresh(el); break; case CC_REFRESH_BEEP: re_refresh(el); term_beep(el); break; case CC_NORM: /* normal char */ break; case CC_ARGHACK: /* Suggested by Rich Salz */ /* */ continue; /* keep going... */ case CC_EOF: /* end of file typed */ if ((el->el_flags & UNBUFFERED) == 0) num = 0; else if (num == -1) { *el->el_line.lastchar++ = CONTROL('d'); el->el_line.cursor = el->el_line.lastchar; num = 1; } break; case CC_NEWLINE: /* normal end of line */ num = el->el_line.lastchar - el->el_line.buffer; break; case CC_FATAL: /* fatal error, reset to known state */ #ifdef DEBUG_READ (void) fprintf(el->el_errfile, "*** editor fatal ERROR ***\r\n\n"); #endif /* DEBUG_READ */ /* put (real) cursor in a known place */ re_clear_display(el); /* reset the display stuff */ ch_reset(el, 1); /* reset the input pointers */ re_refresh(el); /* print the prompt again */ break; case CC_ERROR: default: /* functions we don't know about */ #ifdef DEBUG_READ (void) fprintf(el->el_errfile, "*** editor ERROR ***\r\n\n"); #endif /* DEBUG_READ */ term_beep(el); term__flush(); break; } el->el_state.argument = 1; el->el_state.doingarg = 0; el->el_chared.c_vcmd.action = NOP; if (el->el_flags & UNBUFFERED) break; } term__flush(); /* flush any buffered output */ /* make sure the tty is set up correctly */ if ((el->el_flags & UNBUFFERED) == 0) { read_finish(el); if (nread) *nread = num; } else { if (nread) *nread = el->el_line.lastchar - el->el_line.buffer; } return (num ? el->el_line.buffer : NULL); } openipmi-2.0.18/libedit/filecomplete.c0000644000175000017500000003442110373140634016633 0ustar chuckchuck/* $NetBSD: filecomplete.c,v 1.8 2005/08/03 13:41:38 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Jaromir Dolecek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* AIX requires this to be the first thing in the file. */ #if defined (_AIX) && !defined (__GNUC__) #pragma alloca #endif #include "sys.h" #ifdef __GNUC__ # undef alloca # define alloca(n) __builtin_alloca (n) #else # ifdef HAVE_ALLOCA_H # include # else # ifndef _AIX extern char *alloca (); # endif # endif #endif #if !defined(lint) && !defined(SCCSID) __RCSID("$NetBSD: filecomplete.c,v 1.8 2005/08/03 13:41:38 christos Exp $"); #endif /* not lint && not SCCSID */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "el.h" #include "fcns.h" /* for EL_NUM_FCNS */ #include "histedit.h" #include "filecomplete.h" static char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', '$', '>', '<', '=', ';', '|', '&', '{', '(', '\0' }; /********************************/ /* completion functions */ /* * does tilde expansion of strings of type ``~user/foo'' * if ``user'' isn't valid user name or ``txt'' doesn't start * w/ '~', returns pointer to strdup()ed copy of ``txt'' * * it's callers's responsibility to free() returned string */ char * fn_tilde_expand(const char *txt) { struct passwd pwres, *pass; char *temp; size_t len = 0; char pwbuf[1024]; if (txt[0] != '~') return (strdup(txt)); temp = strchr(txt + 1, '/'); if (temp == NULL) { temp = strdup(txt + 1); if (temp == NULL) return NULL; } else { len = temp - txt + 1; /* text until string after slash */ temp = malloc(len); if (temp == NULL) return NULL; (void)strncpy(temp, txt + 1, len - 2); temp[len - 2] = '\0'; } if (temp[0] == 0) { #ifdef HAVE_GETPW_R_POSIX if (getpwuid_r(getuid(), &pwres, pwbuf, sizeof(pwbuf), &pass) != 0) pass = NULL; #elif HAVE_GETPW_R_DRAFT pass = getpwuid_r(getuid(), &pwres, pwbuf, sizeof(pwbuf)); #else pass = getpwuid(getuid()); #endif } else { #ifdef HAVE_GETPW_R_POSIX if (getpwnam_r(temp, &pwres, pwbuf, sizeof(pwbuf), &pass) != 0) pass = NULL; #elif HAVE_GETPW_R_DRAFT pass = getpwnam_r(temp, &pwres, pwbuf, sizeof(pwbuf)); #else pass = getpwnam(temp); #endif } free(temp); /* value no more needed */ if (pass == NULL) return (strdup(txt)); /* update pointer txt to point at string immedially following */ /* first slash */ txt += len; temp = malloc(strlen(pass->pw_dir) + 1 + strlen(txt) + 1); if (temp == NULL) return NULL; (void)sprintf(temp, "%s/%s", pass->pw_dir, txt); return (temp); } /* * return first found file name starting by the ``text'' or NULL if no * such file can be found * value of ``state'' is ignored * * it's caller's responsibility to free returned string */ char * fn_filename_completion_function(const char *text, int state) { static DIR *dir = NULL; static char *filename = NULL, *dirname = NULL, *dirpath = NULL; static size_t filename_len = 0; struct dirent *entry; char *temp; size_t len; if (state == 0 || dir == NULL) { temp = strrchr(text, '/'); if (temp) { char *nptr; temp++; nptr = realloc(filename, strlen(temp) + 1); if (nptr == NULL) { free(filename); return NULL; } filename = nptr; (void)strcpy(filename, temp); len = temp - text; /* including last slash */ nptr = realloc(dirname, len + 1); if (nptr == NULL) { free(filename); return NULL; } dirname = nptr; (void)strncpy(dirname, text, len); dirname[len] = '\0'; } else { if (*text == 0) filename = NULL; else { filename = strdup(text); if (filename == NULL) return NULL; } dirname = NULL; } if (dir != NULL) { (void)closedir(dir); dir = NULL; } /* support for ``~user'' syntax */ free(dirpath); if (dirname == NULL && (dirname = strdup("./")) == NULL) return NULL; if (*dirname == '~') dirpath = fn_tilde_expand(dirname); else dirpath = strdup(dirname); if (dirpath == NULL) return NULL; dir = opendir(dirpath); if (!dir) return (NULL); /* cannot open the directory */ /* will be used in cycle */ filename_len = filename ? strlen(filename) : 0; } /* find the match */ while ((entry = readdir(dir)) != NULL) { /* skip . and .. */ if (entry->d_name[0] == '.' && (!entry->d_name[1] || (entry->d_name[1] == '.' && !entry->d_name[2]))) continue; if (filename_len == 0) break; /* otherwise, get first entry where first */ /* filename_len characters are equal */ if (entry->d_name[0] == filename[0] /* Some dirents have d_namlen, but it is not portable. */ && strlen(entry->d_name) >= filename_len && strncmp(entry->d_name, filename, filename_len) == 0) break; } if (entry) { /* match found */ /* Some dirents have d_namlen, but it is not portable. */ len = strlen(entry->d_name); temp = malloc(strlen(dirname) + len + 1); if (temp == NULL) return NULL; (void)sprintf(temp, "%s%s", dirname, entry->d_name); } else { (void)closedir(dir); dir = NULL; temp = NULL; } return (temp); } static const char * append_char_function(const char *name) { struct stat stbuf; char *expname = *name == '~' ? fn_tilde_expand(name) : NULL; const char *rs = ""; if (stat(expname ? expname : name, &stbuf) == -1) goto out; if (S_ISDIR(stbuf.st_mode)) rs = "/"; out: if (expname) free(expname); return rs; } /* * returns list of completions for text given * non-static for readline. */ char ** completion_matches(const char *, char *(*)(const char *, int)); char ** completion_matches(const char *text, char *(*genfunc)(const char *, int)) { char **match_list = NULL, *retstr, *prevstr; size_t match_list_len, max_equal, which, i; size_t matches; matches = 0; match_list_len = 1; while ((retstr = (*genfunc) (text, (int)matches)) != NULL) { /* allow for list terminator here */ if (matches + 3 >= match_list_len) { char **nmatch_list; while (matches + 3 >= match_list_len) match_list_len <<= 1; nmatch_list = realloc(match_list, match_list_len * sizeof(char *)); if (nmatch_list == NULL) { free(match_list); return NULL; } match_list = nmatch_list; } match_list[++matches] = retstr; } if (!match_list) return NULL; /* nothing found */ /* find least denominator and insert it to match_list[0] */ which = 2; prevstr = match_list[1]; max_equal = strlen(prevstr); for (; which <= matches; which++) { for (i = 0; i < max_equal && prevstr[i] == match_list[which][i]; i++) continue; max_equal = i; } retstr = malloc(max_equal + 1); if (retstr == NULL) { free(match_list); return NULL; } (void)strncpy(retstr, match_list[1], max_equal); retstr[max_equal] = '\0'; match_list[0] = retstr; /* add NULL as last pointer to the array */ match_list[matches + 1] = (char *) NULL; return (match_list); } /* * Sort function for qsort(). Just wrapper around strcasecmp(). */ static int _fn_qsort_string_compare(const void *i1, const void *i2) { const char *s1 = ((const char * const *)i1)[0]; const char *s2 = ((const char * const *)i2)[0]; return strcasecmp(s1, s2); } /* * Display list of strings in columnar format on readline's output stream. * 'matches' is list of strings, 'len' is number of strings in 'matches', * 'max' is maximum length of string in 'matches'. */ void fn_display_match_list (EditLine *el, char **matches, int len, int max) { int i, idx, limit, count; int screenwidth = el->el_term.t_size.h; /* * Find out how many entries can be put on one line, count * with two spaces between strings. */ limit = screenwidth / (max + 2); if (limit == 0) limit = 1; /* how many lines of output */ count = len / limit; if (count * limit < len) count++; /* Sort the items if they are not already sorted. */ qsort(&matches[1], (size_t)(len - 1), sizeof(char *), _fn_qsort_string_compare); idx = 1; for(; count > 0; count--) { for(i = 0; i < limit && matches[idx]; i++, idx++) (void)fprintf(el->el_outfile, "%-*s ", max, matches[idx]); (void)fprintf(el->el_outfile, "\n"); } } /* * Complete the word at or before point, * 'what_to_do' says what to do with the completion. * \t means do standard completion. * `?' means list the possible completions. * `*' means insert all of the possible completions. * `!' means to do standard completion, and list all possible completions if * there is more than one. * * Note: '*' support is not implemented * '!' could never be invoked */ int fn_complete(EditLine *el, char *(*complet_func)(const char *, int), char **(*attempted_completion_function)(const char *, int, int), const char *word_break, const char *special_prefixes, const char *(*app_func)(const char *), int query_items, int *completion_type, int *over, int *point, int *end) { const LineInfo *li; char *temp, **matches; const char *ctemp; size_t len; int what_to_do = '\t'; if (el->el_state.lastcmd == el->el_state.thiscmd) what_to_do = '?'; /* readline's rl_complete() has to be told what we did... */ if (completion_type != NULL) *completion_type = what_to_do; if (!complet_func) complet_func = fn_filename_completion_function; if (!app_func) app_func = append_char_function; /* We now look backwards for the start of a filename/variable word */ li = el_line(el); ctemp = (const char *) li->cursor; while (ctemp > li->buffer && !strchr(word_break, ctemp[-1]) && (!special_prefixes || !strchr(special_prefixes, ctemp[-1]) ) ) ctemp--; len = li->cursor - ctemp; temp = alloca(len + 1); (void)strncpy(temp, ctemp, len); temp[len] = '\0'; /* these can be used by function called in completion_matches() */ /* or (*attempted_completion_function)() */ if (point != 0) *point = li->cursor - li->buffer; if (end != NULL) *end = li->lastchar - li->buffer; if (attempted_completion_function) { int cur_off = li->cursor - li->buffer; matches = (*attempted_completion_function) (temp, (int)(cur_off - len), cur_off); } else matches = 0; if (!attempted_completion_function || (over != NULL && !*over && !matches)) matches = completion_matches(temp, complet_func); if (over != NULL) *over = 0; if (matches) { int i, retval = CC_REFRESH; int matches_num, maxlen, match_len, match_display=1; /* * Only replace the completed string with common part of * possible matches if there is possible completion. */ if (matches[0][0] != '\0') { el_deletestr(el, (int) len); el_insertstr(el, matches[0]); } if (what_to_do == '?') goto display_matches; if (matches[2] == NULL && strcmp(matches[0], matches[1]) == 0) { /* * We found exact match. Add a space after * it, unless we do filename completion and the * object is a directory. */ el_insertstr(el, (*append_char_function)(matches[0])); } else if (what_to_do == '!') { display_matches: /* * More than one match and requested to list possible * matches. */ for(i=1, maxlen=0; matches[i]; i++) { match_len = strlen(matches[i]); if (match_len > maxlen) maxlen = match_len; } matches_num = i - 1; /* newline to get on next line from command line */ (void)fprintf(el->el_outfile, "\n"); /* * If there are too many items, ask user for display * confirmation. */ if (matches_num > query_items) { (void)fprintf(el->el_outfile, "Display all %d possibilities? (y or n) ", matches_num); (void)fflush(el->el_outfile); if (getc(stdin) != 'y') match_display = 0; (void)fprintf(el->el_outfile, "\n"); } if (match_display) fn_display_match_list(el, matches, matches_num, maxlen); retval = CC_REDISPLAY; } else if (matches[0][0]) { /* * There was some common match, but the name was * not complete enough. Next tab will print possible * completions. */ el_beep(el); } else { /* lcd is not a valid object - further specification */ /* is needed */ el_beep(el); retval = CC_NORM; } /* free elements of array and the array itself */ for (i = 0; matches[i]; i++) free(matches[i]); free(matches), matches = NULL; return (retval); } return (CC_NORM); } /* * el-compatible wrapper around rl_complete; needed for key binding */ /* ARGSUSED */ unsigned char _el_fn_complete(EditLine *el, int ch __attribute__((__unused__))) { return (unsigned char)fn_complete(el, NULL, NULL, break_chars, NULL, NULL, 100, NULL, NULL, NULL, NULL); } openipmi-2.0.18/libedit/Makefile.am0000644000175000017500000000234310401067310016040 0ustar chuckchuck BUILT_SOURCES = vi.h emacs.h common.h fcns.h help.h fcns.c help.c AHDR= vi.h emacs.h common.h ASRC= $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c vi.h: Makefile $(srcdir)/vi.c sh $(srcdir)/makelist -h $(srcdir)/vi.c > $@ emacs.h: Makefile $(srcdir)/emacs.c sh $(srcdir)/makelist -h $(srcdir)/emacs.c > $@ common.h: Makefile $(srcdir)/common.c sh $(srcdir)/makelist -h $(srcdir)/common.c > $@ fcns.h: Makefile $(AHDR) sh $(srcdir)/makelist -fh $(AHDR) > $@ help.h: Makefile $(ASRC) sh $(srcdir)/makelist -bh $(ASRC) > $@ fcns.c: Makefile $(AHDR) sh $(srcdir)/makelist -fc $(AHDR) > $@ help.c: Makefile $(ASRC) sh $(srcdir)/makelist -bc $(ASRC) > $@ CLEANFILES = $(BUILT_SOURCES) noinst_LIBRARIES = libedit.a libedit_a_SOURCES = chared.c common.c el.c emacs.c hist.c key.c map.c parse.c \ prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c \ fgetln.c strlcat.c strlcpy.c unvis.c vis.c tokenizer.c \ history.c filecomplete.c readline.c chared.h el.h hist.h \ histedit.h key.h map.h parse.h prompt.h read.h refresh.h \ search.h sig.h sys.h el_term.h tty.h vis.h filecomplete.h \ editline/readline.h EXTRA_DIST = makelist orig_editline.diff orig_editline.diff2 nodist_libedit_a_SOURCES = $(BUILT_SOURCES) openipmi-2.0.18/libedit/prompt.c0000644000175000017500000001026210373140634015501 0ustar chuckchuck/* $NetBSD: prompt.c,v 1.11 2003/08/07 16:44:32 agc Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)prompt.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: prompt.c,v 1.11 2003/08/07 16:44:32 agc Exp $"); #endif #endif /* not lint && not SCCSID */ /* * prompt.c: Prompt printing functions */ #include #include "el.h" private char *prompt_default(EditLine *); private char *prompt_default_r(EditLine *); /* prompt_default(): * Just a default prompt, in case the user did not provide one */ private char * /*ARGSUSED*/ prompt_default(EditLine *el __attribute__((__unused__))) { static char a[3] = {'?', ' ', '\0'}; return (a); } /* prompt_default_r(): * Just a default rprompt, in case the user did not provide one */ private char * /*ARGSUSED*/ prompt_default_r(EditLine *el __attribute__((__unused__))) { static char a[1] = {'\0'}; return (a); } /* prompt_print(): * Print the prompt and update the prompt position. * We use an array of integers in case we want to pass * literal escape sequences in the prompt and we want a * bit to flag them */ protected void prompt_print(EditLine *el, int op) { el_prompt_t *elp; char *p; if (op == EL_PROMPT) elp = &el->el_prompt; else elp = &el->el_rprompt; p = (elp->p_func) (el); while (*p) re_putc(el, *p++, 1); elp->p_pos.v = el->el_refresh.r_cursor.v; elp->p_pos.h = el->el_refresh.r_cursor.h; } /* prompt_init(): * Initialize the prompt stuff */ protected int prompt_init(EditLine *el) { el->el_prompt.p_func = prompt_default; el->el_prompt.p_pos.v = 0; el->el_prompt.p_pos.h = 0; el->el_rprompt.p_func = prompt_default_r; el->el_rprompt.p_pos.v = 0; el->el_rprompt.p_pos.h = 0; return (0); } /* prompt_end(): * Clean up the prompt stuff */ protected void /*ARGSUSED*/ prompt_end(EditLine *el __attribute__((__unused__))) { } /* prompt_set(): * Install a prompt printing function */ protected int prompt_set(EditLine *el, el_pfunc_t prf, int op) { el_prompt_t *p; if (op == EL_PROMPT) p = &el->el_prompt; else p = &el->el_rprompt; if (prf == NULL) { if (op == EL_PROMPT) p->p_func = prompt_default; else p->p_func = prompt_default_r; } else p->p_func = prf; p->p_pos.v = 0; p->p_pos.h = 0; return (0); } /* prompt_get(): * Retrieve the prompt printing function */ protected int prompt_get(EditLine *el, el_pfunc_t *prf, int op) { if (prf == NULL) return (-1); if (op == EL_PROMPT) *prf = el->el_prompt.p_func; else *prf = el->el_rprompt.p_func; return (0); } openipmi-2.0.18/libedit/Makefile.in0000644000175000017500000004430311367554427016101 0ustar chuckchuck# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = libedit DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru libedit_a_AR = $(AR) $(ARFLAGS) libedit_a_LIBADD = am_libedit_a_OBJECTS = chared.$(OBJEXT) common.$(OBJEXT) el.$(OBJEXT) \ emacs.$(OBJEXT) hist.$(OBJEXT) key.$(OBJEXT) map.$(OBJEXT) \ parse.$(OBJEXT) prompt.$(OBJEXT) read.$(OBJEXT) \ refresh.$(OBJEXT) search.$(OBJEXT) sig.$(OBJEXT) \ term.$(OBJEXT) tty.$(OBJEXT) vi.$(OBJEXT) fgetln.$(OBJEXT) \ strlcat.$(OBJEXT) strlcpy.$(OBJEXT) unvis.$(OBJEXT) \ vis.$(OBJEXT) tokenizer.$(OBJEXT) history.$(OBJEXT) \ filecomplete.$(OBJEXT) readline.$(OBJEXT) am__objects_1 = fcns.$(OBJEXT) help.$(OBJEXT) nodist_libedit_a_OBJECTS = $(am__objects_1) libedit_a_OBJECTS = $(am_libedit_a_OBJECTS) \ $(nodist_libedit_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libedit_a_SOURCES) $(nodist_libedit_a_SOURCES) DIST_SOURCES = $(libedit_a_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BIBTEX = @BIBTEX@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIA = @DIA@ DIA_FILTER_NAME = @DIA_FILTER_NAME@ DSYMUTIL = @DSYMUTIL@ DVIPDF = @DVIPDF@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GDBM_LIB = @GDBM_LIB@ GLIB12_CFLAGS = @GLIB12_CFLAGS@ GLIB12_LIB = @GLIB12_LIB@ GLIB12_LIBS = @GLIB12_LIBS@ GLIB12_PKGCONF = @GLIB12_PKGCONF@ GLIB12_SO = @GLIB12_SO@ GLIB12_TARGET = @GLIB12_TARGET@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_DIR = @GLIB_DIR@ GLIB_LIB = @GLIB_LIB@ GLIB_LIBS = @GLIB_LIBS@ GLIB_PKGCONF = @GLIB_PKGCONF@ GLIB_SINGLE_LIB = @GLIB_SINGLE_LIB@ GLIB_SINGLE_SO = @GLIB_SINGLE_SO@ GLIB_SO = @GLIB_SO@ GLIB_TARGET = @GLIB_TARGET@ GLIB_VERSION = @GLIB_VERSION@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NMEDIT = @NMEDIT@ OBJEXT = @OBJEXT@ OPENIPMI_SMI = @OPENIPMI_SMI@ OPENIPMI_SWIG_LIBS = @OPENIPMI_SWIG_LIBS@ OPENIPMI_SWIG_SO = @OPENIPMI_SWIG_SO@ OPENIPMI_VERSION_EXTRA = @OPENIPMI_VERSION_EXTRA@ OPENIPMI_VERSION_MAJOR = @OPENIPMI_VERSION_MAJOR@ OPENIPMI_VERSION_MINOR = @OPENIPMI_VERSION_MINOR@ OPENIPMI_VERSION_RELEASE = @OPENIPMI_VERSION_RELEASE@ OPENSSLINCS = @OPENSSLINCS@ OPENSSLLIBS = @OPENSSLLIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_DIR = @PERL_DIR@ PERL_HAS_POSIX_THREADS = @PERL_HAS_POSIX_THREADS@ PERL_INSTALL_DIR = @PERL_INSTALL_DIR@ PERL_POSIX_LIB = @PERL_POSIX_LIB@ PERL_POSIX_SO = @PERL_POSIX_SO@ POPTLIBS = @POPTLIBS@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_DIR = @PYTHON_DIR@ PYTHON_GUI_DIR = @PYTHON_GUI_DIR@ PYTHON_HAS_POSIX_THREADS = @PYTHON_HAS_POSIX_THREADS@ PYTHON_INSTALL_DIR = @PYTHON_INSTALL_DIR@ PYTHON_INSTALL_LIB_DIR = @PYTHON_INSTALL_LIB_DIR@ PYTHON_POSIX_LIB = @PYTHON_POSIX_LIB@ PYTHON_POSIX_SO = @PYTHON_POSIX_SO@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNMPLIBS = @SNMPLIBS@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_DIR = @SWIG_DIR@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_DIR = @TCL_DIR@ TCL_LIB = @TCL_LIB@ TCL_LIBS = @TCL_LIBS@ TCL_PKGCONF = @TCL_PKGCONF@ TCL_SO = @TCL_SO@ TCL_TARGET = @TCL_TARGET@ TERM_LIBS = @TERM_LIBS@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ diaprog = @diaprog@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ glibprog = @glibprog@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlprog = @perlprog@ pkgprog = @pkgprog@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pythonprog = @pythonprog@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ swigprog = @swigprog@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ BUILT_SOURCES = vi.h emacs.h common.h fcns.h help.h fcns.c help.c AHDR = vi.h emacs.h common.h ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c CLEANFILES = $(BUILT_SOURCES) noinst_LIBRARIES = libedit.a libedit_a_SOURCES = chared.c common.c el.c emacs.c hist.c key.c map.c parse.c \ prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c \ fgetln.c strlcat.c strlcpy.c unvis.c vis.c tokenizer.c \ history.c filecomplete.c readline.c chared.h el.h hist.h \ histedit.h key.h map.h parse.h prompt.h read.h refresh.h \ search.h sig.h sys.h el_term.h tty.h vis.h filecomplete.h \ editline/readline.h EXTRA_DIST = makelist orig_editline.diff orig_editline.diff2 nodist_libedit_a_SOURCES = $(BUILT_SOURCES) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libedit/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu libedit/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libedit.a: $(libedit_a_OBJECTS) $(libedit_a_DEPENDENCIES) -rm -f libedit.a $(libedit_a_AR) libedit.a $(libedit_a_OBJECTS) $(libedit_a_LIBADD) $(RANLIB) libedit.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chared.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/el.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emacs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcns.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fgetln.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filecomplete.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/history.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/key.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prompt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readline.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/refresh.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sig.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strlcat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strlcpy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/term.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tokenizer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tty.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unvis.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vis.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LIBRARIES) installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-info-am vi.h: Makefile $(srcdir)/vi.c sh $(srcdir)/makelist -h $(srcdir)/vi.c > $@ emacs.h: Makefile $(srcdir)/emacs.c sh $(srcdir)/makelist -h $(srcdir)/emacs.c > $@ common.h: Makefile $(srcdir)/common.c sh $(srcdir)/makelist -h $(srcdir)/common.c > $@ fcns.h: Makefile $(AHDR) sh $(srcdir)/makelist -fh $(AHDR) > $@ help.h: Makefile $(ASRC) sh $(srcdir)/makelist -bh $(ASRC) > $@ fcns.c: Makefile $(AHDR) sh $(srcdir)/makelist -fc $(AHDR) > $@ help.c: Makefile $(ASRC) sh $(srcdir)/makelist -bc $(ASRC) > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: openipmi-2.0.18/libedit/strlcpy.c0000644000175000017500000000402110373140634015654 0ustar chuckchuck/* $NetBSD: strlcpy.c,v 1.1 2005/12/20 19:28:52 christos Exp $ */ /* $OpenBSD: strlcpy.c,v 1.7 2003/04/12 21:56:39 millert Exp $ */ /* * Copyright (c) 1998 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "sys.h" #if defined(LIBC_SCCS) && !defined(lint) __RCSID("$NetBSD: strlcpy.c,v 1.1 2005/12/20 19:28:52 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #include #include #include #ifdef _LIBC # ifdef __weak_alias __weak_alias(strlcpy, _strlcpy) # endif #endif #if !HAVE_STRLCPY /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t #ifdef _LIBC _strlcpy(dst, src, siz) #else strlcpy(dst, src, siz) #endif char *dst; const char *src; size_t siz; { char *d = dst; const char *s = src; size_t n = siz; _DIAGASSERT(dst != NULL); _DIAGASSERT(src != NULL); /* Copy as many bytes as will fit */ if (n != 0 && --n != 0) { do { if ((*d++ = *s++) == 0) break; } while (--n != 0); } /* Not enough room in dst, add NUL and traverse rest of src */ if (n == 0) { if (siz != 0) *d = '\0'; /* NUL-terminate dst */ while (*s++) ; } return(s - src - 1); /* count does not include NUL */ } #endif openipmi-2.0.18/libedit/key.h0000644000175000017500000000574210373140634014764 0ustar chuckchuck/* $NetBSD: key.h,v 1.8 2003/08/07 16:44:32 agc Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)key.h 8.1 (Berkeley) 6/4/93 */ /* * el.key.h: Key macro header */ #ifndef _h_el_key #define _h_el_key typedef union key_value_t { el_action_t cmd; /* If it is a command the # */ char *str; /* If it is a string... */ } key_value_t; typedef struct key_node_t key_node_t; typedef struct el_key_t { char *buf; /* Key print buffer */ key_node_t *map; /* Key map */ key_value_t val; /* Local conversion buffer */ } el_key_t; #define XK_CMD 0 #define XK_STR 1 #define XK_NOD 2 #define XK_EXE 3 #undef key_end #undef key_clear #undef key_print protected int key_init(EditLine *); protected void key_end(EditLine *); protected key_value_t *key_map_cmd(EditLine *, int); protected key_value_t *key_map_str(EditLine *, char *); protected void key_reset(EditLine *); protected int key_get(EditLine *, char *, key_value_t *); protected void key_add(EditLine *, const char *, key_value_t *, int); protected void key_clear(EditLine *, el_action_t *, const char *); protected int key_delete(EditLine *, const char *); protected void key_print(EditLine *, const char *); protected void key_kprint(EditLine *, const char *, key_value_t *, int); protected char *key__decode_str(const char *, char *, const char *); #endif /* _h_el_key */ openipmi-2.0.18/libedit/sig.c0000644000175000017500000001132510373140634014743 0ustar chuckchuck/* $NetBSD: sig.c,v 1.11 2003/08/07 16:44:33 agc Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: sig.c,v 1.11 2003/08/07 16:44:33 agc Exp $"); #endif #endif /* not lint && not SCCSID */ /* * sig.c: Signal handling stuff. * our policy is to trap all signals, set a good state * and pass the ball to our caller. */ #include "el.h" #include private EditLine *sel = NULL; private const int sighdl[] = { #define _DO(a) (a), ALLSIGS #undef _DO - 1 }; private void sig_handler(int); /* sig_handler(): * This is the handler called for all signals * XXX: we cannot pass any data so we just store the old editline * state in a private variable */ private void sig_handler(int signo) { int i; sigset_t nset, oset; (void) sigemptyset(&nset); (void) sigaddset(&nset, signo); (void) sigprocmask(SIG_BLOCK, &nset, &oset); switch (signo) { case SIGCONT: tty_rawmode(sel); if (ed_redisplay(sel, 0) == CC_REFRESH) re_refresh(sel); term__flush(); break; case SIGWINCH: el_resize(sel); break; default: tty_cookedmode(sel); break; } for (i = 0; sighdl[i] != -1; i++) if (signo == sighdl[i]) break; (void) signal(signo, sel->el_signal[i]); (void) sigprocmask(SIG_SETMASK, &oset, NULL); (void) kill(0, signo); } /* sig_init(): * Initialize all signal stuff */ protected int sig_init(EditLine *el) { int i; sigset_t nset, oset; (void) sigemptyset(&nset); #define _DO(a) (void) sigaddset(&nset, a); ALLSIGS #undef _DO (void) sigprocmask(SIG_BLOCK, &nset, &oset); #define SIGSIZE (sizeof(sighdl) / sizeof(sighdl[0]) * sizeof(el_signalhandler_t)) el->el_signal = (el_signalhandler_t *) el_malloc(SIGSIZE); if (el->el_signal == NULL) return (-1); for (i = 0; sighdl[i] != -1; i++) el->el_signal[i] = SIG_ERR; (void) sigprocmask(SIG_SETMASK, &oset, NULL); return (0); } /* sig_end(): * Clear all signal stuff */ protected void sig_end(EditLine *el) { el_free((ptr_t) el->el_signal); el->el_signal = NULL; } /* sig_set(): * set all the signal handlers */ protected void sig_set(EditLine *el) { int i; sigset_t nset, oset; (void) sigemptyset(&nset); #define _DO(a) (void) sigaddset(&nset, a); ALLSIGS #undef _DO (void) sigprocmask(SIG_BLOCK, &nset, &oset); for (i = 0; sighdl[i] != -1; i++) { el_signalhandler_t s; /* This could happen if we get interrupted */ if ((s = signal(sighdl[i], sig_handler)) != sig_handler) el->el_signal[i] = s; } sel = el; (void) sigprocmask(SIG_SETMASK, &oset, NULL); } /* sig_clr(): * clear all the signal handlers */ protected void sig_clr(EditLine *el) { int i; sigset_t nset, oset; (void) sigemptyset(&nset); #define _DO(a) (void) sigaddset(&nset, a); ALLSIGS #undef _DO (void) sigprocmask(SIG_BLOCK, &nset, &oset); for (i = 0; sighdl[i] != -1; i++) if (el->el_signal[i] != SIG_ERR) (void) signal(sighdl[i], el->el_signal[i]); sel = NULL; /* we are going to die if the handler is * called */ (void) sigprocmask(SIG_SETMASK, &oset, NULL); } openipmi-2.0.18/libedit/sig.h0000644000175000017500000000460510373140634014753 0ustar chuckchuck/* $NetBSD: sig.h,v 1.5 2003/08/07 16:44:33 agc Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)sig.h 8.1 (Berkeley) 6/4/93 */ /* * el.sig.h: Signal handling functions */ #ifndef _h_el_sig #define _h_el_sig #include #include "histedit.h" /* * Define here all the signals we are going to handle * The _DO macro is used to iterate in the source code */ #define ALLSIGS \ _DO(SIGINT) \ _DO(SIGTSTP) \ _DO(SIGSTOP) \ _DO(SIGQUIT) \ _DO(SIGHUP) \ _DO(SIGTERM) \ _DO(SIGCONT) \ _DO(SIGWINCH) typedef void (*el_signalhandler_t)(int); typedef el_signalhandler_t *el_signal_t; protected void sig_end(EditLine*); protected int sig_init(EditLine*); protected void sig_set(EditLine*); protected void sig_clr(EditLine*); #endif /* _h_el_sig */ openipmi-2.0.18/libedit/map.c0000644000175000017500000012272610373140634014746 0ustar chuckchuck/* $NetBSD: map.c,v 1.22 2005/08/09 13:58:44 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: map.c,v 1.22 2005/08/09 13:58:44 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * map.c: Editor function definitions */ #include #include "el.h" #define N_KEYS 256 private void map_print_key(EditLine *, el_action_t *, const char *); private void map_print_some_keys(EditLine *, el_action_t *, int, int); private void map_print_all_keys(EditLine *); private void map_init_nls(EditLine *); private void map_init_meta(EditLine *); /* keymap tables ; should be N_KEYS*sizeof(KEYCMD) bytes long */ private const el_action_t el_map_emacs[] = { /* 0 */ EM_SET_MARK, /* ^@ */ /* 1 */ ED_MOVE_TO_BEG, /* ^A */ /* 2 */ ED_PREV_CHAR, /* ^B */ /* 3 */ ED_TTY_SIGINT, /* ^C */ /* 4 */ EM_DELETE_OR_LIST, /* ^D */ /* 5 */ ED_MOVE_TO_END, /* ^E */ /* 6 */ ED_NEXT_CHAR, /* ^F */ /* 7 */ ED_UNASSIGNED, /* ^G */ /* 8 */ EM_DELETE_PREV_CHAR, /* ^H */ /* 9 */ ED_UNASSIGNED, /* ^I */ /* 10 */ ED_NEWLINE, /* ^J */ /* 11 */ ED_KILL_LINE, /* ^K */ /* 12 */ ED_CLEAR_SCREEN, /* ^L */ /* 13 */ ED_NEWLINE, /* ^M */ /* 14 */ ED_NEXT_HISTORY, /* ^N */ /* 15 */ ED_TTY_FLUSH_OUTPUT, /* ^O */ /* 16 */ ED_PREV_HISTORY, /* ^P */ /* 17 */ ED_TTY_START_OUTPUT, /* ^Q */ /* 18 */ ED_REDISPLAY, /* ^R */ /* 19 */ ED_TTY_STOP_OUTPUT, /* ^S */ /* 20 */ ED_TRANSPOSE_CHARS, /* ^T */ /* 21 */ EM_KILL_LINE, /* ^U */ /* 22 */ ED_QUOTED_INSERT, /* ^V */ /* 23 */ EM_KILL_REGION, /* ^W */ /* 24 */ ED_SEQUENCE_LEAD_IN, /* ^X */ /* 25 */ EM_YANK, /* ^Y */ /* 26 */ ED_TTY_SIGTSTP, /* ^Z */ /* 27 */ EM_META_NEXT, /* ^[ */ /* 28 */ ED_TTY_SIGQUIT, /* ^\ */ /* 29 */ ED_TTY_DSUSP, /* ^] */ /* 30 */ ED_UNASSIGNED, /* ^^ */ /* 31 */ ED_UNASSIGNED, /* ^_ */ /* 32 */ ED_INSERT, /* SPACE */ /* 33 */ ED_INSERT, /* ! */ /* 34 */ ED_INSERT, /* " */ /* 35 */ ED_INSERT, /* # */ /* 36 */ ED_INSERT, /* $ */ /* 37 */ ED_INSERT, /* % */ /* 38 */ ED_INSERT, /* & */ /* 39 */ ED_INSERT, /* ' */ /* 40 */ ED_INSERT, /* ( */ /* 41 */ ED_INSERT, /* ) */ /* 42 */ ED_INSERT, /* * */ /* 43 */ ED_INSERT, /* + */ /* 44 */ ED_INSERT, /* , */ /* 45 */ ED_INSERT, /* - */ /* 46 */ ED_INSERT, /* . */ /* 47 */ ED_INSERT, /* / */ /* 48 */ ED_DIGIT, /* 0 */ /* 49 */ ED_DIGIT, /* 1 */ /* 50 */ ED_DIGIT, /* 2 */ /* 51 */ ED_DIGIT, /* 3 */ /* 52 */ ED_DIGIT, /* 4 */ /* 53 */ ED_DIGIT, /* 5 */ /* 54 */ ED_DIGIT, /* 6 */ /* 55 */ ED_DIGIT, /* 7 */ /* 56 */ ED_DIGIT, /* 8 */ /* 57 */ ED_DIGIT, /* 9 */ /* 58 */ ED_INSERT, /* : */ /* 59 */ ED_INSERT, /* ; */ /* 60 */ ED_INSERT, /* < */ /* 61 */ ED_INSERT, /* = */ /* 62 */ ED_INSERT, /* > */ /* 63 */ ED_INSERT, /* ? */ /* 64 */ ED_INSERT, /* @ */ /* 65 */ ED_INSERT, /* A */ /* 66 */ ED_INSERT, /* B */ /* 67 */ ED_INSERT, /* C */ /* 68 */ ED_INSERT, /* D */ /* 69 */ ED_INSERT, /* E */ /* 70 */ ED_INSERT, /* F */ /* 71 */ ED_INSERT, /* G */ /* 72 */ ED_INSERT, /* H */ /* 73 */ ED_INSERT, /* I */ /* 74 */ ED_INSERT, /* J */ /* 75 */ ED_INSERT, /* K */ /* 76 */ ED_INSERT, /* L */ /* 77 */ ED_INSERT, /* M */ /* 78 */ ED_INSERT, /* N */ /* 79 */ ED_INSERT, /* O */ /* 80 */ ED_INSERT, /* P */ /* 81 */ ED_INSERT, /* Q */ /* 82 */ ED_INSERT, /* R */ /* 83 */ ED_INSERT, /* S */ /* 84 */ ED_INSERT, /* T */ /* 85 */ ED_INSERT, /* U */ /* 86 */ ED_INSERT, /* V */ /* 87 */ ED_INSERT, /* W */ /* 88 */ ED_INSERT, /* X */ /* 89 */ ED_INSERT, /* Y */ /* 90 */ ED_INSERT, /* Z */ /* 91 */ ED_INSERT, /* [ */ /* 92 */ ED_INSERT, /* \ */ /* 93 */ ED_INSERT, /* ] */ /* 94 */ ED_INSERT, /* ^ */ /* 95 */ ED_INSERT, /* _ */ /* 96 */ ED_INSERT, /* ` */ /* 97 */ ED_INSERT, /* a */ /* 98 */ ED_INSERT, /* b */ /* 99 */ ED_INSERT, /* c */ /* 100 */ ED_INSERT, /* d */ /* 101 */ ED_INSERT, /* e */ /* 102 */ ED_INSERT, /* f */ /* 103 */ ED_INSERT, /* g */ /* 104 */ ED_INSERT, /* h */ /* 105 */ ED_INSERT, /* i */ /* 106 */ ED_INSERT, /* j */ /* 107 */ ED_INSERT, /* k */ /* 108 */ ED_INSERT, /* l */ /* 109 */ ED_INSERT, /* m */ /* 110 */ ED_INSERT, /* n */ /* 111 */ ED_INSERT, /* o */ /* 112 */ ED_INSERT, /* p */ /* 113 */ ED_INSERT, /* q */ /* 114 */ ED_INSERT, /* r */ /* 115 */ ED_INSERT, /* s */ /* 116 */ ED_INSERT, /* t */ /* 117 */ ED_INSERT, /* u */ /* 118 */ ED_INSERT, /* v */ /* 119 */ ED_INSERT, /* w */ /* 120 */ ED_INSERT, /* x */ /* 121 */ ED_INSERT, /* y */ /* 122 */ ED_INSERT, /* z */ /* 123 */ ED_INSERT, /* { */ /* 124 */ ED_INSERT, /* | */ /* 125 */ ED_INSERT, /* } */ /* 126 */ ED_INSERT, /* ~ */ /* 127 */ EM_DELETE_PREV_CHAR, /* ^? */ /* 128 */ ED_UNASSIGNED, /* M-^@ */ /* 129 */ ED_UNASSIGNED, /* M-^A */ /* 130 */ ED_UNASSIGNED, /* M-^B */ /* 131 */ ED_UNASSIGNED, /* M-^C */ /* 132 */ ED_UNASSIGNED, /* M-^D */ /* 133 */ ED_UNASSIGNED, /* M-^E */ /* 134 */ ED_UNASSIGNED, /* M-^F */ /* 135 */ ED_UNASSIGNED, /* M-^G */ /* 136 */ ED_DELETE_PREV_WORD, /* M-^H */ /* 137 */ ED_UNASSIGNED, /* M-^I */ /* 138 */ ED_UNASSIGNED, /* M-^J */ /* 139 */ ED_UNASSIGNED, /* M-^K */ /* 140 */ ED_CLEAR_SCREEN, /* M-^L */ /* 141 */ ED_UNASSIGNED, /* M-^M */ /* 142 */ ED_UNASSIGNED, /* M-^N */ /* 143 */ ED_UNASSIGNED, /* M-^O */ /* 144 */ ED_UNASSIGNED, /* M-^P */ /* 145 */ ED_UNASSIGNED, /* M-^Q */ /* 146 */ ED_UNASSIGNED, /* M-^R */ /* 147 */ ED_UNASSIGNED, /* M-^S */ /* 148 */ ED_UNASSIGNED, /* M-^T */ /* 149 */ ED_UNASSIGNED, /* M-^U */ /* 150 */ ED_UNASSIGNED, /* M-^V */ /* 151 */ ED_UNASSIGNED, /* M-^W */ /* 152 */ ED_UNASSIGNED, /* M-^X */ /* 153 */ ED_UNASSIGNED, /* M-^Y */ /* 154 */ ED_UNASSIGNED, /* M-^Z */ /* 155 */ ED_UNASSIGNED, /* M-^[ */ /* 156 */ ED_UNASSIGNED, /* M-^\ */ /* 157 */ ED_UNASSIGNED, /* M-^] */ /* 158 */ ED_UNASSIGNED, /* M-^^ */ /* 159 */ EM_COPY_PREV_WORD, /* M-^_ */ /* 160 */ ED_UNASSIGNED, /* M-SPACE */ /* 161 */ ED_UNASSIGNED, /* M-! */ /* 162 */ ED_UNASSIGNED, /* M-" */ /* 163 */ ED_UNASSIGNED, /* M-# */ /* 164 */ ED_UNASSIGNED, /* M-$ */ /* 165 */ ED_UNASSIGNED, /* M-% */ /* 166 */ ED_UNASSIGNED, /* M-& */ /* 167 */ ED_UNASSIGNED, /* M-' */ /* 168 */ ED_UNASSIGNED, /* M-( */ /* 169 */ ED_UNASSIGNED, /* M-) */ /* 170 */ ED_UNASSIGNED, /* M-* */ /* 171 */ ED_UNASSIGNED, /* M-+ */ /* 172 */ ED_UNASSIGNED, /* M-, */ /* 173 */ ED_UNASSIGNED, /* M-- */ /* 174 */ ED_UNASSIGNED, /* M-. */ /* 175 */ ED_UNASSIGNED, /* M-/ */ /* 176 */ ED_ARGUMENT_DIGIT, /* M-0 */ /* 177 */ ED_ARGUMENT_DIGIT, /* M-1 */ /* 178 */ ED_ARGUMENT_DIGIT, /* M-2 */ /* 179 */ ED_ARGUMENT_DIGIT, /* M-3 */ /* 180 */ ED_ARGUMENT_DIGIT, /* M-4 */ /* 181 */ ED_ARGUMENT_DIGIT, /* M-5 */ /* 182 */ ED_ARGUMENT_DIGIT, /* M-6 */ /* 183 */ ED_ARGUMENT_DIGIT, /* M-7 */ /* 184 */ ED_ARGUMENT_DIGIT, /* M-8 */ /* 185 */ ED_ARGUMENT_DIGIT, /* M-9 */ /* 186 */ ED_UNASSIGNED, /* M-: */ /* 187 */ ED_UNASSIGNED, /* M-; */ /* 188 */ ED_UNASSIGNED, /* M-< */ /* 189 */ ED_UNASSIGNED, /* M-= */ /* 190 */ ED_UNASSIGNED, /* M-> */ /* 191 */ ED_UNASSIGNED, /* M-? */ /* 192 */ ED_UNASSIGNED, /* M-@ */ /* 193 */ ED_UNASSIGNED, /* M-A */ /* 194 */ ED_PREV_WORD, /* M-B */ /* 195 */ EM_CAPITOL_CASE, /* M-C */ /* 196 */ EM_DELETE_NEXT_WORD, /* M-D */ /* 197 */ ED_UNASSIGNED, /* M-E */ /* 198 */ EM_NEXT_WORD, /* M-F */ /* 199 */ ED_UNASSIGNED, /* M-G */ /* 200 */ ED_UNASSIGNED, /* M-H */ /* 201 */ ED_UNASSIGNED, /* M-I */ /* 202 */ ED_UNASSIGNED, /* M-J */ /* 203 */ ED_UNASSIGNED, /* M-K */ /* 204 */ EM_LOWER_CASE, /* M-L */ /* 205 */ ED_UNASSIGNED, /* M-M */ /* 206 */ ED_SEARCH_NEXT_HISTORY, /* M-N */ /* 207 */ ED_SEQUENCE_LEAD_IN, /* M-O */ /* 208 */ ED_SEARCH_PREV_HISTORY, /* M-P */ /* 209 */ ED_UNASSIGNED, /* M-Q */ /* 210 */ ED_UNASSIGNED, /* M-R */ /* 211 */ ED_UNASSIGNED, /* M-S */ /* 212 */ ED_UNASSIGNED, /* M-T */ /* 213 */ EM_UPPER_CASE, /* M-U */ /* 214 */ ED_UNASSIGNED, /* M-V */ /* 215 */ EM_COPY_REGION, /* M-W */ /* 216 */ ED_COMMAND, /* M-X */ /* 217 */ ED_UNASSIGNED, /* M-Y */ /* 218 */ ED_UNASSIGNED, /* M-Z */ /* 219 */ ED_SEQUENCE_LEAD_IN, /* M-[ */ /* 220 */ ED_UNASSIGNED, /* M-\ */ /* 221 */ ED_UNASSIGNED, /* M-] */ /* 222 */ ED_UNASSIGNED, /* M-^ */ /* 223 */ ED_UNASSIGNED, /* M-_ */ /* 223 */ ED_UNASSIGNED, /* M-` */ /* 224 */ ED_UNASSIGNED, /* M-a */ /* 225 */ ED_PREV_WORD, /* M-b */ /* 226 */ EM_CAPITOL_CASE, /* M-c */ /* 227 */ EM_DELETE_NEXT_WORD, /* M-d */ /* 228 */ ED_UNASSIGNED, /* M-e */ /* 229 */ EM_NEXT_WORD, /* M-f */ /* 230 */ ED_UNASSIGNED, /* M-g */ /* 231 */ ED_UNASSIGNED, /* M-h */ /* 232 */ ED_UNASSIGNED, /* M-i */ /* 233 */ ED_UNASSIGNED, /* M-j */ /* 234 */ ED_UNASSIGNED, /* M-k */ /* 235 */ EM_LOWER_CASE, /* M-l */ /* 236 */ ED_UNASSIGNED, /* M-m */ /* 237 */ ED_SEARCH_NEXT_HISTORY, /* M-n */ /* 238 */ ED_UNASSIGNED, /* M-o */ /* 239 */ ED_SEARCH_PREV_HISTORY, /* M-p */ /* 240 */ ED_UNASSIGNED, /* M-q */ /* 241 */ ED_UNASSIGNED, /* M-r */ /* 242 */ ED_UNASSIGNED, /* M-s */ /* 243 */ ED_UNASSIGNED, /* M-t */ /* 244 */ EM_UPPER_CASE, /* M-u */ /* 245 */ ED_UNASSIGNED, /* M-v */ /* 246 */ EM_COPY_REGION, /* M-w */ /* 247 */ ED_COMMAND, /* M-x */ /* 248 */ ED_UNASSIGNED, /* M-y */ /* 249 */ ED_UNASSIGNED, /* M-z */ /* 250 */ ED_UNASSIGNED, /* M-{ */ /* 251 */ ED_UNASSIGNED, /* M-| */ /* 252 */ ED_UNASSIGNED, /* M-} */ /* 253 */ ED_UNASSIGNED, /* M-~ */ /* 254 */ ED_DELETE_PREV_WORD /* M-^? */ /* 255 */ }; /* * keymap table for vi. Each index into above tbl; should be * N_KEYS entries long. Vi mode uses a sticky-extend to do command mode: * insert mode characters are in the normal keymap, and command mode * in the extended keymap. */ private const el_action_t el_map_vi_insert[] = { #ifdef KSHVI /* 0 */ ED_UNASSIGNED, /* ^@ */ /* 1 */ ED_INSERT, /* ^A */ /* 2 */ ED_INSERT, /* ^B */ /* 3 */ ED_INSERT, /* ^C */ /* 4 */ VI_LIST_OR_EOF, /* ^D */ /* 5 */ ED_INSERT, /* ^E */ /* 6 */ ED_INSERT, /* ^F */ /* 7 */ ED_INSERT, /* ^G */ /* 8 */ VI_DELETE_PREV_CHAR, /* ^H */ /* BackSpace key */ /* 9 */ ED_INSERT, /* ^I */ /* Tab Key */ /* 10 */ ED_NEWLINE, /* ^J */ /* 11 */ ED_INSERT, /* ^K */ /* 12 */ ED_INSERT, /* ^L */ /* 13 */ ED_NEWLINE, /* ^M */ /* 14 */ ED_INSERT, /* ^N */ /* 15 */ ED_INSERT, /* ^O */ /* 16 */ ED_INSERT, /* ^P */ /* 17 */ ED_TTY_START_OUTPUT, /* ^Q */ /* 18 */ ED_INSERT, /* ^R */ /* 19 */ ED_TTY_STOP_OUTPUT, /* ^S */ /* 20 */ ED_INSERT, /* ^T */ /* 21 */ VI_KILL_LINE_PREV, /* ^U */ /* 22 */ ED_QUOTED_INSERT, /* ^V */ /* 23 */ ED_DELETE_PREV_WORD, /* ^W */ /* ED_DELETE_PREV_WORD: Only until strt edit pos */ /* 24 */ ED_INSERT, /* ^X */ /* 25 */ ED_INSERT, /* ^Y */ /* 26 */ ED_INSERT, /* ^Z */ /* 27 */ VI_COMMAND_MODE, /* ^[ */ /* [ Esc ] key */ /* 28 */ ED_TTY_SIGQUIT, /* ^\ */ /* 29 */ ED_INSERT, /* ^] */ /* 30 */ ED_INSERT, /* ^^ */ /* 31 */ ED_INSERT, /* ^_ */ #else /* !KSHVI */ /* * NOTE: These mappings do NOT Correspond well * to the KSH VI editing assignments. * On the other and they are convenient and * many people have have gotten used to them. */ /* 0 */ ED_UNASSIGNED, /* ^@ */ /* 1 */ ED_MOVE_TO_BEG, /* ^A */ /* 2 */ ED_PREV_CHAR, /* ^B */ /* 3 */ ED_TTY_SIGINT, /* ^C */ /* 4 */ VI_LIST_OR_EOF, /* ^D */ /* 5 */ ED_MOVE_TO_END, /* ^E */ /* 6 */ ED_NEXT_CHAR, /* ^F */ /* 7 */ ED_UNASSIGNED, /* ^G */ /* 8 */ VI_DELETE_PREV_CHAR, /* ^H */ /* BackSpace key */ /* 9 */ ED_UNASSIGNED, /* ^I */ /* Tab Key */ /* 10 */ ED_NEWLINE, /* ^J */ /* 11 */ ED_KILL_LINE, /* ^K */ /* 12 */ ED_CLEAR_SCREEN, /* ^L */ /* 13 */ ED_NEWLINE, /* ^M */ /* 14 */ ED_NEXT_HISTORY, /* ^N */ /* 15 */ ED_TTY_FLUSH_OUTPUT, /* ^O */ /* 16 */ ED_PREV_HISTORY, /* ^P */ /* 17 */ ED_TTY_START_OUTPUT, /* ^Q */ /* 18 */ ED_REDISPLAY, /* ^R */ /* 19 */ ED_TTY_STOP_OUTPUT, /* ^S */ /* 20 */ ED_TRANSPOSE_CHARS, /* ^T */ /* 21 */ VI_KILL_LINE_PREV, /* ^U */ /* 22 */ ED_QUOTED_INSERT, /* ^V */ /* 23 */ ED_DELETE_PREV_WORD, /* ^W */ /* 24 */ ED_UNASSIGNED, /* ^X */ /* 25 */ ED_TTY_DSUSP, /* ^Y */ /* 26 */ ED_TTY_SIGTSTP, /* ^Z */ /* 27 */ VI_COMMAND_MODE, /* ^[ */ /* 28 */ ED_TTY_SIGQUIT, /* ^\ */ /* 29 */ ED_UNASSIGNED, /* ^] */ /* 30 */ ED_UNASSIGNED, /* ^^ */ /* 31 */ ED_UNASSIGNED, /* ^_ */ #endif /* KSHVI */ /* 32 */ ED_INSERT, /* SPACE */ /* 33 */ ED_INSERT, /* ! */ /* 34 */ ED_INSERT, /* " */ /* 35 */ ED_INSERT, /* # */ /* 36 */ ED_INSERT, /* $ */ /* 37 */ ED_INSERT, /* % */ /* 38 */ ED_INSERT, /* & */ /* 39 */ ED_INSERT, /* ' */ /* 40 */ ED_INSERT, /* ( */ /* 41 */ ED_INSERT, /* ) */ /* 42 */ ED_INSERT, /* * */ /* 43 */ ED_INSERT, /* + */ /* 44 */ ED_INSERT, /* , */ /* 45 */ ED_INSERT, /* - */ /* 46 */ ED_INSERT, /* . */ /* 47 */ ED_INSERT, /* / */ /* 48 */ ED_INSERT, /* 0 */ /* 49 */ ED_INSERT, /* 1 */ /* 50 */ ED_INSERT, /* 2 */ /* 51 */ ED_INSERT, /* 3 */ /* 52 */ ED_INSERT, /* 4 */ /* 53 */ ED_INSERT, /* 5 */ /* 54 */ ED_INSERT, /* 6 */ /* 55 */ ED_INSERT, /* 7 */ /* 56 */ ED_INSERT, /* 8 */ /* 57 */ ED_INSERT, /* 9 */ /* 58 */ ED_INSERT, /* : */ /* 59 */ ED_INSERT, /* ; */ /* 60 */ ED_INSERT, /* < */ /* 61 */ ED_INSERT, /* = */ /* 62 */ ED_INSERT, /* > */ /* 63 */ ED_INSERT, /* ? */ /* 64 */ ED_INSERT, /* @ */ /* 65 */ ED_INSERT, /* A */ /* 66 */ ED_INSERT, /* B */ /* 67 */ ED_INSERT, /* C */ /* 68 */ ED_INSERT, /* D */ /* 69 */ ED_INSERT, /* E */ /* 70 */ ED_INSERT, /* F */ /* 71 */ ED_INSERT, /* G */ /* 72 */ ED_INSERT, /* H */ /* 73 */ ED_INSERT, /* I */ /* 74 */ ED_INSERT, /* J */ /* 75 */ ED_INSERT, /* K */ /* 76 */ ED_INSERT, /* L */ /* 77 */ ED_INSERT, /* M */ /* 78 */ ED_INSERT, /* N */ /* 79 */ ED_INSERT, /* O */ /* 80 */ ED_INSERT, /* P */ /* 81 */ ED_INSERT, /* Q */ /* 82 */ ED_INSERT, /* R */ /* 83 */ ED_INSERT, /* S */ /* 84 */ ED_INSERT, /* T */ /* 85 */ ED_INSERT, /* U */ /* 86 */ ED_INSERT, /* V */ /* 87 */ ED_INSERT, /* W */ /* 88 */ ED_INSERT, /* X */ /* 89 */ ED_INSERT, /* Y */ /* 90 */ ED_INSERT, /* Z */ /* 91 */ ED_INSERT, /* [ */ /* 92 */ ED_INSERT, /* \ */ /* 93 */ ED_INSERT, /* ] */ /* 94 */ ED_INSERT, /* ^ */ /* 95 */ ED_INSERT, /* _ */ /* 96 */ ED_INSERT, /* ` */ /* 97 */ ED_INSERT, /* a */ /* 98 */ ED_INSERT, /* b */ /* 99 */ ED_INSERT, /* c */ /* 100 */ ED_INSERT, /* d */ /* 101 */ ED_INSERT, /* e */ /* 102 */ ED_INSERT, /* f */ /* 103 */ ED_INSERT, /* g */ /* 104 */ ED_INSERT, /* h */ /* 105 */ ED_INSERT, /* i */ /* 106 */ ED_INSERT, /* j */ /* 107 */ ED_INSERT, /* k */ /* 108 */ ED_INSERT, /* l */ /* 109 */ ED_INSERT, /* m */ /* 110 */ ED_INSERT, /* n */ /* 111 */ ED_INSERT, /* o */ /* 112 */ ED_INSERT, /* p */ /* 113 */ ED_INSERT, /* q */ /* 114 */ ED_INSERT, /* r */ /* 115 */ ED_INSERT, /* s */ /* 116 */ ED_INSERT, /* t */ /* 117 */ ED_INSERT, /* u */ /* 118 */ ED_INSERT, /* v */ /* 119 */ ED_INSERT, /* w */ /* 120 */ ED_INSERT, /* x */ /* 121 */ ED_INSERT, /* y */ /* 122 */ ED_INSERT, /* z */ /* 123 */ ED_INSERT, /* { */ /* 124 */ ED_INSERT, /* | */ /* 125 */ ED_INSERT, /* } */ /* 126 */ ED_INSERT, /* ~ */ /* 127 */ VI_DELETE_PREV_CHAR, /* ^? */ /* 128 */ ED_INSERT, /* M-^@ */ /* 129 */ ED_INSERT, /* M-^A */ /* 130 */ ED_INSERT, /* M-^B */ /* 131 */ ED_INSERT, /* M-^C */ /* 132 */ ED_INSERT, /* M-^D */ /* 133 */ ED_INSERT, /* M-^E */ /* 134 */ ED_INSERT, /* M-^F */ /* 135 */ ED_INSERT, /* M-^G */ /* 136 */ ED_INSERT, /* M-^H */ /* 137 */ ED_INSERT, /* M-^I */ /* 138 */ ED_INSERT, /* M-^J */ /* 139 */ ED_INSERT, /* M-^K */ /* 140 */ ED_INSERT, /* M-^L */ /* 141 */ ED_INSERT, /* M-^M */ /* 142 */ ED_INSERT, /* M-^N */ /* 143 */ ED_INSERT, /* M-^O */ /* 144 */ ED_INSERT, /* M-^P */ /* 145 */ ED_INSERT, /* M-^Q */ /* 146 */ ED_INSERT, /* M-^R */ /* 147 */ ED_INSERT, /* M-^S */ /* 148 */ ED_INSERT, /* M-^T */ /* 149 */ ED_INSERT, /* M-^U */ /* 150 */ ED_INSERT, /* M-^V */ /* 151 */ ED_INSERT, /* M-^W */ /* 152 */ ED_INSERT, /* M-^X */ /* 153 */ ED_INSERT, /* M-^Y */ /* 154 */ ED_INSERT, /* M-^Z */ /* 155 */ ED_INSERT, /* M-^[ */ /* 156 */ ED_INSERT, /* M-^\ */ /* 157 */ ED_INSERT, /* M-^] */ /* 158 */ ED_INSERT, /* M-^^ */ /* 159 */ ED_INSERT, /* M-^_ */ /* 160 */ ED_INSERT, /* M-SPACE */ /* 161 */ ED_INSERT, /* M-! */ /* 162 */ ED_INSERT, /* M-" */ /* 163 */ ED_INSERT, /* M-# */ /* 164 */ ED_INSERT, /* M-$ */ /* 165 */ ED_INSERT, /* M-% */ /* 166 */ ED_INSERT, /* M-& */ /* 167 */ ED_INSERT, /* M-' */ /* 168 */ ED_INSERT, /* M-( */ /* 169 */ ED_INSERT, /* M-) */ /* 170 */ ED_INSERT, /* M-* */ /* 171 */ ED_INSERT, /* M-+ */ /* 172 */ ED_INSERT, /* M-, */ /* 173 */ ED_INSERT, /* M-- */ /* 174 */ ED_INSERT, /* M-. */ /* 175 */ ED_INSERT, /* M-/ */ /* 176 */ ED_INSERT, /* M-0 */ /* 177 */ ED_INSERT, /* M-1 */ /* 178 */ ED_INSERT, /* M-2 */ /* 179 */ ED_INSERT, /* M-3 */ /* 180 */ ED_INSERT, /* M-4 */ /* 181 */ ED_INSERT, /* M-5 */ /* 182 */ ED_INSERT, /* M-6 */ /* 183 */ ED_INSERT, /* M-7 */ /* 184 */ ED_INSERT, /* M-8 */ /* 185 */ ED_INSERT, /* M-9 */ /* 186 */ ED_INSERT, /* M-: */ /* 187 */ ED_INSERT, /* M-; */ /* 188 */ ED_INSERT, /* M-< */ /* 189 */ ED_INSERT, /* M-= */ /* 190 */ ED_INSERT, /* M-> */ /* 191 */ ED_INSERT, /* M-? */ /* 192 */ ED_INSERT, /* M-@ */ /* 193 */ ED_INSERT, /* M-A */ /* 194 */ ED_INSERT, /* M-B */ /* 195 */ ED_INSERT, /* M-C */ /* 196 */ ED_INSERT, /* M-D */ /* 197 */ ED_INSERT, /* M-E */ /* 198 */ ED_INSERT, /* M-F */ /* 199 */ ED_INSERT, /* M-G */ /* 200 */ ED_INSERT, /* M-H */ /* 201 */ ED_INSERT, /* M-I */ /* 202 */ ED_INSERT, /* M-J */ /* 203 */ ED_INSERT, /* M-K */ /* 204 */ ED_INSERT, /* M-L */ /* 205 */ ED_INSERT, /* M-M */ /* 206 */ ED_INSERT, /* M-N */ /* 207 */ ED_INSERT, /* M-O */ /* 208 */ ED_INSERT, /* M-P */ /* 209 */ ED_INSERT, /* M-Q */ /* 210 */ ED_INSERT, /* M-R */ /* 211 */ ED_INSERT, /* M-S */ /* 212 */ ED_INSERT, /* M-T */ /* 213 */ ED_INSERT, /* M-U */ /* 214 */ ED_INSERT, /* M-V */ /* 215 */ ED_INSERT, /* M-W */ /* 216 */ ED_INSERT, /* M-X */ /* 217 */ ED_INSERT, /* M-Y */ /* 218 */ ED_INSERT, /* M-Z */ /* 219 */ ED_INSERT, /* M-[ */ /* 220 */ ED_INSERT, /* M-\ */ /* 221 */ ED_INSERT, /* M-] */ /* 222 */ ED_INSERT, /* M-^ */ /* 223 */ ED_INSERT, /* M-_ */ /* 224 */ ED_INSERT, /* M-` */ /* 225 */ ED_INSERT, /* M-a */ /* 226 */ ED_INSERT, /* M-b */ /* 227 */ ED_INSERT, /* M-c */ /* 228 */ ED_INSERT, /* M-d */ /* 229 */ ED_INSERT, /* M-e */ /* 230 */ ED_INSERT, /* M-f */ /* 231 */ ED_INSERT, /* M-g */ /* 232 */ ED_INSERT, /* M-h */ /* 233 */ ED_INSERT, /* M-i */ /* 234 */ ED_INSERT, /* M-j */ /* 235 */ ED_INSERT, /* M-k */ /* 236 */ ED_INSERT, /* M-l */ /* 237 */ ED_INSERT, /* M-m */ /* 238 */ ED_INSERT, /* M-n */ /* 239 */ ED_INSERT, /* M-o */ /* 240 */ ED_INSERT, /* M-p */ /* 241 */ ED_INSERT, /* M-q */ /* 242 */ ED_INSERT, /* M-r */ /* 243 */ ED_INSERT, /* M-s */ /* 244 */ ED_INSERT, /* M-t */ /* 245 */ ED_INSERT, /* M-u */ /* 246 */ ED_INSERT, /* M-v */ /* 247 */ ED_INSERT, /* M-w */ /* 248 */ ED_INSERT, /* M-x */ /* 249 */ ED_INSERT, /* M-y */ /* 250 */ ED_INSERT, /* M-z */ /* 251 */ ED_INSERT, /* M-{ */ /* 252 */ ED_INSERT, /* M-| */ /* 253 */ ED_INSERT, /* M-} */ /* 254 */ ED_INSERT, /* M-~ */ /* 255 */ ED_INSERT /* M-^? */ }; private const el_action_t el_map_vi_command[] = { /* 0 */ ED_UNASSIGNED, /* ^@ */ /* 1 */ ED_MOVE_TO_BEG, /* ^A */ /* 2 */ ED_UNASSIGNED, /* ^B */ /* 3 */ ED_TTY_SIGINT, /* ^C */ /* 4 */ ED_UNASSIGNED, /* ^D */ /* 5 */ ED_MOVE_TO_END, /* ^E */ /* 6 */ ED_UNASSIGNED, /* ^F */ /* 7 */ ED_UNASSIGNED, /* ^G */ /* 8 */ ED_DELETE_PREV_CHAR, /* ^H */ /* 9 */ ED_UNASSIGNED, /* ^I */ /* 10 */ ED_NEWLINE, /* ^J */ /* 11 */ ED_KILL_LINE, /* ^K */ /* 12 */ ED_CLEAR_SCREEN, /* ^L */ /* 13 */ ED_NEWLINE, /* ^M */ /* 14 */ ED_NEXT_HISTORY, /* ^N */ /* 15 */ ED_TTY_FLUSH_OUTPUT, /* ^O */ /* 16 */ ED_PREV_HISTORY, /* ^P */ /* 17 */ ED_TTY_START_OUTPUT, /* ^Q */ /* 18 */ ED_REDISPLAY, /* ^R */ /* 19 */ ED_TTY_STOP_OUTPUT, /* ^S */ /* 20 */ ED_UNASSIGNED, /* ^T */ /* 21 */ VI_KILL_LINE_PREV, /* ^U */ /* 22 */ ED_UNASSIGNED, /* ^V */ /* 23 */ ED_DELETE_PREV_WORD, /* ^W */ /* 24 */ ED_UNASSIGNED, /* ^X */ /* 25 */ ED_UNASSIGNED, /* ^Y */ /* 26 */ ED_UNASSIGNED, /* ^Z */ /* 27 */ EM_META_NEXT, /* ^[ */ /* 28 */ ED_TTY_SIGQUIT, /* ^\ */ /* 29 */ ED_UNASSIGNED, /* ^] */ /* 30 */ ED_UNASSIGNED, /* ^^ */ /* 31 */ ED_UNASSIGNED, /* ^_ */ /* 32 */ ED_NEXT_CHAR, /* SPACE */ /* 33 */ ED_UNASSIGNED, /* ! */ /* 34 */ ED_UNASSIGNED, /* " */ /* 35 */ VI_COMMENT_OUT, /* # */ /* 36 */ ED_MOVE_TO_END, /* $ */ /* 37 */ VI_MATCH, /* % */ /* 38 */ ED_UNASSIGNED, /* & */ /* 39 */ ED_UNASSIGNED, /* ' */ /* 40 */ ED_UNASSIGNED, /* ( */ /* 41 */ ED_UNASSIGNED, /* ) */ /* 42 */ ED_UNASSIGNED, /* * */ /* 43 */ ED_NEXT_HISTORY, /* + */ /* 44 */ VI_REPEAT_PREV_CHAR, /* , */ /* 45 */ ED_PREV_HISTORY, /* - */ /* 46 */ VI_REDO, /* . */ /* 47 */ VI_SEARCH_PREV, /* / */ /* 48 */ VI_ZERO, /* 0 */ /* 49 */ ED_ARGUMENT_DIGIT, /* 1 */ /* 50 */ ED_ARGUMENT_DIGIT, /* 2 */ /* 51 */ ED_ARGUMENT_DIGIT, /* 3 */ /* 52 */ ED_ARGUMENT_DIGIT, /* 4 */ /* 53 */ ED_ARGUMENT_DIGIT, /* 5 */ /* 54 */ ED_ARGUMENT_DIGIT, /* 6 */ /* 55 */ ED_ARGUMENT_DIGIT, /* 7 */ /* 56 */ ED_ARGUMENT_DIGIT, /* 8 */ /* 57 */ ED_ARGUMENT_DIGIT, /* 9 */ /* 58 */ ED_COMMAND, /* : */ /* 59 */ VI_REPEAT_NEXT_CHAR, /* ; */ /* 60 */ ED_UNASSIGNED, /* < */ /* 61 */ ED_UNASSIGNED, /* = */ /* 62 */ ED_UNASSIGNED, /* > */ /* 63 */ VI_SEARCH_NEXT, /* ? */ /* 64 */ VI_ALIAS, /* @ */ /* 65 */ VI_ADD_AT_EOL, /* A */ /* 66 */ VI_PREV_BIG_WORD, /* B */ /* 67 */ VI_CHANGE_TO_EOL, /* C */ /* 68 */ ED_KILL_LINE, /* D */ /* 69 */ VI_END_BIG_WORD, /* E */ /* 70 */ VI_PREV_CHAR, /* F */ /* 71 */ VI_TO_HISTORY_LINE, /* G */ /* 72 */ ED_UNASSIGNED, /* H */ /* 73 */ VI_INSERT_AT_BOL, /* I */ /* 74 */ ED_SEARCH_NEXT_HISTORY, /* J */ /* 75 */ ED_SEARCH_PREV_HISTORY, /* K */ /* 76 */ ED_UNASSIGNED, /* L */ /* 77 */ ED_UNASSIGNED, /* M */ /* 78 */ VI_REPEAT_SEARCH_PREV, /* N */ /* 79 */ ED_SEQUENCE_LEAD_IN, /* O */ /* 80 */ VI_PASTE_PREV, /* P */ /* 81 */ ED_UNASSIGNED, /* Q */ /* 82 */ VI_REPLACE_MODE, /* R */ /* 83 */ VI_SUBSTITUTE_LINE, /* S */ /* 84 */ VI_TO_PREV_CHAR, /* T */ /* 85 */ VI_UNDO_LINE, /* U */ /* 86 */ ED_UNASSIGNED, /* V */ /* 87 */ VI_NEXT_BIG_WORD, /* W */ /* 88 */ ED_DELETE_PREV_CHAR, /* X */ /* 89 */ VI_YANK_END, /* Y */ /* 90 */ ED_UNASSIGNED, /* Z */ /* 91 */ ED_SEQUENCE_LEAD_IN, /* [ */ /* 92 */ ED_UNASSIGNED, /* \ */ /* 93 */ ED_UNASSIGNED, /* ] */ /* 94 */ ED_MOVE_TO_BEG, /* ^ */ /* 95 */ VI_HISTORY_WORD, /* _ */ /* 96 */ ED_UNASSIGNED, /* ` */ /* 97 */ VI_ADD, /* a */ /* 98 */ VI_PREV_WORD, /* b */ /* 99 */ VI_CHANGE_META, /* c */ /* 100 */ VI_DELETE_META, /* d */ /* 101 */ VI_END_WORD, /* e */ /* 102 */ VI_NEXT_CHAR, /* f */ /* 103 */ ED_UNASSIGNED, /* g */ /* 104 */ ED_PREV_CHAR, /* h */ /* 105 */ VI_INSERT, /* i */ /* 106 */ ED_NEXT_HISTORY, /* j */ /* 107 */ ED_PREV_HISTORY, /* k */ /* 108 */ ED_NEXT_CHAR, /* l */ /* 109 */ ED_UNASSIGNED, /* m */ /* 110 */ VI_REPEAT_SEARCH_NEXT, /* n */ /* 111 */ ED_UNASSIGNED, /* o */ /* 112 */ VI_PASTE_NEXT, /* p */ /* 113 */ ED_UNASSIGNED, /* q */ /* 114 */ VI_REPLACE_CHAR, /* r */ /* 115 */ VI_SUBSTITUTE_CHAR, /* s */ /* 116 */ VI_TO_NEXT_CHAR, /* t */ /* 117 */ VI_UNDO, /* u */ /* 118 */ VI_HISTEDIT, /* v */ /* 119 */ VI_NEXT_WORD, /* w */ /* 120 */ ED_DELETE_NEXT_CHAR, /* x */ /* 121 */ VI_YANK, /* y */ /* 122 */ ED_UNASSIGNED, /* z */ /* 123 */ ED_UNASSIGNED, /* { */ /* 124 */ VI_TO_COLUMN, /* | */ /* 125 */ ED_UNASSIGNED, /* } */ /* 126 */ VI_CHANGE_CASE, /* ~ */ /* 127 */ ED_DELETE_PREV_CHAR, /* ^? */ /* 128 */ ED_UNASSIGNED, /* M-^@ */ /* 129 */ ED_UNASSIGNED, /* M-^A */ /* 130 */ ED_UNASSIGNED, /* M-^B */ /* 131 */ ED_UNASSIGNED, /* M-^C */ /* 132 */ ED_UNASSIGNED, /* M-^D */ /* 133 */ ED_UNASSIGNED, /* M-^E */ /* 134 */ ED_UNASSIGNED, /* M-^F */ /* 135 */ ED_UNASSIGNED, /* M-^G */ /* 136 */ ED_UNASSIGNED, /* M-^H */ /* 137 */ ED_UNASSIGNED, /* M-^I */ /* 138 */ ED_UNASSIGNED, /* M-^J */ /* 139 */ ED_UNASSIGNED, /* M-^K */ /* 140 */ ED_UNASSIGNED, /* M-^L */ /* 141 */ ED_UNASSIGNED, /* M-^M */ /* 142 */ ED_UNASSIGNED, /* M-^N */ /* 143 */ ED_UNASSIGNED, /* M-^O */ /* 144 */ ED_UNASSIGNED, /* M-^P */ /* 145 */ ED_UNASSIGNED, /* M-^Q */ /* 146 */ ED_UNASSIGNED, /* M-^R */ /* 147 */ ED_UNASSIGNED, /* M-^S */ /* 148 */ ED_UNASSIGNED, /* M-^T */ /* 149 */ ED_UNASSIGNED, /* M-^U */ /* 150 */ ED_UNASSIGNED, /* M-^V */ /* 151 */ ED_UNASSIGNED, /* M-^W */ /* 152 */ ED_UNASSIGNED, /* M-^X */ /* 153 */ ED_UNASSIGNED, /* M-^Y */ /* 154 */ ED_UNASSIGNED, /* M-^Z */ /* 155 */ ED_UNASSIGNED, /* M-^[ */ /* 156 */ ED_UNASSIGNED, /* M-^\ */ /* 157 */ ED_UNASSIGNED, /* M-^] */ /* 158 */ ED_UNASSIGNED, /* M-^^ */ /* 159 */ ED_UNASSIGNED, /* M-^_ */ /* 160 */ ED_UNASSIGNED, /* M-SPACE */ /* 161 */ ED_UNASSIGNED, /* M-! */ /* 162 */ ED_UNASSIGNED, /* M-" */ /* 163 */ ED_UNASSIGNED, /* M-# */ /* 164 */ ED_UNASSIGNED, /* M-$ */ /* 165 */ ED_UNASSIGNED, /* M-% */ /* 166 */ ED_UNASSIGNED, /* M-& */ /* 167 */ ED_UNASSIGNED, /* M-' */ /* 168 */ ED_UNASSIGNED, /* M-( */ /* 169 */ ED_UNASSIGNED, /* M-) */ /* 170 */ ED_UNASSIGNED, /* M-* */ /* 171 */ ED_UNASSIGNED, /* M-+ */ /* 172 */ ED_UNASSIGNED, /* M-, */ /* 173 */ ED_UNASSIGNED, /* M-- */ /* 174 */ ED_UNASSIGNED, /* M-. */ /* 175 */ ED_UNASSIGNED, /* M-/ */ /* 176 */ ED_UNASSIGNED, /* M-0 */ /* 177 */ ED_UNASSIGNED, /* M-1 */ /* 178 */ ED_UNASSIGNED, /* M-2 */ /* 179 */ ED_UNASSIGNED, /* M-3 */ /* 180 */ ED_UNASSIGNED, /* M-4 */ /* 181 */ ED_UNASSIGNED, /* M-5 */ /* 182 */ ED_UNASSIGNED, /* M-6 */ /* 183 */ ED_UNASSIGNED, /* M-7 */ /* 184 */ ED_UNASSIGNED, /* M-8 */ /* 185 */ ED_UNASSIGNED, /* M-9 */ /* 186 */ ED_UNASSIGNED, /* M-: */ /* 187 */ ED_UNASSIGNED, /* M-; */ /* 188 */ ED_UNASSIGNED, /* M-< */ /* 189 */ ED_UNASSIGNED, /* M-= */ /* 190 */ ED_UNASSIGNED, /* M-> */ /* 191 */ ED_UNASSIGNED, /* M-? */ /* 192 */ ED_UNASSIGNED, /* M-@ */ /* 193 */ ED_UNASSIGNED, /* M-A */ /* 194 */ ED_UNASSIGNED, /* M-B */ /* 195 */ ED_UNASSIGNED, /* M-C */ /* 196 */ ED_UNASSIGNED, /* M-D */ /* 197 */ ED_UNASSIGNED, /* M-E */ /* 198 */ ED_UNASSIGNED, /* M-F */ /* 199 */ ED_UNASSIGNED, /* M-G */ /* 200 */ ED_UNASSIGNED, /* M-H */ /* 201 */ ED_UNASSIGNED, /* M-I */ /* 202 */ ED_UNASSIGNED, /* M-J */ /* 203 */ ED_UNASSIGNED, /* M-K */ /* 204 */ ED_UNASSIGNED, /* M-L */ /* 205 */ ED_UNASSIGNED, /* M-M */ /* 206 */ ED_UNASSIGNED, /* M-N */ /* 207 */ ED_SEQUENCE_LEAD_IN, /* M-O */ /* 208 */ ED_UNASSIGNED, /* M-P */ /* 209 */ ED_UNASSIGNED, /* M-Q */ /* 210 */ ED_UNASSIGNED, /* M-R */ /* 211 */ ED_UNASSIGNED, /* M-S */ /* 212 */ ED_UNASSIGNED, /* M-T */ /* 213 */ ED_UNASSIGNED, /* M-U */ /* 214 */ ED_UNASSIGNED, /* M-V */ /* 215 */ ED_UNASSIGNED, /* M-W */ /* 216 */ ED_UNASSIGNED, /* M-X */ /* 217 */ ED_UNASSIGNED, /* M-Y */ /* 218 */ ED_UNASSIGNED, /* M-Z */ /* 219 */ ED_SEQUENCE_LEAD_IN, /* M-[ */ /* 220 */ ED_UNASSIGNED, /* M-\ */ /* 221 */ ED_UNASSIGNED, /* M-] */ /* 222 */ ED_UNASSIGNED, /* M-^ */ /* 223 */ ED_UNASSIGNED, /* M-_ */ /* 224 */ ED_UNASSIGNED, /* M-` */ /* 225 */ ED_UNASSIGNED, /* M-a */ /* 226 */ ED_UNASSIGNED, /* M-b */ /* 227 */ ED_UNASSIGNED, /* M-c */ /* 228 */ ED_UNASSIGNED, /* M-d */ /* 229 */ ED_UNASSIGNED, /* M-e */ /* 230 */ ED_UNASSIGNED, /* M-f */ /* 231 */ ED_UNASSIGNED, /* M-g */ /* 232 */ ED_UNASSIGNED, /* M-h */ /* 233 */ ED_UNASSIGNED, /* M-i */ /* 234 */ ED_UNASSIGNED, /* M-j */ /* 235 */ ED_UNASSIGNED, /* M-k */ /* 236 */ ED_UNASSIGNED, /* M-l */ /* 237 */ ED_UNASSIGNED, /* M-m */ /* 238 */ ED_UNASSIGNED, /* M-n */ /* 239 */ ED_UNASSIGNED, /* M-o */ /* 240 */ ED_UNASSIGNED, /* M-p */ /* 241 */ ED_UNASSIGNED, /* M-q */ /* 242 */ ED_UNASSIGNED, /* M-r */ /* 243 */ ED_UNASSIGNED, /* M-s */ /* 244 */ ED_UNASSIGNED, /* M-t */ /* 245 */ ED_UNASSIGNED, /* M-u */ /* 246 */ ED_UNASSIGNED, /* M-v */ /* 247 */ ED_UNASSIGNED, /* M-w */ /* 248 */ ED_UNASSIGNED, /* M-x */ /* 249 */ ED_UNASSIGNED, /* M-y */ /* 250 */ ED_UNASSIGNED, /* M-z */ /* 251 */ ED_UNASSIGNED, /* M-{ */ /* 252 */ ED_UNASSIGNED, /* M-| */ /* 253 */ ED_UNASSIGNED, /* M-} */ /* 254 */ ED_UNASSIGNED, /* M-~ */ /* 255 */ ED_UNASSIGNED /* M-^? */ }; /* map_init(): * Initialize and allocate the maps */ protected int map_init(EditLine *el) { /* * Make sure those are correct before starting. */ #ifdef MAP_DEBUG if (sizeof(el_map_emacs) != N_KEYS * sizeof(el_action_t)) EL_ABORT((el->errfile, "Emacs map incorrect\n")); if (sizeof(el_map_vi_command) != N_KEYS * sizeof(el_action_t)) EL_ABORT((el->errfile, "Vi command map incorrect\n")); if (sizeof(el_map_vi_insert) != N_KEYS * sizeof(el_action_t)) EL_ABORT((el->errfile, "Vi insert map incorrect\n")); #endif el->el_map.alt = (el_action_t *)el_malloc(sizeof(el_action_t) * N_KEYS); if (el->el_map.alt == NULL) return (-1); el->el_map.key = (el_action_t *)el_malloc(sizeof(el_action_t) * N_KEYS); if (el->el_map.key == NULL) return (-1); el->el_map.emacs = el_map_emacs; el->el_map.vic = el_map_vi_command; el->el_map.vii = el_map_vi_insert; el->el_map.help = (el_bindings_t *) el_malloc(sizeof(el_bindings_t) * EL_NUM_FCNS); if (el->el_map.help == NULL) return (-1); (void) memcpy(el->el_map.help, help__get(), sizeof(el_bindings_t) * EL_NUM_FCNS); el->el_map.func = (el_func_t *)el_malloc(sizeof(el_func_t) * EL_NUM_FCNS); if (el->el_map.func == NULL) return (-1); memcpy(el->el_map.func, func__get(), sizeof(el_func_t) * EL_NUM_FCNS); el->el_map.nfunc = EL_NUM_FCNS; #ifdef VIDEFAULT map_init_vi(el); #else map_init_emacs(el); #endif /* VIDEFAULT */ return (0); } /* map_end(): * Free the space taken by the editor maps */ protected void map_end(EditLine *el) { el_free((ptr_t) el->el_map.alt); el->el_map.alt = NULL; el_free((ptr_t) el->el_map.key); el->el_map.key = NULL; el->el_map.emacs = NULL; el->el_map.vic = NULL; el->el_map.vii = NULL; el_free((ptr_t) el->el_map.help); el->el_map.help = NULL; el_free((ptr_t) el->el_map.func); el->el_map.func = NULL; } /* map_init_nls(): * Find all the printable keys and bind them to self insert */ private void map_init_nls(EditLine *el) { int i; el_action_t *map = el->el_map.key; for (i = 0200; i <= 0377; i++) if (isprint(i)) map[i] = ED_INSERT; } /* map_init_meta(): * Bind all the meta keys to the appropriate ESC- sequence */ private void map_init_meta(EditLine *el) { char buf[3]; int i; el_action_t *map = el->el_map.key; el_action_t *alt = el->el_map.alt; for (i = 0; i <= 0377 && map[i] != EM_META_NEXT; i++) continue; if (i > 0377) { for (i = 0; i <= 0377 && alt[i] != EM_META_NEXT; i++) continue; if (i > 0377) { i = 033; if (el->el_map.type == MAP_VI) map = alt; } else map = alt; } buf[0] = (char) i; buf[2] = 0; for (i = 0200; i <= 0377; i++) switch (map[i]) { case ED_INSERT: case ED_UNASSIGNED: case ED_SEQUENCE_LEAD_IN: break; default: buf[1] = i & 0177; key_add(el, buf, key_map_cmd(el, (int) map[i]), XK_CMD); break; } map[(int) buf[0]] = ED_SEQUENCE_LEAD_IN; } /* map_init_vi(): * Initialize the vi bindings */ protected void map_init_vi(EditLine *el) { int i; el_action_t *key = el->el_map.key; el_action_t *alt = el->el_map.alt; const el_action_t *vii = el->el_map.vii; const el_action_t *vic = el->el_map.vic; el->el_map.type = MAP_VI; el->el_map.current = el->el_map.key; key_reset(el); for (i = 0; i < N_KEYS; i++) { key[i] = vii[i]; alt[i] = vic[i]; } map_init_meta(el); map_init_nls(el); tty_bind_char(el, 1); term_bind_arrow(el); } /* map_init_emacs(): * Initialize the emacs bindings */ protected void map_init_emacs(EditLine *el) { int i; char buf[3]; el_action_t *key = el->el_map.key; el_action_t *alt = el->el_map.alt; const el_action_t *emacs = el->el_map.emacs; el->el_map.type = MAP_EMACS; el->el_map.current = el->el_map.key; key_reset(el); for (i = 0; i < N_KEYS; i++) { key[i] = emacs[i]; alt[i] = ED_UNASSIGNED; } map_init_meta(el); map_init_nls(el); buf[0] = CONTROL('X'); buf[1] = CONTROL('X'); buf[2] = 0; key_add(el, buf, key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD); tty_bind_char(el, 1); term_bind_arrow(el); } /* map_set_editor(): * Set the editor */ protected int map_set_editor(EditLine *el, char *editor) { if (strcmp(editor, "emacs") == 0) { map_init_emacs(el); return (0); } if (strcmp(editor, "vi") == 0) { map_init_vi(el); return (0); } return (-1); } /* map_get_editor(): * Retrieve the editor */ protected int map_get_editor(EditLine *el, const char **editor) { if (editor == NULL) return (-1); switch (el->el_map.type) { case MAP_EMACS: *editor = "emacs"; return (0); case MAP_VI: *editor = "vi"; return (0); } return (-1); } /* map_print_key(): * Print the function description for 1 key */ private void map_print_key(EditLine *el, el_action_t *map, const char *in) { char outbuf[EL_BUFSIZ]; el_bindings_t *bp, *ep; if (in[0] == '\0' || in[1] == '\0') { (void) key__decode_str(in, outbuf, ""); ep = &el->el_map.help[el->el_map.nfunc]; for (bp = el->el_map.help; bp < ep; bp++) if (bp->func == map[(unsigned char) *in]) { (void) fprintf(el->el_outfile, "%s\t->\t%s\n", outbuf, bp->name); return; } } else key_print(el, in); } /* map_print_some_keys(): * Print keys from first to last */ private void map_print_some_keys(EditLine *el, el_action_t *map, int first, int last) { el_bindings_t *bp, *ep; char firstbuf[2], lastbuf[2]; char unparsbuf[EL_BUFSIZ], extrabuf[EL_BUFSIZ]; firstbuf[0] = first; firstbuf[1] = 0; lastbuf[0] = last; lastbuf[1] = 0; if (map[first] == ED_UNASSIGNED) { if (first == last) (void) fprintf(el->el_outfile, "%-15s-> is undefined\n", key__decode_str(firstbuf, unparsbuf, STRQQ)); return; } ep = &el->el_map.help[el->el_map.nfunc]; for (bp = el->el_map.help; bp < ep; bp++) { if (bp->func == map[first]) { if (first == last) { (void) fprintf(el->el_outfile, "%-15s-> %s\n", key__decode_str(firstbuf, unparsbuf, STRQQ), bp->name); } else { (void) fprintf(el->el_outfile, "%-4s to %-7s-> %s\n", key__decode_str(firstbuf, unparsbuf, STRQQ), key__decode_str(lastbuf, extrabuf, STRQQ), bp->name); } return; } } #ifdef MAP_DEBUG if (map == el->el_map.key) { (void) fprintf(el->el_outfile, "BUG!!! %s isn't bound to anything.\n", key__decode_str(firstbuf, unparsbuf, STRQQ)); (void) fprintf(el->el_outfile, "el->el_map.key[%d] == %d\n", first, el->el_map.key[first]); } else { (void) fprintf(el->el_outfile, "BUG!!! %s isn't bound to anything.\n", key__decode_str(firstbuf, unparsbuf, STRQQ)); (void) fprintf(el->el_outfile, "el->el_map.alt[%d] == %d\n", first, el->el_map.alt[first]); } #endif EL_ABORT((el->el_errfile, "Error printing keys\n")); } /* map_print_all_keys(): * Print the function description for all keys. */ private void map_print_all_keys(EditLine *el) { int prev, i; (void) fprintf(el->el_outfile, "Standard key bindings\n"); prev = 0; for (i = 0; i < N_KEYS; i++) { if (el->el_map.key[prev] == el->el_map.key[i]) continue; map_print_some_keys(el, el->el_map.key, prev, i - 1); prev = i; } map_print_some_keys(el, el->el_map.key, prev, i - 1); (void) fprintf(el->el_outfile, "Alternative key bindings\n"); prev = 0; for (i = 0; i < N_KEYS; i++) { if (el->el_map.alt[prev] == el->el_map.alt[i]) continue; map_print_some_keys(el, el->el_map.alt, prev, i - 1); prev = i; } map_print_some_keys(el, el->el_map.alt, prev, i - 1); (void) fprintf(el->el_outfile, "Multi-character bindings\n"); key_print(el, ""); (void) fprintf(el->el_outfile, "Arrow key bindings\n"); term_print_arrow(el, ""); } /* map_bind(): * Add/remove/change bindings */ protected int map_bind(EditLine *el, int argc, const char **argv) { el_action_t *map; int ntype, rem; const char *p; char inbuf[EL_BUFSIZ]; char outbuf[EL_BUFSIZ]; const char *in = NULL; char *out = NULL; el_bindings_t *bp, *ep; int cmd; int key; if (argv == NULL) return (-1); map = el->el_map.key; ntype = XK_CMD; key = rem = 0; for (argc = 1; (p = argv[argc]) != NULL; argc++) if (p[0] == '-') switch (p[1]) { case 'a': map = el->el_map.alt; break; case 's': ntype = XK_STR; break; #ifdef notyet case 'c': ntype = XK_EXE; break; #endif case 'k': key = 1; break; case 'r': rem = 1; break; case 'v': map_init_vi(el); return (0); case 'e': map_init_emacs(el); return (0); case 'l': ep = &el->el_map.help[el->el_map.nfunc]; for (bp = el->el_map.help; bp < ep; bp++) (void) fprintf(el->el_outfile, "%s\n\t%s\n", bp->name, bp->description); return (0); default: (void) fprintf(el->el_errfile, "%s: Invalid switch `%c'.\n", argv[0], p[1]); } else break; if (argv[argc] == NULL) { map_print_all_keys(el); return (0); } if (key) in = argv[argc++]; else if ((in = parse__string(inbuf, argv[argc++])) == NULL) { (void) fprintf(el->el_errfile, "%s: Invalid \\ or ^ in instring.\n", argv[0]); return (-1); } if (rem) { if (key) { (void) term_clear_arrow(el, in); return (-1); } if (in[1]) (void) key_delete(el, in); else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN) (void) key_delete(el, in); else map[(unsigned char) *in] = ED_UNASSIGNED; return (0); } if (argv[argc] == NULL) { if (key) term_print_arrow(el, in); else map_print_key(el, map, in); return (0); } #ifdef notyet if (argv[argc + 1] != NULL) { bindkey_usage(); return (-1); } #endif switch (ntype) { case XK_STR: case XK_EXE: if ((out = parse__string(outbuf, argv[argc])) == NULL) { (void) fprintf(el->el_errfile, "%s: Invalid \\ or ^ in outstring.\n", argv[0]); return (-1); } if (key) term_set_arrow(el, in, key_map_str(el, out), ntype); else key_add(el, in, key_map_str(el, out), ntype); map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN; break; case XK_CMD: if ((cmd = parse_cmd(el, argv[argc])) == -1) { (void) fprintf(el->el_errfile, "%s: Invalid command `%s'.\n", argv[0], argv[argc]); return (-1); } if (key) term_set_arrow(el, in, key_map_str(el, out), ntype); else { if (in[1]) { key_add(el, in, key_map_cmd(el, cmd), ntype); map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN; } else { key_clear(el, map, in); map[(unsigned char) *in] = cmd; } } break; default: EL_ABORT((el->el_errfile, "Bad XK_ type\n", ntype)); break; } return (0); } /* map_addfunc(): * add a user defined function */ protected int map_addfunc(EditLine *el, const char *name, const char *help, el_func_t func) { void *p; int nf = el->el_map.nfunc + 1; if (name == NULL || help == NULL || func == NULL) return (-1); if ((p = el_realloc(el->el_map.func, nf * sizeof(el_func_t))) == NULL) return (-1); el->el_map.func = (el_func_t *) p; if ((p = el_realloc(el->el_map.help, nf * sizeof(el_bindings_t))) == NULL) return (-1); el->el_map.help = (el_bindings_t *) p; nf = el->el_map.nfunc; el->el_map.func[nf] = func; el->el_map.help[nf].name = name; el->el_map.help[nf].func = nf; el->el_map.help[nf].description = help; el->el_map.nfunc++; return (0); } openipmi-2.0.18/libedit/chared.c0000644000175000017500000004124510373140634015413 0ustar chuckchuck/* $NetBSD: chared.c,v 1.25 2005/08/08 01:41:30 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: chared.c,v 1.25 2005/08/08 01:41:30 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * chared.c: Character editor utilities */ #include #include "el.h" private void ch__clearmacro __P((EditLine *)); /* value to leave unused in line buffer */ #define EL_LEAVE 2 /* cv_undo(): * Handle state for the vi undo command */ protected void cv_undo(EditLine *el) { c_undo_t *vu = &el->el_chared.c_undo; c_redo_t *r = &el->el_chared.c_redo; unsigned int size; /* Save entire line for undo */ size = el->el_line.lastchar - el->el_line.buffer; vu->len = size; vu->cursor = el->el_line.cursor - el->el_line.buffer; memcpy(vu->buf, el->el_line.buffer, size); /* save command info for redo */ r->count = el->el_state.doingarg ? el->el_state.argument : 0; r->action = el->el_chared.c_vcmd.action; r->pos = r->buf; r->cmd = el->el_state.thiscmd; r->ch = el->el_state.thisch; } /* cv_yank(): * Save yank/delete data for paste */ protected void cv_yank(EditLine *el, const char *ptr, int size) { c_kill_t *k = &el->el_chared.c_kill; memcpy(k->buf, ptr, size +0u); k->last = k->buf + size; } /* c_insert(): * Insert num characters */ protected void c_insert(EditLine *el, int num) { char *cp; if (el->el_line.lastchar + num >= el->el_line.limit) { if (!ch_enlargebufs(el, num +0u)) return; /* can't go past end of buffer */ } if (el->el_line.cursor < el->el_line.lastchar) { /* if I must move chars */ for (cp = el->el_line.lastchar; cp >= el->el_line.cursor; cp--) cp[num] = *cp; } el->el_line.lastchar += num; } /* c_delafter(): * Delete num characters after the cursor */ protected void c_delafter(EditLine *el, int num) { if (el->el_line.cursor + num > el->el_line.lastchar) num = el->el_line.lastchar - el->el_line.cursor; if (el->el_map.current != el->el_map.emacs) { cv_undo(el); cv_yank(el, el->el_line.cursor, num); } if (num > 0) { char *cp; for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) *cp = cp[num]; el->el_line.lastchar -= num; } } /* c_delafter1(): * Delete the character after the cursor, do not yank */ protected void c_delafter1(EditLine *el) { char *cp; for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) *cp = cp[1]; el->el_line.lastchar--; } /* c_delbefore(): * Delete num characters before the cursor */ protected void c_delbefore(EditLine *el, int num) { if (el->el_line.cursor - num < el->el_line.buffer) num = el->el_line.cursor - el->el_line.buffer; if (el->el_map.current != el->el_map.emacs) { cv_undo(el); cv_yank(el, el->el_line.cursor - num, num); } if (num > 0) { char *cp; for (cp = el->el_line.cursor - num; cp <= el->el_line.lastchar; cp++) *cp = cp[num]; el->el_line.lastchar -= num; } } /* c_delbefore1(): * Delete the character before the cursor, do not yank */ protected void c_delbefore1(EditLine *el) { char *cp; for (cp = el->el_line.cursor - 1; cp <= el->el_line.lastchar; cp++) *cp = cp[1]; el->el_line.lastchar--; } /* ce__isword(): * Return if p is part of a word according to emacs */ protected int ce__isword(int p) { return (isalnum(p) || strchr("*?_-.[]~=", p) != NULL); } /* cv__isword(): * Return if p is part of a word according to vi */ protected int cv__isword(int p) { if (isalnum(p) || p == '_') return 1; if (isgraph(p)) return 2; return 0; } /* cv__isWord(): * Return if p is part of a big word according to vi */ protected int cv__isWord(int p) { return (!isspace(p)); } /* c__prev_word(): * Find the previous word */ protected char * c__prev_word(char *p, char *low, int n, int (*wtest)(int)) { p--; while (n--) { while ((p >= low) && !(*wtest)((unsigned char) *p)) p--; while ((p >= low) && (*wtest)((unsigned char) *p)) p--; } /* cp now points to one character before the word */ p++; if (p < low) p = low; /* cp now points where we want it */ return (p); } /* c__next_word(): * Find the next word */ protected char * c__next_word(char *p, char *high, int n, int (*wtest)(int)) { while (n--) { while ((p < high) && !(*wtest)((unsigned char) *p)) p++; while ((p < high) && (*wtest)((unsigned char) *p)) p++; } if (p > high) p = high; /* p now points where we want it */ return (p); } /* cv_next_word(): * Find the next word vi style */ protected char * cv_next_word(EditLine *el, char *p, char *high, int n, int (*wtest)(int)) { int test; while (n--) { test = (*wtest)((unsigned char) *p); while ((p < high) && (*wtest)((unsigned char) *p) == test) p++; /* * vi historically deletes with cw only the word preserving the * trailing whitespace! This is not what 'w' does.. */ if (n || el->el_chared.c_vcmd.action != (DELETE|INSERT)) while ((p < high) && isspace((unsigned char) *p)) p++; } /* p now points where we want it */ if (p > high) return (high); else return (p); } /* cv_prev_word(): * Find the previous word vi style */ protected char * cv_prev_word(char *p, char *low, int n, int (*wtest)(int)) { int test; p--; while (n--) { while ((p > low) && isspace((unsigned char) *p)) p--; test = (*wtest)((unsigned char) *p); while ((p >= low) && (*wtest)((unsigned char) *p) == test) p--; } p++; /* p now points where we want it */ if (p < low) return (low); else return (p); } #ifdef notdef /* c__number(): * Ignore character p points to, return number appearing after that. * A '$' by itself means a big number; "$-" is for negative; '^' means 1. * Return p pointing to last char used. */ protected char * c__number( char *p, /* character position */ int *num, /* Return value */ int dval) /* dval is the number to subtract from like $-3 */ { int i; int sign = 1; if (*++p == '^') { *num = 1; return (p); } if (*p == '$') { if (*++p != '-') { *num = 0x7fffffff; /* Handle $ */ return (--p); } sign = -1; /* Handle $- */ ++p; } for (i = 0; isdigit((unsigned char) *p); i = 10 * i + *p++ - '0') continue; *num = (sign < 0 ? dval - i : i); return (--p); } #endif /* cv_delfini(): * Finish vi delete action */ protected void cv_delfini(EditLine *el) { int size; int action = el->el_chared.c_vcmd.action; if (action & INSERT) el->el_map.current = el->el_map.key; if (el->el_chared.c_vcmd.pos == 0) /* sanity */ return; size = el->el_line.cursor - el->el_chared.c_vcmd.pos; if (size == 0) size = 1; el->el_line.cursor = el->el_chared.c_vcmd.pos; if (action & YANK) { if (size > 0) cv_yank(el, el->el_line.cursor, size); else cv_yank(el, el->el_line.cursor + size, -size); } else { if (size > 0) { c_delafter(el, size); re_refresh_cursor(el); } else { c_delbefore(el, -size); el->el_line.cursor += size; } } el->el_chared.c_vcmd.action = NOP; } #ifdef notdef /* ce__endword(): * Go to the end of this word according to emacs */ protected char * ce__endword(char *p, char *high, int n) { p++; while (n--) { while ((p < high) && isspace((unsigned char) *p)) p++; while ((p < high) && !isspace((unsigned char) *p)) p++; } p--; return (p); } #endif /* cv__endword(): * Go to the end of this word according to vi */ protected char * cv__endword(char *p, char *high, int n, int (*wtest)(int)) { int test; p++; while (n--) { while ((p < high) && isspace((unsigned char) *p)) p++; test = (*wtest)((unsigned char) *p); while ((p < high) && (*wtest)((unsigned char) *p) == test) p++; } p--; return (p); } /* ch_init(): * Initialize the character editor */ protected int ch_init(EditLine *el) { c_macro_t *ma = &el->el_chared.c_macro; el->el_line.buffer = (char *) el_malloc(EL_BUFSIZ); if (el->el_line.buffer == NULL) return (-1); (void) memset(el->el_line.buffer, 0, EL_BUFSIZ); el->el_line.cursor = el->el_line.buffer; el->el_line.lastchar = el->el_line.buffer; el->el_line.limit = &el->el_line.buffer[EL_BUFSIZ - EL_LEAVE]; el->el_chared.c_undo.buf = (char *) el_malloc(EL_BUFSIZ); if (el->el_chared.c_undo.buf == NULL) return (-1); (void) memset(el->el_chared.c_undo.buf, 0, EL_BUFSIZ); el->el_chared.c_undo.len = -1; el->el_chared.c_undo.cursor = 0; el->el_chared.c_redo.buf = (char *) el_malloc(EL_BUFSIZ); if (el->el_chared.c_redo.buf == NULL) return (-1); el->el_chared.c_redo.pos = el->el_chared.c_redo.buf; el->el_chared.c_redo.lim = el->el_chared.c_redo.buf + EL_BUFSIZ; el->el_chared.c_redo.cmd = ED_UNASSIGNED; el->el_chared.c_vcmd.action = NOP; el->el_chared.c_vcmd.pos = el->el_line.buffer; el->el_chared.c_kill.buf = (char *) el_malloc(EL_BUFSIZ); if (el->el_chared.c_kill.buf == NULL) return (-1); (void) memset(el->el_chared.c_kill.buf, 0, EL_BUFSIZ); el->el_chared.c_kill.mark = el->el_line.buffer; el->el_chared.c_kill.last = el->el_chared.c_kill.buf; el->el_map.current = el->el_map.key; el->el_state.inputmode = MODE_INSERT; /* XXX: save a default */ el->el_state.doingarg = 0; el->el_state.metanext = 0; el->el_state.argument = 1; el->el_state.lastcmd = ED_UNASSIGNED; ma->level = -1; ma->offset = 0; ma->macro = (char **) el_malloc(EL_MAXMACRO * sizeof(char *)); if (ma->macro == NULL) return (-1); return (0); } /* ch_reset(): * Reset the character editor */ protected void ch_reset(EditLine *el, int mclear) { el->el_line.cursor = el->el_line.buffer; el->el_line.lastchar = el->el_line.buffer; el->el_chared.c_undo.len = -1; el->el_chared.c_undo.cursor = 0; el->el_chared.c_vcmd.action = NOP; el->el_chared.c_vcmd.pos = el->el_line.buffer; el->el_chared.c_kill.mark = el->el_line.buffer; el->el_map.current = el->el_map.key; el->el_state.inputmode = MODE_INSERT; /* XXX: save a default */ el->el_state.doingarg = 0; el->el_state.metanext = 0; el->el_state.argument = 1; el->el_state.lastcmd = ED_UNASSIGNED; el->el_history.eventno = 0; if (mclear) ch__clearmacro(el); } private void ch__clearmacro(el) EditLine *el; { c_macro_t *ma = &el->el_chared.c_macro; while (ma->level >= 0) el_free((ptr_t)ma->macro[ma->level--]); } /* ch_enlargebufs(): * Enlarge line buffer to be able to hold twice as much characters. * Returns 1 if successful, 0 if not. */ protected int ch_enlargebufs(el, addlen) EditLine *el; size_t addlen; { size_t sz, newsz; char *newbuffer, *oldbuf, *oldkbuf; sz = el->el_line.limit - el->el_line.buffer + EL_LEAVE; newsz = sz * 2; /* * If newly required length is longer than current buffer, we need * to make the buffer big enough to hold both old and new stuff. */ if (addlen > sz) { while(newsz - sz < addlen) newsz *= 2; } /* * Reallocate line buffer. */ newbuffer = el_realloc(el->el_line.buffer, newsz); if (!newbuffer) return 0; /* zero the newly added memory, leave old data in */ (void) memset(&newbuffer[sz], 0, newsz - sz); oldbuf = el->el_line.buffer; el->el_line.buffer = newbuffer; el->el_line.cursor = newbuffer + (el->el_line.cursor - oldbuf); el->el_line.lastchar = newbuffer + (el->el_line.lastchar - oldbuf); /* don't set new size until all buffers are enlarged */ el->el_line.limit = &newbuffer[sz - EL_LEAVE]; /* * Reallocate kill buffer. */ newbuffer = el_realloc(el->el_chared.c_kill.buf, newsz); if (!newbuffer) return 0; /* zero the newly added memory, leave old data in */ (void) memset(&newbuffer[sz], 0, newsz - sz); oldkbuf = el->el_chared.c_kill.buf; el->el_chared.c_kill.buf = newbuffer; el->el_chared.c_kill.last = newbuffer + (el->el_chared.c_kill.last - oldkbuf); el->el_chared.c_kill.mark = el->el_line.buffer + (el->el_chared.c_kill.mark - oldbuf); /* * Reallocate undo buffer. */ newbuffer = el_realloc(el->el_chared.c_undo.buf, newsz); if (!newbuffer) return 0; /* zero the newly added memory, leave old data in */ (void) memset(&newbuffer[sz], 0, newsz - sz); el->el_chared.c_undo.buf = newbuffer; newbuffer = el_realloc(el->el_chared.c_redo.buf, newsz); if (!newbuffer) return 0; el->el_chared.c_redo.pos = newbuffer + (el->el_chared.c_redo.pos - el->el_chared.c_redo.buf); el->el_chared.c_redo.lim = newbuffer + (el->el_chared.c_redo.lim - el->el_chared.c_redo.buf); el->el_chared.c_redo.buf = newbuffer; if (!hist_enlargebuf(el, sz, newsz)) return 0; /* Safe to set enlarged buffer size */ el->el_line.limit = &el->el_line.buffer[newsz - EL_LEAVE]; return 1; } /* ch_end(): * Free the data structures used by the editor */ protected void ch_end(EditLine *el) { el_free((ptr_t) el->el_line.buffer); el->el_line.buffer = NULL; el->el_line.limit = NULL; el_free((ptr_t) el->el_chared.c_undo.buf); el->el_chared.c_undo.buf = NULL; el_free((ptr_t) el->el_chared.c_redo.buf); el->el_chared.c_redo.buf = NULL; el->el_chared.c_redo.pos = NULL; el->el_chared.c_redo.lim = NULL; el->el_chared.c_redo.cmd = ED_UNASSIGNED; el_free((ptr_t) el->el_chared.c_kill.buf); el->el_chared.c_kill.buf = NULL; ch_reset(el, 1); el_free((ptr_t) el->el_chared.c_macro.macro); el->el_chared.c_macro.macro = NULL; } /* el_insertstr(): * Insert string at cursorI */ public int el_insertstr(EditLine *el, const char *s) { size_t len; if ((len = strlen(s)) == 0) return (-1); if (el->el_line.lastchar + len >= el->el_line.limit) { if (!ch_enlargebufs(el, len)) return (-1); } c_insert(el, (int)len); while (*s) *el->el_line.cursor++ = *s++; return (0); } /* el_deletestr(): * Delete num characters before the cursor */ public void el_deletestr(EditLine *el, int n) { if (n <= 0) return; if (el->el_line.cursor < &el->el_line.buffer[n]) return; c_delbefore(el, n); /* delete before dot */ el->el_line.cursor -= n; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; } /* c_gets(): * Get a string */ protected int c_gets(EditLine *el, char *buf, const char *prompt) { char ch; int len; char *cp = el->el_line.buffer; if (prompt) { len = strlen(prompt); memcpy(cp, prompt, len + 0u); cp += len; } len = 0; for (;;) { el->el_line.cursor = cp; *cp = ' '; el->el_line.lastchar = cp + 1; re_refresh(el); if (el_getc(el, &ch) != 1) { ed_end_of_file(el, 0); len = -1; break; } switch (ch) { case 0010: /* Delete and backspace */ case 0177: if (len <= 0) { len = -1; break; } cp--; continue; case 0033: /* ESC */ case '\r': /* Newline */ case '\n': buf[len] = ch; break; default: if (len >= EL_BUFSIZ - 16) term_beep(el); else { buf[len++] = ch; *cp++ = ch; } continue; } break; } el->el_line.buffer[0] = '\0'; el->el_line.lastchar = el->el_line.buffer; el->el_line.cursor = el->el_line.buffer; return len; } /* c_hpos(): * Return the current horizontal position of the cursor */ protected int c_hpos(EditLine *el) { char *ptr; /* * Find how many characters till the beginning of this line. */ if (el->el_line.cursor == el->el_line.buffer) return (0); else { for (ptr = el->el_line.cursor - 1; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--) continue; return (el->el_line.cursor - ptr - 1); } } openipmi-2.0.18/libedit/history.c0000644000175000017500000005407710373140634015675 0ustar chuckchuck/* $NetBSD: history.c,v 1.31 2005/08/01 14:34:06 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: history.c,v 1.31 2005/08/01 14:34:06 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * hist.c: History access functions */ #include #include #include #include #include static const char hist_cookie[] = "_HiStOrY_V2_\n"; #include "histedit.h" typedef int (*history_gfun_t)(ptr_t, HistEvent *); typedef int (*history_efun_t)(ptr_t, HistEvent *, const char *); typedef void (*history_vfun_t)(ptr_t, HistEvent *); typedef int (*history_sfun_t)(ptr_t, HistEvent *, const int); struct history { ptr_t h_ref; /* Argument for history fcns */ int h_ent; /* Last entry point for history */ history_gfun_t h_first; /* Get the first element */ history_gfun_t h_next; /* Get the next element */ history_gfun_t h_last; /* Get the last element */ history_gfun_t h_prev; /* Get the previous element */ history_gfun_t h_curr; /* Get the current element */ history_sfun_t h_set; /* Set the current element */ history_sfun_t h_del; /* Set the given element */ history_vfun_t h_clear; /* Clear the history list */ history_efun_t h_enter; /* Add an element */ history_efun_t h_add; /* Append to an element */ }; #define HNEXT(h, ev) (*(h)->h_next)((h)->h_ref, ev) #define HFIRST(h, ev) (*(h)->h_first)((h)->h_ref, ev) #define HPREV(h, ev) (*(h)->h_prev)((h)->h_ref, ev) #define HLAST(h, ev) (*(h)->h_last)((h)->h_ref, ev) #define HCURR(h, ev) (*(h)->h_curr)((h)->h_ref, ev) #define HSET(h, ev, n) (*(h)->h_set)((h)->h_ref, ev, n) #define HCLEAR(h, ev) (*(h)->h_clear)((h)->h_ref, ev) #define HENTER(h, ev, str) (*(h)->h_enter)((h)->h_ref, ev, str) #define HADD(h, ev, str) (*(h)->h_add)((h)->h_ref, ev, str) #define HDEL(h, ev, n) (*(h)->h_del)((h)->h_ref, ev, n) #define h_strdup(a) strdup(a) #define h_malloc(a) malloc(a) #define h_realloc(a, b) realloc((a), (b)) #define h_free(a) free(a) typedef struct { int num; char *str; } HistEventPrivate; private int history_setsize(History *, HistEvent *, int); private int history_getsize(History *, HistEvent *); private int history_setunique(History *, HistEvent *, int); private int history_getunique(History *, HistEvent *); private int history_set_fun(History *, History *); private int history_load(History *, const char *); private int history_save(History *, const char *); private int history_prev_event(History *, HistEvent *, int); private int history_next_event(History *, HistEvent *, int); private int history_next_string(History *, HistEvent *, const char *); private int history_prev_string(History *, HistEvent *, const char *); /***********************************************************************/ /* * Builtin- history implementation */ typedef struct hentry_t { HistEvent ev; /* What we return */ struct hentry_t *next; /* Next entry */ struct hentry_t *prev; /* Previous entry */ } hentry_t; typedef struct history_t { hentry_t list; /* Fake list header element */ hentry_t *cursor; /* Current element in the list */ int max; /* Maximum number of events */ int cur; /* Current number of events */ int eventid; /* For generation of unique event id */ int flags; /* History flags */ #define H_UNIQUE 1 /* Store only unique elements */ } history_t; private int history_def_next(ptr_t, HistEvent *); private int history_def_first(ptr_t, HistEvent *); private int history_def_prev(ptr_t, HistEvent *); private int history_def_last(ptr_t, HistEvent *); private int history_def_curr(ptr_t, HistEvent *); private int history_def_set(ptr_t, HistEvent *, const int); private void history_def_clear(ptr_t, HistEvent *); private int history_def_enter(ptr_t, HistEvent *, const char *); private int history_def_add(ptr_t, HistEvent *, const char *); private int history_def_del(ptr_t, HistEvent *, const int); private int history_def_init(ptr_t *, HistEvent *, int); private int history_def_insert(history_t *, HistEvent *, const char *); private void history_def_delete(history_t *, HistEvent *, hentry_t *); #define history_def_setsize(p, num)(void) (((history_t *)p)->max = (num)) #define history_def_getsize(p) (((history_t *)p)->cur) #define history_def_getunique(p) (((((history_t *)p)->flags) & H_UNIQUE) != 0) #define history_def_setunique(p, uni) \ if (uni) \ (((history_t *)p)->flags) |= H_UNIQUE; \ else \ (((history_t *)p)->flags) &= ~H_UNIQUE #define he_strerror(code) he_errlist[code] #define he_seterrev(evp, code) {\ evp->num = code;\ evp->str = he_strerror(code);\ } /* error messages */ static const char *const he_errlist[] = { "OK", "unknown error", "malloc() failed", "first event not found", "last event not found", "empty list", "no next event", "no previous event", "current event is invalid", "event not found", "can't read history from file", "can't write history", "required parameter(s) not supplied", "history size negative", "function not allowed with other history-functions-set the default", "bad parameters" }; /* error codes */ #define _HE_OK 0 #define _HE_UNKNOWN 1 #define _HE_MALLOC_FAILED 2 #define _HE_FIRST_NOTFOUND 3 #define _HE_LAST_NOTFOUND 4 #define _HE_EMPTY_LIST 5 #define _HE_END_REACHED 6 #define _HE_START_REACHED 7 #define _HE_CURR_INVALID 8 #define _HE_NOT_FOUND 9 #define _HE_HIST_READ 10 #define _HE_HIST_WRITE 11 #define _HE_PARAM_MISSING 12 #define _HE_SIZE_NEGATIVE 13 #define _HE_NOT_ALLOWED 14 #define _HE_BAD_PARAM 15 /* history_def_first(): * Default function to return the first event in the history. */ private int history_def_first(ptr_t p, HistEvent *ev) { history_t *h = (history_t *) p; h->cursor = h->list.next; if (h->cursor != &h->list) *ev = h->cursor->ev; else { he_seterrev(ev, _HE_FIRST_NOTFOUND); return (-1); } return (0); } /* history_def_last(): * Default function to return the last event in the history. */ private int history_def_last(ptr_t p, HistEvent *ev) { history_t *h = (history_t *) p; h->cursor = h->list.prev; if (h->cursor != &h->list) *ev = h->cursor->ev; else { he_seterrev(ev, _HE_LAST_NOTFOUND); return (-1); } return (0); } /* history_def_next(): * Default function to return the next event in the history. */ private int history_def_next(ptr_t p, HistEvent *ev) { history_t *h = (history_t *) p; if (h->cursor == &h->list) { he_seterrev(ev, _HE_EMPTY_LIST); return (-1); } if (h->cursor->next == &h->list) { he_seterrev(ev, _HE_END_REACHED); return (-1); } h->cursor = h->cursor->next; *ev = h->cursor->ev; return (0); } /* history_def_prev(): * Default function to return the previous event in the history. */ private int history_def_prev(ptr_t p, HistEvent *ev) { history_t *h = (history_t *) p; if (h->cursor == &h->list) { he_seterrev(ev, (h->cur > 0) ? _HE_END_REACHED : _HE_EMPTY_LIST); return (-1); } if (h->cursor->prev == &h->list) { he_seterrev(ev, _HE_START_REACHED); return (-1); } h->cursor = h->cursor->prev; *ev = h->cursor->ev; return (0); } /* history_def_curr(): * Default function to return the current event in the history. */ private int history_def_curr(ptr_t p, HistEvent *ev) { history_t *h = (history_t *) p; if (h->cursor != &h->list) *ev = h->cursor->ev; else { he_seterrev(ev, (h->cur > 0) ? _HE_CURR_INVALID : _HE_EMPTY_LIST); return (-1); } return (0); } /* history_def_set(): * Default function to set the current event in the history to the * given one. */ private int history_def_set(ptr_t p, HistEvent *ev, const int n) { history_t *h = (history_t *) p; if (h->cur == 0) { he_seterrev(ev, _HE_EMPTY_LIST); return (-1); } if (h->cursor == &h->list || h->cursor->ev.num != n) { for (h->cursor = h->list.next; h->cursor != &h->list; h->cursor = h->cursor->next) if (h->cursor->ev.num == n) break; } if (h->cursor == &h->list) { he_seterrev(ev, _HE_NOT_FOUND); return (-1); } return (0); } /* history_def_add(): * Append string to element */ private int history_def_add(ptr_t p, HistEvent *ev, const char *str) { history_t *h = (history_t *) p; size_t len; char *s; HistEventPrivate *evp = (void *)&h->cursor->ev; if (h->cursor == &h->list) return (history_def_enter(p, ev, str)); len = strlen(evp->str) + strlen(str) + 1; s = (char *) h_malloc(len); if (s == NULL) { he_seterrev(ev, _HE_MALLOC_FAILED); return (-1); } (void) strlcpy(s, h->cursor->ev.str, len); (void) strlcat(s, str, len); h_free((ptr_t)evp->str); evp->str = s; *ev = h->cursor->ev; return (0); } /* history_def_del(): * Delete element hp of the h list */ /* ARGSUSED */ private int history_def_del(ptr_t p, HistEvent *ev __attribute__((__unused__)), const int num) { history_t *h = (history_t *) p; if (history_def_set(h, ev, num) != 0) return (-1); ev->str = strdup(h->cursor->ev.str); ev->num = h->cursor->ev.num; history_def_delete(h, ev, h->cursor); return (0); } /* history_def_delete(): * Delete element hp of the h list */ /* ARGSUSED */ private void history_def_delete(history_t *h, HistEvent *ev __attribute__((__unused__)), hentry_t *hp) { HistEventPrivate *evp = (void *)&hp->ev; if (hp == &h->list) abort(); if (h->cursor == hp) h->cursor = hp->prev; hp->prev->next = hp->next; hp->next->prev = hp->prev; h_free((ptr_t) evp->str); h_free(hp); h->cur--; } /* history_def_insert(): * Insert element with string str in the h list */ private int history_def_insert(history_t *h, HistEvent *ev, const char *str) { h->cursor = (hentry_t *) h_malloc(sizeof(hentry_t)); if (h->cursor == NULL) goto oomem; if ((h->cursor->ev.str = h_strdup(str)) == NULL) { h_free((ptr_t)h->cursor); goto oomem; } h->cursor->ev.num = ++h->eventid; h->cursor->next = h->list.next; h->cursor->prev = &h->list; h->list.next->prev = h->cursor; h->list.next = h->cursor; h->cur++; *ev = h->cursor->ev; return (0); oomem: he_seterrev(ev, _HE_MALLOC_FAILED); return (-1); } /* history_def_enter(): * Default function to enter an item in the history */ private int history_def_enter(ptr_t p, HistEvent *ev, const char *str) { history_t *h = (history_t *) p; if ((h->flags & H_UNIQUE) != 0 && h->list.next != &h->list && strcmp(h->list.next->ev.str, str) == 0) return (0); if (history_def_insert(h, ev, str) == -1) return (-1); /* error, keep error message */ /* * Always keep at least one entry. * This way we don't have to check for the empty list. */ while (h->cur > h->max && h->cur > 0) history_def_delete(h, ev, h->list.prev); return (1); } /* history_def_init(): * Default history initialization function */ /* ARGSUSED */ private int history_def_init(ptr_t *p, HistEvent *ev __attribute__((__unused__)), int n) { history_t *h = (history_t *) h_malloc(sizeof(history_t)); if (h == NULL) return -1; if (n <= 0) n = 0; h->eventid = 0; h->cur = 0; h->max = n; h->list.next = h->list.prev = &h->list; h->list.ev.str = NULL; h->list.ev.num = 0; h->cursor = &h->list; h->flags = 0; *p = (ptr_t) h; return 0; } /* history_def_clear(): * Default history cleanup function */ private void history_def_clear(ptr_t p, HistEvent *ev) { history_t *h = (history_t *) p; while (h->list.prev != &h->list) history_def_delete(h, ev, h->list.prev); h->eventid = 0; h->cur = 0; } /************************************************************************/ /* history_init(): * Initialization function. */ public History * history_init(void) { HistEvent ev; History *h = (History *) h_malloc(sizeof(History)); if (h == NULL) return NULL; if (history_def_init(&h->h_ref, &ev, 0) == -1) { h_free((ptr_t)h); return NULL; } h->h_ent = -1; h->h_next = history_def_next; h->h_first = history_def_first; h->h_last = history_def_last; h->h_prev = history_def_prev; h->h_curr = history_def_curr; h->h_set = history_def_set; h->h_clear = history_def_clear; h->h_enter = history_def_enter; h->h_add = history_def_add; h->h_del = history_def_del; return (h); } /* history_end(): * clean up history; */ public void history_end(History *h) { HistEvent ev; if (h->h_next == history_def_next) history_def_clear(h->h_ref, &ev); h_free(h); } /* history_setsize(): * Set history number of events */ private int history_setsize(History *h, HistEvent *ev, int num) { if (h->h_next != history_def_next) { he_seterrev(ev, _HE_NOT_ALLOWED); return (-1); } if (num < 0) { he_seterrev(ev, _HE_BAD_PARAM); return (-1); } history_def_setsize(h->h_ref, num); return (0); } /* history_getsize(): * Get number of events currently in history */ private int history_getsize(History *h, HistEvent *ev) { if (h->h_next != history_def_next) { he_seterrev(ev, _HE_NOT_ALLOWED); return (-1); } ev->num = history_def_getsize(h->h_ref); if (ev->num < -1) { he_seterrev(ev, _HE_SIZE_NEGATIVE); return (-1); } return (0); } /* history_setunique(): * Set if adjacent equal events should not be entered in history. */ private int history_setunique(History *h, HistEvent *ev, int uni) { if (h->h_next != history_def_next) { he_seterrev(ev, _HE_NOT_ALLOWED); return (-1); } history_def_setunique(h->h_ref, uni); return (0); } /* history_getunique(): * Get if adjacent equal events should not be entered in history. */ private int history_getunique(History *h, HistEvent *ev) { if (h->h_next != history_def_next) { he_seterrev(ev, _HE_NOT_ALLOWED); return (-1); } ev->num = history_def_getunique(h->h_ref); return (0); } /* history_set_fun(): * Set history functions */ private int history_set_fun(History *h, History *nh) { HistEvent ev; if (nh->h_first == NULL || nh->h_next == NULL || nh->h_last == NULL || nh->h_prev == NULL || nh->h_curr == NULL || nh->h_set == NULL || nh->h_enter == NULL || nh->h_add == NULL || nh->h_clear == NULL || nh->h_del == NULL || nh->h_ref == NULL) { if (h->h_next != history_def_next) { history_def_init(&h->h_ref, &ev, 0); h->h_first = history_def_first; h->h_next = history_def_next; h->h_last = history_def_last; h->h_prev = history_def_prev; h->h_curr = history_def_curr; h->h_set = history_def_set; h->h_clear = history_def_clear; h->h_enter = history_def_enter; h->h_add = history_def_add; h->h_del = history_def_del; } return (-1); } if (h->h_next == history_def_next) history_def_clear(h->h_ref, &ev); h->h_ent = -1; h->h_first = nh->h_first; h->h_next = nh->h_next; h->h_last = nh->h_last; h->h_prev = nh->h_prev; h->h_curr = nh->h_curr; h->h_set = nh->h_set; h->h_clear = nh->h_clear; h->h_enter = nh->h_enter; h->h_add = nh->h_add; h->h_del = nh->h_del; return (0); } /* history_load(): * History load function */ private int history_load(History *h, const char *fname) { FILE *fp; char *line; size_t sz, max_size; char *ptr; int i = -1; HistEvent ev; if ((fp = fopen(fname, "r")) == NULL) return (i); if ((line = fgetln(fp, &sz)) == NULL) goto done; if (strncmp(line, hist_cookie, sz) != 0) goto done; ptr = h_malloc(max_size = 1024); if (ptr == NULL) goto done; for (i = 0; (line = fgetln(fp, &sz)) != NULL; i++) { char c = line[sz]; if (sz != 0 && line[sz - 1] == '\n') line[--sz] = '\0'; else line[sz] = '\0'; if (max_size < sz) { char *nptr; max_size = (sz + 1024) & ~1023; nptr = h_realloc(ptr, max_size); if (nptr == NULL) { i = -1; goto oomem; } ptr = nptr; } (void) strunvis(ptr, line); line[sz] = c; if (HENTER(h, &ev, ptr) == -1) { h_free((ptr_t)ptr); return -1; } } oomem: h_free((ptr_t)ptr); done: (void) fclose(fp); return (i); } /* history_save(): * History save function */ private int history_save(History *h, const char *fname) { FILE *fp; HistEvent ev; int i = -1, retval; size_t len, max_size; char *ptr; if ((fp = fopen(fname, "w")) == NULL) return (-1); if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1) goto done; if (fputs(hist_cookie, fp) == EOF) goto done; ptr = h_malloc(max_size = 1024); if (ptr == NULL) goto done; for (i = 0, retval = HLAST(h, &ev); retval != -1; retval = HPREV(h, &ev), i++) { len = strlen(ev.str) * 4; if (len >= max_size) { char *nptr; max_size = (len + 1024) & ~1023; nptr = h_realloc(ptr, max_size); if (nptr == NULL) { i = -1; goto oomem; } ptr = nptr; } (void) strvis(ptr, ev.str, VIS_WHITE); (void) fprintf(fp, "%s\n", ptr); } oomem: h_free((ptr_t)ptr); done: (void) fclose(fp); return (i); } /* history_prev_event(): * Find the previous event, with number given */ private int history_prev_event(History *h, HistEvent *ev, int num) { int retval; for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev)) if (ev->num == num) return (0); he_seterrev(ev, _HE_NOT_FOUND); return (-1); } /* history_next_event(): * Find the next event, with number given */ private int history_next_event(History *h, HistEvent *ev, int num) { int retval; for (retval = HCURR(h, ev); retval != -1; retval = HNEXT(h, ev)) if (ev->num == num) return (0); he_seterrev(ev, _HE_NOT_FOUND); return (-1); } /* history_prev_string(): * Find the previous event beginning with string */ private int history_prev_string(History *h, HistEvent *ev, const char *str) { size_t len = strlen(str); int retval; for (retval = HCURR(h, ev); retval != -1; retval = HNEXT(h, ev)) if (strncmp(str, ev->str, len) == 0) return (0); he_seterrev(ev, _HE_NOT_FOUND); return (-1); } /* history_next_string(): * Find the next event beginning with string */ private int history_next_string(History *h, HistEvent *ev, const char *str) { size_t len = strlen(str); int retval; for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev)) if (strncmp(str, ev->str, len) == 0) return (0); he_seterrev(ev, _HE_NOT_FOUND); return (-1); } /* history(): * User interface to history functions. */ int history(History *h, HistEvent *ev, int fun, ...) { va_list va; const char *str; int retval; va_start(va, fun); he_seterrev(ev, _HE_OK); switch (fun) { case H_GETSIZE: retval = history_getsize(h, ev); break; case H_SETSIZE: retval = history_setsize(h, ev, va_arg(va, int)); break; case H_GETUNIQUE: retval = history_getunique(h, ev); break; case H_SETUNIQUE: retval = history_setunique(h, ev, va_arg(va, int)); break; case H_ADD: str = va_arg(va, const char *); retval = HADD(h, ev, str); break; case H_DEL: retval = HDEL(h, ev, va_arg(va, const int)); break; case H_ENTER: str = va_arg(va, const char *); if ((retval = HENTER(h, ev, str)) != -1) h->h_ent = ev->num; break; case H_APPEND: str = va_arg(va, const char *); if ((retval = HSET(h, ev, h->h_ent)) != -1) retval = HADD(h, ev, str); break; case H_FIRST: retval = HFIRST(h, ev); break; case H_NEXT: retval = HNEXT(h, ev); break; case H_LAST: retval = HLAST(h, ev); break; case H_PREV: retval = HPREV(h, ev); break; case H_CURR: retval = HCURR(h, ev); break; case H_SET: retval = HSET(h, ev, va_arg(va, const int)); break; case H_CLEAR: HCLEAR(h, ev); retval = 0; break; case H_LOAD: retval = history_load(h, va_arg(va, const char *)); if (retval == -1) he_seterrev(ev, _HE_HIST_READ); break; case H_SAVE: retval = history_save(h, va_arg(va, const char *)); if (retval == -1) he_seterrev(ev, _HE_HIST_WRITE); break; case H_PREV_EVENT: retval = history_prev_event(h, ev, va_arg(va, int)); break; case H_NEXT_EVENT: retval = history_next_event(h, ev, va_arg(va, int)); break; case H_PREV_STR: retval = history_prev_string(h, ev, va_arg(va, const char *)); break; case H_NEXT_STR: retval = history_next_string(h, ev, va_arg(va, const char *)); break; case H_FUNC: { History hf; hf.h_ref = va_arg(va, ptr_t); h->h_ent = -1; hf.h_first = va_arg(va, history_gfun_t); hf.h_next = va_arg(va, history_gfun_t); hf.h_last = va_arg(va, history_gfun_t); hf.h_prev = va_arg(va, history_gfun_t); hf.h_curr = va_arg(va, history_gfun_t); hf.h_set = va_arg(va, history_sfun_t); hf.h_clear = va_arg(va, history_vfun_t); hf.h_enter = va_arg(va, history_efun_t); hf.h_add = va_arg(va, history_efun_t); hf.h_del = va_arg(va, history_sfun_t); if ((retval = history_set_fun(h, &hf)) == -1) he_seterrev(ev, _HE_PARAM_MISSING); break; } case H_END: history_end(h); retval = 0; break; default: retval = -1; he_seterrev(ev, _HE_UNKNOWN); break; } va_end(va); return (retval); } openipmi-2.0.18/libedit/strlcat.c0000644000175000017500000000420110373140634015630 0ustar chuckchuck/* $NetBSD: strlcat.c,v 1.1 2005/12/20 19:28:52 christos Exp $ */ /* $OpenBSD: strlcat.c,v 1.10 2003/04/12 21:56:39 millert Exp $ */ /* * Copyright (c) 1998 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "sys.h" #if defined(LIBC_SCCS) && !defined(lint) __RCSID("$NetBSD: strlcat.c,v 1.1 2005/12/20 19:28:52 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #include #include #include #ifdef _LIBC # ifdef __weak_alias __weak_alias(strlcat, _strlcat) # endif #endif #if !HAVE_STRLCAT /* * Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters * will be copied. Always NUL terminates (unless siz <= strlen(dst)). * Returns strlen(src) + MIN(siz, strlen(initial dst)). * If retval >= siz, truncation occurred. */ size_t #ifdef _LIBC _strlcat(dst, src, siz) #else strlcat(dst, src, siz) #endif char *dst; const char *src; size_t siz; { char *d = dst; const char *s = src; size_t n = siz; size_t dlen; _DIAGASSERT(dst != NULL); _DIAGASSERT(src != NULL); /* Find the end of dst and adjust bytes left but don't go past end */ while (n-- != 0 && *d != '\0') d++; dlen = d - dst; n = siz - dlen; if (n == 0) return(dlen + strlen(s)); while (*s != '\0') { if (n != 1) { *d++ = *s; n--; } s++; } *d = '\0'; return(dlen + (s - src)); /* count does not include NUL */ } #endif openipmi-2.0.18/libedit/orig_editline.diff20000644000175000017500000003562710401067310017550 0ustar chuckchuck? common.h ? emacs.h ? fcns.c ? fcns.h ? help.c ? help.h ? orig_editline.diff2 ? vi.h Index: read.c =================================================================== RCS file: /cvsroot/openipmi/OpenIPMI/libedit/read.c,v retrieving revision 1.1 diff -u -r1.1 read.c --- read.c 10 Feb 2006 16:38:52 -0000 1.1 +++ read.c 28 Feb 2006 15:38:28 -0000 @@ -1,612 +0,0 @@ -/* $NetBSD: read.c,v 1.39 2005/08/02 12:11:14 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "sys.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: read.c,v 1.39 2005/08/02 12:11:14 christos Exp $"); -#endif -#endif /* not lint && not SCCSID */ - -/* - * read.c: Clean this junk up! This is horrible code. - * Terminal read functions - */ -#include -#include -#include -#include -#include "el.h" - -#define OKCMD -1 - -private int read__fixio(int, int); -private int read_preread(EditLine *); -private int read_char(EditLine *, char *); -private int read_getcmd(EditLine *, el_action_t *, char *); - -/* read_init(): - * Initialize the read stuff - */ -protected int -read_init(EditLine *el) -{ - /* builtin read_char */ - el->el_read.read_char = read_char; - return 0; -} - - -/* el_read_setfn(): - * Set the read char function to the one provided. - * If it is set to EL_BUILTIN_GETCFN, then reset to the builtin one. - */ -protected int -el_read_setfn(EditLine *el, el_rfunc_t rc) -{ - el->el_read.read_char = (rc == EL_BUILTIN_GETCFN) ? read_char : rc; - return 0; -} - - -/* el_read_getfn(): - * return the current read char function, or EL_BUILTIN_GETCFN - * if it is the default one - */ -protected el_rfunc_t -el_read_getfn(EditLine *el) -{ - return (el->el_read.read_char == read_char) ? - EL_BUILTIN_GETCFN : el->el_read.read_char; -} - - -#ifndef MIN -#define MIN(A,B) ((A) < (B) ? (A) : (B)) -#endif - -#ifdef DEBUG_EDIT -private void -read_debug(EditLine *el) -{ - - if (el->el_line.cursor > el->el_line.lastchar) - (void) fprintf(el->el_errfile, "cursor > lastchar\r\n"); - if (el->el_line.cursor < el->el_line.buffer) - (void) fprintf(el->el_errfile, "cursor < buffer\r\n"); - if (el->el_line.cursor > el->el_line.limit) - (void) fprintf(el->el_errfile, "cursor > limit\r\n"); - if (el->el_line.lastchar > el->el_line.limit) - (void) fprintf(el->el_errfile, "lastchar > limit\r\n"); - if (el->el_line.limit != &el->el_line.buffer[EL_BUFSIZ - 2]) - (void) fprintf(el->el_errfile, "limit != &buffer[EL_BUFSIZ-2]\r\n"); -} -#endif /* DEBUG_EDIT */ - - -/* read__fixio(): - * Try to recover from a read error - */ -/* ARGSUSED */ -private int -read__fixio(int fd __attribute__((__unused__)), int e) -{ - - switch (e) { - case -1: /* Make sure that the code is reachable */ - -#ifdef EWOULDBLOCK - case EWOULDBLOCK: -#ifndef TRY_AGAIN -#define TRY_AGAIN -#endif -#endif /* EWOULDBLOCK */ - -#if defined(POSIX) && defined(EAGAIN) -#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN - case EAGAIN: -#ifndef TRY_AGAIN -#define TRY_AGAIN -#endif -#endif /* EWOULDBLOCK && EWOULDBLOCK != EAGAIN */ -#endif /* POSIX && EAGAIN */ - - e = 0; -#ifdef TRY_AGAIN -#if defined(F_SETFL) && defined(O_NDELAY) - if ((e = fcntl(fd, F_GETFL, 0)) == -1) - return (-1); - - if (fcntl(fd, F_SETFL, e & ~O_NDELAY) == -1) - return (-1); - else - e = 1; -#endif /* F_SETFL && O_NDELAY */ - -#ifdef FIONBIO - { - int zero = 0; - - if (ioctl(fd, FIONBIO, (ioctl_t) & zero) == -1) - return (-1); - else - e = 1; - } -#endif /* FIONBIO */ - -#endif /* TRY_AGAIN */ - return (e ? 0 : -1); - - case EINTR: - return (0); - - default: - return (-1); - } -} - - -/* read_preread(): - * Try to read the stuff in the input queue; - */ -private int -read_preread(EditLine *el) -{ - int chrs = 0; - - if (el->el_tty.t_mode == ED_IO) - return (0); - -#ifdef FIONREAD - (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs); - if (chrs > 0) { - char buf[EL_BUFSIZ]; - - chrs = read(el->el_infd, buf, - (size_t) MIN(chrs, EL_BUFSIZ - 1)); - if (chrs > 0) { - buf[chrs] = '\0'; - el_push(el, buf); - } - } -#endif /* FIONREAD */ - - return (chrs > 0); -} - - -/* el_push(): - * Push a macro - */ -public void -el_push(EditLine *el, char *str) -{ - c_macro_t *ma = &el->el_chared.c_macro; - - if (str != NULL && ma->level + 1 < EL_MAXMACRO) { - ma->level++; - if ((ma->macro[ma->level] = el_strdup(str)) != NULL) - return; - ma->level--; - } - term_beep(el); - term__flush(); -} - - -/* read_getcmd(): - * Return next command from the input stream. - */ -private int -read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch) -{ - el_action_t cmd; - int num; - - do { - if ((num = el_getc(el, ch)) != 1) /* if EOF or error */ - return (num); - -#ifdef KANJI - if ((*ch & 0200)) { - el->el_state.metanext = 0; - cmd = CcViMap[' ']; - break; - } else -#endif /* KANJI */ - - if (el->el_state.metanext) { - el->el_state.metanext = 0; - *ch |= 0200; - } - cmd = el->el_map.current[(unsigned char) *ch]; - if (cmd == ED_SEQUENCE_LEAD_IN) { - key_value_t val; - switch (key_get(el, ch, &val)) { - case XK_CMD: - cmd = val.cmd; - break; - case XK_STR: - el_push(el, val.str); - break; -#ifdef notyet - case XK_EXE: - /* XXX: In the future to run a user function */ - RunCommand(val.str); - break; -#endif - default: - EL_ABORT((el->el_errfile, "Bad XK_ type \n")); - break; - } - } - if (el->el_map.alt == NULL) - el->el_map.current = el->el_map.key; - } while (cmd == ED_SEQUENCE_LEAD_IN); - *cmdnum = cmd; - return (OKCMD); -} - - -/* read_char(): - * Read a character from the tty. - */ -private int -read_char(EditLine *el, char *cp) -{ - int num_read; - int tried = 0; - - while ((num_read = read(el->el_infd, cp, 1)) == -1) - if (!tried && read__fixio(el->el_infd, errno) == 0) - tried = 1; - else { - *cp = '\0'; - return (-1); - } - - return (num_read); -} - - -/* el_getc(): - * Read a character - */ -public int -el_getc(EditLine *el, char *cp) -{ - int num_read; - c_macro_t *ma = &el->el_chared.c_macro; - - term__flush(); - for (;;) { - if (ma->level < 0) { - if (!read_preread(el)) - break; - } - if (ma->level < 0) - break; - - if (ma->macro[ma->level][ma->offset] == '\0') { - el_free(ma->macro[ma->level--]); - ma->offset = 0; - continue; - } - *cp = ma->macro[ma->level][ma->offset++] & 0377; - if (ma->macro[ma->level][ma->offset] == '\0') { - /* Needed for QuoteMode On */ - el_free(ma->macro[ma->level--]); - ma->offset = 0; - } - return (1); - } - -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, "Turning raw mode on\n"); -#endif /* DEBUG_READ */ - if (tty_rawmode(el) < 0)/* make sure the tty is set up correctly */ - return (0); - -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, "Reading a character\n"); -#endif /* DEBUG_READ */ - num_read = (*el->el_read.read_char)(el, cp); -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, "Got it %c\n", *cp); -#endif /* DEBUG_READ */ - return (num_read); -} - -protected void -read_prepare(EditLine *el) -{ - if (el->el_flags & HANDLE_SIGNALS) - sig_set(el); - if (el->el_flags & NO_TTY) - return; - if ((el->el_flags & (UNBUFFERED|EDIT_DISABLED)) == UNBUFFERED) - tty_rawmode(el); - - /* This is relatively cheap, and things go terribly wrong if - we have the wrong size. */ - el_resize(el); - re_clear_display(el); /* reset the display stuff */ - ch_reset(el, 0); - re_refresh(el); /* print the prompt */ - - if (el->el_flags & UNBUFFERED) - term__flush(); -} - -protected void -read_finish(EditLine *el) -{ - if ((el->el_flags & UNBUFFERED) == 0) - (void) tty_cookedmode(el); - if (el->el_flags & HANDLE_SIGNALS) - sig_clr(el); -} - -public const char * -el_gets(EditLine *el, int *nread) -{ - int retval; - el_action_t cmdnum = 0; - int num; /* how many chars we have read at NL */ - char ch; - int crlf = 0; -#ifdef FIONREAD - c_macro_t *ma = &el->el_chared.c_macro; -#endif /* FIONREAD */ - - if (el->el_flags & NO_TTY) { - char *cp = el->el_line.buffer; - size_t idx; - - while ((*el->el_read.read_char)(el, cp) == 1) { - /* make sure there is space for next character */ - if (cp + 1 >= el->el_line.limit) { - idx = (cp - el->el_line.buffer); - if (!ch_enlargebufs(el, 2)) - break; - cp = &el->el_line.buffer[idx]; - } - cp++; - if (el->el_flags & UNBUFFERED) - break; - if (cp[-1] == '\r' || cp[-1] == '\n') - break; - } - - el->el_line.cursor = el->el_line.lastchar = cp; - *cp = '\0'; - if (nread) - *nread = el->el_line.cursor - el->el_line.buffer; - return (el->el_line.buffer); - } - - -#ifdef FIONREAD - if (el->el_tty.t_mode == EX_IO && ma->level < 0) { - long chrs = 0; - - (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs); - if (chrs == 0) { - if (tty_rawmode(el) < 0) { - if (nread) - *nread = 0; - return (NULL); - } - } - } -#endif /* FIONREAD */ - - if ((el->el_flags & UNBUFFERED) == 0) - read_prepare(el); - - if (el->el_flags & EDIT_DISABLED) { - char *cp; - size_t idx; - if ((el->el_flags & UNBUFFERED) == 0) - cp = el->el_line.buffer; - else - cp = el->el_line.lastchar; - - term__flush(); - - while ((*el->el_read.read_char)(el, cp) == 1) { - /* make sure there is space next character */ - if (cp + 1 >= el->el_line.limit) { - idx = (cp - el->el_line.buffer); - if (!ch_enlargebufs(el, 2)) - break; - cp = &el->el_line.buffer[idx]; - } - if (*cp == 4) /* ought to be stty eof */ - break; - cp++; - crlf = cp[-1] == '\r' || cp[-1] == '\n'; - if (el->el_flags & UNBUFFERED) - break; - if (crlf) - break; - } - - el->el_line.cursor = el->el_line.lastchar = cp; - *cp = '\0'; - if (nread) - *nread = el->el_line.cursor - el->el_line.buffer; - return (el->el_line.buffer); - } - - for (num = OKCMD; num == OKCMD;) { /* while still editing this - * line */ -#ifdef DEBUG_EDIT - read_debug(el); -#endif /* DEBUG_EDIT */ - /* if EOF or error */ - if ((num = read_getcmd(el, &cmdnum, &ch)) != OKCMD) { -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, - "Returning from el_gets %d\n", num); -#endif /* DEBUG_READ */ - break; - } - if ((unsigned int)cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */ -#ifdef DEBUG_EDIT - (void) fprintf(el->el_errfile, - "ERROR: illegal command from key 0%o\r\n", ch); -#endif /* DEBUG_EDIT */ - continue; /* try again */ - } - /* now do the real command */ -#ifdef DEBUG_READ - { - el_bindings_t *b; - for (b = el->el_map.help; b->name; b++) - if (b->func == cmdnum) - break; - if (b->name) - (void) fprintf(el->el_errfile, - "Executing %s\n", b->name); - else - (void) fprintf(el->el_errfile, - "Error command = %d\n", cmdnum); - } -#endif /* DEBUG_READ */ - /* vi redo needs these way down the levels... */ - el->el_state.thiscmd = cmdnum; - el->el_state.thisch = ch; - if (el->el_map.type == MAP_VI && - el->el_map.current == el->el_map.key && - el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) { - if (cmdnum == VI_DELETE_PREV_CHAR && - el->el_chared.c_redo.pos != el->el_chared.c_redo.buf - && isprint((unsigned char)el->el_chared.c_redo.pos[-1])) - el->el_chared.c_redo.pos--; - else - *el->el_chared.c_redo.pos++ = ch; - } - retval = (*el->el_map.func[cmdnum]) (el, ch); -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, - "Returned state %d\n", retval ); -#endif /* DEBUG_READ */ - - /* save the last command here */ - el->el_state.lastcmd = cmdnum; - - /* use any return value */ - switch (retval) { - case CC_CURSOR: - re_refresh_cursor(el); - break; - - case CC_REDISPLAY: - re_clear_lines(el); - re_clear_display(el); - /* FALLTHROUGH */ - - case CC_REFRESH: - re_refresh(el); - break; - - case CC_REFRESH_BEEP: - re_refresh(el); - term_beep(el); - break; - - case CC_NORM: /* normal char */ - break; - - case CC_ARGHACK: /* Suggested by Rich Salz */ - /* */ - continue; /* keep going... */ - - case CC_EOF: /* end of file typed */ - if ((el->el_flags & UNBUFFERED) == 0) - num = 0; - else if (num == -1) { - *el->el_line.lastchar++ = CONTROL('d'); - el->el_line.cursor = el->el_line.lastchar; - num = 1; - } - break; - - case CC_NEWLINE: /* normal end of line */ - num = el->el_line.lastchar - el->el_line.buffer; - break; - - case CC_FATAL: /* fatal error, reset to known state */ -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, - "*** editor fatal ERROR ***\r\n\n"); -#endif /* DEBUG_READ */ - /* put (real) cursor in a known place */ - re_clear_display(el); /* reset the display stuff */ - ch_reset(el, 1); /* reset the input pointers */ - re_refresh(el); /* print the prompt again */ - break; - - case CC_ERROR: - default: /* functions we don't know about */ -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, - "*** editor ERROR ***\r\n\n"); -#endif /* DEBUG_READ */ - term_beep(el); - term__flush(); - break; - } - el->el_state.argument = 1; - el->el_state.doingarg = 0; - el->el_chared.c_vcmd.action = NOP; - if (el->el_flags & UNBUFFERED) - break; - } - - term__flush(); /* flush any buffered output */ - /* make sure the tty is set up correctly */ - if ((el->el_flags & UNBUFFERED) == 0) { - read_finish(el); - if (nread) - *nread = num; - } else { - if (nread) - *nread = el->el_line.lastchar - el->el_line.buffer; - } - return (num ? el->el_line.buffer : NULL); -} openipmi-2.0.18/libedit/map.h0000644000175000017500000000612410373140634014744 0ustar chuckchuck/* $NetBSD: map.h,v 1.8 2003/08/07 16:44:32 agc Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)map.h 8.1 (Berkeley) 6/4/93 */ /* * el.map.h: Editor maps */ #ifndef _h_el_map #define _h_el_map typedef struct el_bindings_t { /* for the "bind" shell command */ const char *name; /* function name for bind command */ int func; /* function numeric value */ const char *description; /* description of function */ } el_bindings_t; typedef struct el_map_t { el_action_t *alt; /* The current alternate key map */ el_action_t *key; /* The current normal key map */ el_action_t *current; /* The keymap we are using */ const el_action_t *emacs; /* The default emacs key map */ const el_action_t *vic; /* The vi command mode key map */ const el_action_t *vii; /* The vi insert mode key map */ int type; /* Emacs or vi */ el_bindings_t *help; /* The help for the editor functions */ el_func_t *func; /* List of available functions */ int nfunc; /* The number of functions/help items */ } el_map_t; #define MAP_EMACS 0 #define MAP_VI 1 protected int map_bind(EditLine *, int, const char **); protected int map_init(EditLine *); protected void map_end(EditLine *); protected void map_init_vi(EditLine *); protected void map_init_emacs(EditLine *); protected int map_set_editor(EditLine *, char *); protected int map_get_editor(EditLine *, const char **); protected int map_addfunc(EditLine *, const char *, const char *, el_func_t); #endif /* _h_el_map */ openipmi-2.0.18/libedit/tokenizer.c0000644000175000017500000002315610373140634016200 0ustar chuckchuck/* $NetBSD: tokenizer.c,v 1.14 2003/12/05 13:37:48 lukem Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)tokenizer.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: tokenizer.c,v 1.14 2003/12/05 13:37:48 lukem Exp $"); #endif #endif /* not lint && not SCCSID */ /* * tokenize.c: Bourne shell like tokenizer */ #include #include #include "histedit.h" typedef enum { Q_none, Q_single, Q_double, Q_one, Q_doubleone } quote_t; #define IFS "\t \n" #define TOK_KEEP 1 #define TOK_EAT 2 #define WINCR 20 #define AINCR 10 #define tok_strdup(a) strdup(a) #define tok_malloc(a) malloc(a) #define tok_free(a) free(a) #define tok_realloc(a, b) realloc(a, b) struct tokenizer { char *ifs; /* In field separator */ int argc, amax; /* Current and maximum number of args */ char **argv; /* Argument list */ char *wptr, *wmax; /* Space and limit on the word buffer */ char *wstart; /* Beginning of next word */ char *wspace; /* Space of word buffer */ quote_t quote; /* Quoting state */ int flags; /* flags; */ }; private void tok_finish(Tokenizer *); /* tok_finish(): * Finish a word in the tokenizer. */ private void tok_finish(Tokenizer *tok) { *tok->wptr = '\0'; if ((tok->flags & TOK_KEEP) || tok->wptr != tok->wstart) { tok->argv[tok->argc++] = tok->wstart; tok->argv[tok->argc] = NULL; tok->wstart = ++tok->wptr; } tok->flags &= ~TOK_KEEP; } /* tok_init(): * Initialize the tokenizer */ public Tokenizer * tok_init(const char *ifs) { Tokenizer *tok = (Tokenizer *) tok_malloc(sizeof(Tokenizer)); if (tok == NULL) return NULL; tok->ifs = tok_strdup(ifs ? ifs : IFS); if (tok->ifs == NULL) { tok_free((ptr_t)tok); return NULL; } tok->argc = 0; tok->amax = AINCR; tok->argv = (char **) tok_malloc(sizeof(char *) * tok->amax); if (tok->argv == NULL) { tok_free((ptr_t)tok->ifs); tok_free((ptr_t)tok); return NULL; } tok->argv[0] = NULL; tok->wspace = (char *) tok_malloc(WINCR); if (tok->wspace == NULL) { tok_free((ptr_t)tok->argv); tok_free((ptr_t)tok->ifs); tok_free((ptr_t)tok); return NULL; } tok->wmax = tok->wspace + WINCR; tok->wstart = tok->wspace; tok->wptr = tok->wspace; tok->flags = 0; tok->quote = Q_none; return (tok); } /* tok_reset(): * Reset the tokenizer */ public void tok_reset(Tokenizer *tok) { tok->argc = 0; tok->wstart = tok->wspace; tok->wptr = tok->wspace; tok->flags = 0; tok->quote = Q_none; } /* tok_end(): * Clean up */ public void tok_end(Tokenizer *tok) { tok_free((ptr_t) tok->ifs); tok_free((ptr_t) tok->wspace); tok_free((ptr_t) tok->argv); tok_free((ptr_t) tok); } /* tok_line(): * Bourne shell (sh(1)) like tokenizing * Arguments: * tok current tokenizer state (setup with tok_init()) * line line to parse * Returns: * -1 Internal error * 3 Quoted return * 2 Unmatched double quote * 1 Unmatched single quote * 0 Ok * Modifies (if return value is 0): * argc number of arguments * argv argument array * cursorc if !NULL, argv element containing cursor * cursorv if !NULL, offset in argv[cursorc] of cursor */ public int tok_line(Tokenizer *tok, const LineInfo *line, int *argc, const char ***argv, int *cursorc, int *cursoro) { const char *ptr; int cc, co; cc = co = -1; ptr = line->buffer; for (ptr = line->buffer; ;ptr++) { if (ptr >= line->lastchar) ptr = ""; if (ptr == line->cursor) { cc = tok->argc; co = tok->wptr - tok->wstart; } switch (*ptr) { case '\'': tok->flags |= TOK_KEEP; tok->flags &= ~TOK_EAT; switch (tok->quote) { case Q_none: tok->quote = Q_single; /* Enter single quote * mode */ break; case Q_single: /* Exit single quote mode */ tok->quote = Q_none; break; case Q_one: /* Quote this ' */ tok->quote = Q_none; *tok->wptr++ = *ptr; break; case Q_double: /* Stay in double quote mode */ *tok->wptr++ = *ptr; break; case Q_doubleone: /* Quote this ' */ tok->quote = Q_double; *tok->wptr++ = *ptr; break; default: return (-1); } break; case '"': tok->flags &= ~TOK_EAT; tok->flags |= TOK_KEEP; switch (tok->quote) { case Q_none: /* Enter double quote mode */ tok->quote = Q_double; break; case Q_double: /* Exit double quote mode */ tok->quote = Q_none; break; case Q_one: /* Quote this " */ tok->quote = Q_none; *tok->wptr++ = *ptr; break; case Q_single: /* Stay in single quote mode */ *tok->wptr++ = *ptr; break; case Q_doubleone: /* Quote this " */ tok->quote = Q_double; *tok->wptr++ = *ptr; break; default: return (-1); } break; case '\\': tok->flags |= TOK_KEEP; tok->flags &= ~TOK_EAT; switch (tok->quote) { case Q_none: /* Quote next character */ tok->quote = Q_one; break; case Q_double: /* Quote next character */ tok->quote = Q_doubleone; break; case Q_one: /* Quote this, restore state */ *tok->wptr++ = *ptr; tok->quote = Q_none; break; case Q_single: /* Stay in single quote mode */ *tok->wptr++ = *ptr; break; case Q_doubleone: /* Quote this \ */ tok->quote = Q_double; *tok->wptr++ = *ptr; break; default: return (-1); } break; case '\n': tok->flags &= ~TOK_EAT; switch (tok->quote) { case Q_none: goto tok_line_outok; case Q_single: case Q_double: *tok->wptr++ = *ptr; /* Add the return */ break; case Q_doubleone: /* Back to double, eat the '\n' */ tok->flags |= TOK_EAT; tok->quote = Q_double; break; case Q_one: /* No quote, more eat the '\n' */ tok->flags |= TOK_EAT; tok->quote = Q_none; break; default: return (0); } break; case '\0': switch (tok->quote) { case Q_none: /* Finish word and return */ if (tok->flags & TOK_EAT) { tok->flags &= ~TOK_EAT; return (3); } goto tok_line_outok; case Q_single: return (1); case Q_double: return (2); case Q_doubleone: tok->quote = Q_double; *tok->wptr++ = *ptr; break; case Q_one: tok->quote = Q_none; *tok->wptr++ = *ptr; break; default: return (-1); } break; default: tok->flags &= ~TOK_EAT; switch (tok->quote) { case Q_none: if (strchr(tok->ifs, *ptr) != NULL) tok_finish(tok); else *tok->wptr++ = *ptr; break; case Q_single: case Q_double: *tok->wptr++ = *ptr; break; case Q_doubleone: *tok->wptr++ = '\\'; tok->quote = Q_double; *tok->wptr++ = *ptr; break; case Q_one: tok->quote = Q_none; *tok->wptr++ = *ptr; break; default: return (-1); } break; } if (tok->wptr >= tok->wmax - 4) { size_t size = tok->wmax - tok->wspace + WINCR; char *s = (char *) tok_realloc(tok->wspace, size); if (s == NULL) return (-1); if (s != tok->wspace) { int i; for (i = 0; i < tok->argc; i++) { tok->argv[i] = (tok->argv[i] - tok->wspace) + s; } tok->wptr = (tok->wptr - tok->wspace) + s; tok->wstart = (tok->wstart - tok->wspace) + s; tok->wspace = s; } tok->wmax = s + size; } if (tok->argc >= tok->amax - 4) { char **p; tok->amax += AINCR; p = (char **) tok_realloc(tok->argv, tok->amax * sizeof(char *)); if (p == NULL) return (-1); tok->argv = p; } } tok_line_outok: if (cc == -1 && co == -1) { cc = tok->argc; co = tok->wptr - tok->wstart; } if (cursorc != NULL) *cursorc = cc; if (cursoro != NULL) *cursoro = co; tok_finish(tok); *argv = (const char **)tok->argv; *argc = tok->argc; return (0); } /* tok_str(): * Simpler version of tok_line, taking a NUL terminated line * and splitting into words, ignoring cursor state. */ public int tok_str(Tokenizer *tok, const char *line, int *argc, const char ***argv) { LineInfo li; memset(&li, 0, sizeof(li)); li.buffer = line; li.cursor = li.lastchar = strchr(line, '\0'); return (tok_line(tok, &li, argc, argv, NULL, NULL)); } openipmi-2.0.18/libedit/key.c0000644000175000017500000004026610373140634014757 0ustar chuckchuck/* $NetBSD: key.c,v 1.17 2005/08/08 14:05:37 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: key.c,v 1.17 2005/08/08 14:05:37 christos Exp $"); #endif #endif /* not lint && not SCCSID */ /* * key.c: This module contains the procedures for maintaining * the extended-key map. * * An extended-key (key) is a sequence of keystrokes introduced * with a sequence introducer and consisting of an arbitrary * number of characters. This module maintains a map (the el->el_key.map) * to convert these extended-key sequences into input strs * (XK_STR), editor functions (XK_CMD), or unix commands (XK_EXE). * * Warning: * If key is a substr of some other keys, then the longer * keys are lost!! That is, if the keys "abcd" and "abcef" * are in el->el_key.map, adding the key "abc" will cause the first two * definitions to be lost. * * Restrictions: * ------------- * 1) It is not possible to have one key that is a * substr of another. */ #include #include #include "el.h" /* * The Nodes of the el->el_key.map. The el->el_key.map is a linked list * of these node elements */ struct key_node_t { char ch; /* single character of key */ int type; /* node type */ key_value_t val; /* command code or pointer to str, */ /* if this is a leaf */ struct key_node_t *next; /* ptr to next char of this key */ struct key_node_t *sibling; /* ptr to another key with same prefix*/ }; private int node_trav(EditLine *, key_node_t *, char *, key_value_t *); private int node__try(EditLine *, key_node_t *, const char *, key_value_t *, int); private key_node_t *node__get(int); private void node__free(key_node_t *); private void node__put(EditLine *, key_node_t *); private int node__delete(EditLine *, key_node_t **, const char *); private int node_lookup(EditLine *, const char *, key_node_t *, int); private int node_enum(EditLine *, key_node_t *, int); private int key__decode_char(char *, int, int); #define KEY_BUFSIZ EL_BUFSIZ /* key_init(): * Initialize the key maps */ protected int key_init(EditLine *el) { el->el_key.buf = (char *) el_malloc(KEY_BUFSIZ); if (el->el_key.buf == NULL) return (-1); el->el_key.map = NULL; key_reset(el); return (0); } /* key_end(): * Free the key maps */ protected void key_end(EditLine *el) { el_free((ptr_t) el->el_key.buf); el->el_key.buf = NULL; node__free(el->el_key.map); } /* key_map_cmd(): * Associate cmd with a key value */ protected key_value_t * key_map_cmd(EditLine *el, int cmd) { el->el_key.val.cmd = (el_action_t) cmd; return (&el->el_key.val); } /* key_map_str(): * Associate str with a key value */ protected key_value_t * key_map_str(EditLine *el, char *str) { el->el_key.val.str = str; return (&el->el_key.val); } /* key_reset(): * Takes all nodes on el->el_key.map and puts them on free list. Then * initializes el->el_key.map with arrow keys * [Always bind the ansi arrow keys?] */ protected void key_reset(EditLine *el) { node__put(el, el->el_key.map); el->el_key.map = NULL; return; } /* key_get(): * Calls the recursive function with entry point el->el_key.map * Looks up *ch in map and then reads characters until a * complete match is found or a mismatch occurs. Returns the * type of the match found (XK_STR, XK_CMD, or XK_EXE). * Returns NULL in val.str and XK_STR for no match. * The last character read is returned in *ch. */ protected int key_get(EditLine *el, char *ch, key_value_t *val) { return (node_trav(el, el->el_key.map, ch, val)); } /* key_add(): * Adds key to the el->el_key.map and associates the value in val with it. * If key is already is in el->el_key.map, the new code is applied to the * existing key. Ntype specifies if code is a command, an * out str or a unix command. */ protected void key_add(EditLine *el, const char *key, key_value_t *val, int ntype) { if (key[0] == '\0') { (void) fprintf(el->el_errfile, "key_add: Null extended-key not allowed.\n"); return; } if (ntype == XK_CMD && val->cmd == ED_SEQUENCE_LEAD_IN) { (void) fprintf(el->el_errfile, "key_add: sequence-lead-in command not allowed\n"); return; } if (el->el_key.map == NULL) /* tree is initially empty. Set up new node to match key[0] */ el->el_key.map = node__get(key[0]); /* it is properly initialized */ /* Now recurse through el->el_key.map */ (void) node__try(el, el->el_key.map, key, val, ntype); return; } /* key_clear(): * */ protected void key_clear(EditLine *el, el_action_t *map, const char *in) { if ((map[(unsigned char)*in] == ED_SEQUENCE_LEAD_IN) && ((map == el->el_map.key && el->el_map.alt[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN) || (map == el->el_map.alt && el->el_map.key[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN))) (void) key_delete(el, in); } /* key_delete(): * Delete the key and all longer keys staring with key, if * they exists. */ protected int key_delete(EditLine *el, const char *key) { if (key[0] == '\0') { (void) fprintf(el->el_errfile, "key_delete: Null extended-key not allowed.\n"); return (-1); } if (el->el_key.map == NULL) return (0); (void) node__delete(el, &el->el_key.map, key); return (0); } /* key_print(): * Print the binding associated with key key. * Print entire el->el_key.map if null */ protected void key_print(EditLine *el, const char *key) { /* do nothing if el->el_key.map is empty and null key specified */ if (el->el_key.map == NULL && *key == 0) return; el->el_key.buf[0] = '"'; if (node_lookup(el, key, el->el_key.map, 1) <= -1) /* key is not bound */ (void) fprintf(el->el_errfile, "Unbound extended key \"%s\"\n", key); return; } /* node_trav(): * recursively traverses node in tree until match or mismatch is * found. May read in more characters. */ private int node_trav(EditLine *el, key_node_t *ptr, char *ch, key_value_t *val) { if (ptr->ch == *ch) { /* match found */ if (ptr->next) { /* key not complete so get next char */ if (el_getc(el, ch) != 1) { /* if EOF or error */ val->cmd = ED_END_OF_FILE; return (XK_CMD); /* PWP: Pretend we just read an end-of-file */ } return (node_trav(el, ptr->next, ch, val)); } else { *val = ptr->val; if (ptr->type != XK_CMD) *ch = '\0'; return (ptr->type); } } else { /* no match found here */ if (ptr->sibling) { /* try next sibling */ return (node_trav(el, ptr->sibling, ch, val)); } else { /* no next sibling -- mismatch */ val->str = NULL; return (XK_STR); } } } /* node__try(): * Find a node that matches *str or allocate a new one */ private int node__try(EditLine *el, key_node_t *ptr, const char *str, key_value_t *val, int ntype) { if (ptr->ch != *str) { key_node_t *xm; for (xm = ptr; xm->sibling != NULL; xm = xm->sibling) if (xm->sibling->ch == *str) break; if (xm->sibling == NULL) xm->sibling = node__get(*str); /* setup new node */ ptr = xm->sibling; } if (*++str == '\0') { /* we're there */ if (ptr->next != NULL) { node__put(el, ptr->next); /* lose longer keys with this prefix */ ptr->next = NULL; } switch (ptr->type) { case XK_CMD: case XK_NOD: break; case XK_STR: case XK_EXE: if (ptr->val.str) el_free((ptr_t) ptr->val.str); break; default: EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ptr->type)); break; } switch (ptr->type = ntype) { case XK_CMD: ptr->val = *val; break; case XK_STR: case XK_EXE: if ((ptr->val.str = el_strdup(val->str)) == NULL) return -1; break; default: EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype)); break; } } else { /* still more chars to go */ if (ptr->next == NULL) ptr->next = node__get(*str); /* setup new node */ (void) node__try(el, ptr->next, str, val, ntype); } return (0); } /* node__delete(): * Delete node that matches str */ private int node__delete(EditLine *el, key_node_t **inptr, const char *str) { key_node_t *ptr; key_node_t *prev_ptr = NULL; ptr = *inptr; if (ptr->ch != *str) { key_node_t *xm; for (xm = ptr; xm->sibling != NULL; xm = xm->sibling) if (xm->sibling->ch == *str) break; if (xm->sibling == NULL) return (0); prev_ptr = xm; ptr = xm->sibling; } if (*++str == '\0') { /* we're there */ if (prev_ptr == NULL) *inptr = ptr->sibling; else prev_ptr->sibling = ptr->sibling; ptr->sibling = NULL; node__put(el, ptr); return (1); } else if (ptr->next != NULL && node__delete(el, &ptr->next, str) == 1) { if (ptr->next != NULL) return (0); if (prev_ptr == NULL) *inptr = ptr->sibling; else prev_ptr->sibling = ptr->sibling; ptr->sibling = NULL; node__put(el, ptr); return (1); } else { return (0); } } /* node__put(): * Puts a tree of nodes onto free list using free(3). */ private void node__put(EditLine *el, key_node_t *ptr) { if (ptr == NULL) return; if (ptr->next != NULL) { node__put(el, ptr->next); ptr->next = NULL; } node__put(el, ptr->sibling); switch (ptr->type) { case XK_CMD: case XK_NOD: break; case XK_EXE: case XK_STR: if (ptr->val.str != NULL) el_free((ptr_t) ptr->val.str); break; default: EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ptr->type)); break; } el_free((ptr_t) ptr); } /* node__get(): * Returns pointer to a key_node_t for ch. */ private key_node_t * node__get(int ch) { key_node_t *ptr; ptr = (key_node_t *) el_malloc((size_t) sizeof(key_node_t)); if (ptr == NULL) return NULL; ptr->ch = ch; ptr->type = XK_NOD; ptr->val.str = NULL; ptr->next = NULL; ptr->sibling = NULL; return (ptr); } private void node__free(key_node_t *k) { if (k == NULL) return; node__free(k->sibling); node__free(k->next); el_free((ptr_t) k); } /* node_lookup(): * look for the str starting at node ptr. * Print if last node */ private int node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt) { int ncnt; if (ptr == NULL) return (-1); /* cannot have null ptr */ if (*str == 0) { /* no more chars in str. node_enum from here. */ (void) node_enum(el, ptr, cnt); return (0); } else { /* If match put this char into el->el_key.buf. Recurse */ if (ptr->ch == *str) { /* match found */ ncnt = key__decode_char(el->el_key.buf, cnt, (unsigned char) ptr->ch); if (ptr->next != NULL) /* not yet at leaf */ return (node_lookup(el, str + 1, ptr->next, ncnt + 1)); else { /* next node is null so key should be complete */ if (str[1] == 0) { el->el_key.buf[ncnt + 1] = '"'; el->el_key.buf[ncnt + 2] = '\0'; key_kprint(el, el->el_key.buf, &ptr->val, ptr->type); return (0); } else return (-1); /* mismatch -- str still has chars */ } } else { /* no match found try sibling */ if (ptr->sibling) return (node_lookup(el, str, ptr->sibling, cnt)); else return (-1); } } } /* node_enum(): * Traverse the node printing the characters it is bound in buffer */ private int node_enum(EditLine *el, key_node_t *ptr, int cnt) { int ncnt; if (cnt >= KEY_BUFSIZ - 5) { /* buffer too small */ el->el_key.buf[++cnt] = '"'; el->el_key.buf[++cnt] = '\0'; (void) fprintf(el->el_errfile, "Some extended keys too long for internal print buffer"); (void) fprintf(el->el_errfile, " \"%s...\"\n", el->el_key.buf); return (0); } if (ptr == NULL) { #ifdef DEBUG_EDIT (void) fprintf(el->el_errfile, "node_enum: BUG!! Null ptr passed\n!"); #endif return (-1); } /* put this char at end of str */ ncnt = key__decode_char(el->el_key.buf, cnt, (unsigned char) ptr->ch); if (ptr->next == NULL) { /* print this key and function */ el->el_key.buf[ncnt + 1] = '"'; el->el_key.buf[ncnt + 2] = '\0'; key_kprint(el, el->el_key.buf, &ptr->val, ptr->type); } else (void) node_enum(el, ptr->next, ncnt + 1); /* go to sibling if there is one */ if (ptr->sibling) (void) node_enum(el, ptr->sibling, cnt); return (0); } /* key_kprint(): * Print the specified key and its associated * function specified by val */ protected void key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype) { el_bindings_t *fp; char unparsbuf[EL_BUFSIZ]; static const char fmt[] = "%-15s-> %s\n"; if (val != NULL) switch (ntype) { case XK_STR: case XK_EXE: (void) fprintf(el->el_outfile, fmt, key, key__decode_str(val->str, unparsbuf, ntype == XK_STR ? "\"\"" : "[]")); break; case XK_CMD: for (fp = el->el_map.help; fp->name; fp++) if (val->cmd == fp->func) { (void) fprintf(el->el_outfile, fmt, key, fp->name); break; } #ifdef DEBUG_KEY if (fp->name == NULL) (void) fprintf(el->el_outfile, "BUG! Command not found.\n"); #endif break; default: EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype)); break; } else (void) fprintf(el->el_outfile, fmt, key, "no input"); } /* key__decode_char(): * Put a printable form of char in buf. */ private int key__decode_char(char *buf, int cnt, int ch) { if (ch == 0) { buf[cnt++] = '^'; buf[cnt] = '@'; return (cnt); } if (iscntrl(ch)) { buf[cnt++] = '^'; if (ch == '\177') buf[cnt] = '?'; else buf[cnt] = ch | 0100; } else if (ch == '^') { buf[cnt++] = '\\'; buf[cnt] = '^'; } else if (ch == '\\') { buf[cnt++] = '\\'; buf[cnt] = '\\'; } else if (ch == ' ' || (isprint(ch) && !isspace(ch))) { buf[cnt] = ch; } else { buf[cnt++] = '\\'; buf[cnt++] = (((unsigned int) ch >> 6) & 7) + '0'; buf[cnt++] = (((unsigned int) ch >> 3) & 7) + '0'; buf[cnt] = (ch & 7) + '0'; } return (cnt); } /* key__decode_str(): * Make a printable version of the ey */ protected char * key__decode_str(const char *str, char *buf, const char *sep) { char *b; const char *p; b = buf; if (sep[0] != '\0') *b++ = sep[0]; if (*str == 0) { *b++ = '^'; *b++ = '@'; if (sep[0] != '\0' && sep[1] != '\0') *b++ = sep[1]; *b++ = 0; return (buf); } for (p = str; *p != 0; p++) { if (iscntrl((unsigned char) *p)) { *b++ = '^'; if (*p == '\177') *b++ = '?'; else *b++ = *p | 0100; } else if (*p == '^' || *p == '\\') { *b++ = '\\'; *b++ = *p; } else if (*p == ' ' || (isprint((unsigned char) *p) && !isspace((unsigned char) *p))) { *b++ = *p; } else { *b++ = '\\'; *b++ = (((unsigned int) *p >> 6) & 7) + '0'; *b++ = (((unsigned int) *p >> 3) & 7) + '0'; *b++ = (*p & 7) + '0'; } } if (sep[0] != '\0' && sep[1] != '\0') *b++ = sep[1]; *b++ = 0; return (buf); /* should check for overflow */ } openipmi-2.0.18/libedit/el.h0000644000175000017500000001126310373140634014567 0ustar chuckchuck/* $NetBSD: el.h,v 1.16 2003/10/18 23:48:42 christos Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)el.h 8.1 (Berkeley) 6/4/93 */ /* * el.h: Internal structures. */ #ifndef _h_el #define _h_el /* * Local defaults */ #define KSHVI #define VIDEFAULT #define ANCHOR #include #include #define EL_BUFSIZ 1024 /* Maximum line size */ #define HANDLE_SIGNALS 0x01 #define NO_TTY 0x02 #define EDIT_DISABLED 0x04 #define UNBUFFERED 0x08 typedef int bool_t; /* True or not */ typedef unsigned char el_action_t; /* Index to command array */ typedef struct coord_t { /* Position on the screen */ int h; int v; } coord_t; typedef struct el_line_t { char *buffer; /* Input line */ char *cursor; /* Cursor position */ char *lastchar; /* Last character */ const char *limit; /* Max position */ } el_line_t; /* * Editor state */ typedef struct el_state_t { int inputmode; /* What mode are we in? */ int doingarg; /* Are we getting an argument? */ int argument; /* Numeric argument */ int metanext; /* Is the next char a meta char */ el_action_t lastcmd; /* Previous command */ el_action_t thiscmd; /* this command */ char thisch; /* char that generated it */ } el_state_t; /* * Until we come up with something better... */ #define el_strdup(a) strdup(a) #define el_malloc(a) malloc(a) #define el_realloc(a,b) realloc(a, b) #define el_free(a) free(a) #include "tty.h" #include "prompt.h" #include "key.h" #include "el_term.h" #include "refresh.h" #include "chared.h" #include "common.h" #include "search.h" #include "hist.h" #include "map.h" #include "parse.h" #include "sig.h" #include "help.h" #include "read.h" struct editline { char *el_prog; /* the program name */ FILE *el_outfile; /* Stdio stuff */ FILE *el_errfile; /* Stdio stuff */ int el_infd; /* Input file descriptor */ int el_flags; /* Various flags. */ coord_t el_cursor; /* Cursor location */ char **el_display; /* Real screen image = what is there */ char **el_vdisplay; /* Virtual screen image = what we see */ void *el_data; /* Client data */ el_line_t el_line; /* The current line information */ el_state_t el_state; /* Current editor state */ el_term_t el_term; /* Terminal dependent stuff */ el_tty_t el_tty; /* Tty dependent stuff */ el_refresh_t el_refresh; /* Refresh stuff */ el_prompt_t el_prompt; /* Prompt stuff */ el_prompt_t el_rprompt; /* Prompt stuff */ el_chared_t el_chared; /* Characted editor stuff */ el_map_t el_map; /* Key mapping stuff */ el_key_t el_key; /* Key binding stuff */ el_history_t el_history; /* History stuff */ el_search_t el_search; /* Search stuff */ el_signal_t el_signal; /* Signal handling stuff */ el_read_t el_read; /* Character reading stuff */ }; protected int el_editmode(EditLine *, int, const char **); #ifdef DEBUG #define EL_ABORT(a) do { \ fprintf(el->el_errfile, "%s, %d: ", \ __FILE__, __LINE__); \ fprintf a; \ abort(); \ } while( /*CONSTCOND*/0); #else #define EL_ABORT(a) abort() #endif #endif /* _h_el */ openipmi-2.0.18/libedit/tty.h0000644000175000017500000002560310373140634015012 0ustar chuckchuck/* $NetBSD: tty.h,v 1.11 2005/06/01 11:37:52 lukem Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Christos Zoulas of Cornell University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)tty.h 8.1 (Berkeley) 6/4/93 */ /* * el.tty.h: Local terminal header */ #ifndef _h_el_tty #define _h_el_tty #include "histedit.h" #include #include /* Define our own since everyone gets it wrong! */ #define CONTROL(A) ((A) & 037) /* * Aix compatible names */ # if defined(VWERSE) && !defined(VWERASE) # define VWERASE VWERSE # endif /* VWERSE && !VWERASE */ # if defined(VDISCRD) && !defined(VDISCARD) # define VDISCARD VDISCRD # endif /* VDISCRD && !VDISCARD */ # if defined(VFLUSHO) && !defined(VDISCARD) # define VDISCARD VFLUSHO # endif /* VFLUSHO && VDISCARD */ # if defined(VSTRT) && !defined(VSTART) # define VSTART VSTRT # endif /* VSTRT && ! VSTART */ # if defined(VSTAT) && !defined(VSTATUS) # define VSTATUS VSTAT # endif /* VSTAT && ! VSTATUS */ # ifndef ONLRET # define ONLRET 0 # endif /* ONLRET */ # ifndef TAB3 # ifdef OXTABS # define TAB3 OXTABS # else # define TAB3 0 # endif /* OXTABS */ # endif /* !TAB3 */ # if defined(OXTABS) && !defined(XTABS) # define XTABS OXTABS # endif /* OXTABS && !XTABS */ # ifndef ONLCR # define ONLCR 0 # endif /* ONLCR */ # ifndef IEXTEN # define IEXTEN 0 # endif /* IEXTEN */ # ifndef ECHOCTL # define ECHOCTL 0 # endif /* ECHOCTL */ # ifndef PARENB # define PARENB 0 # endif /* PARENB */ # ifndef EXTPROC # define EXTPROC 0 # endif /* EXTPROC */ # ifndef FLUSHO # define FLUSHO 0 # endif /* FLUSHO */ # if defined(VDISABLE) && !defined(_POSIX_VDISABLE) # define _POSIX_VDISABLE VDISABLE # endif /* VDISABLE && ! _POSIX_VDISABLE */ /* * Work around ISC's definition of IEXTEN which is * XCASE! */ # ifdef ISC # if defined(IEXTEN) && defined(XCASE) # if IEXTEN == XCASE # undef IEXTEN # define IEXTEN 0 # endif /* IEXTEN == XCASE */ # endif /* IEXTEN && XCASE */ # if defined(IEXTEN) && !defined(XCASE) # define XCASE IEXTEN # undef IEXTEN # define IEXTEN 0 # endif /* IEXTEN && !XCASE */ # endif /* ISC */ /* * Work around convex weirdness where turning off IEXTEN makes us * lose all postprocessing! */ #if defined(convex) || defined(__convex__) # if defined(IEXTEN) && IEXTEN != 0 # undef IEXTEN # define IEXTEN 0 # endif /* IEXTEN != 0 */ #endif /* convex || __convex__ */ /* * So that we don't lose job control. */ #ifdef __SVR4 # undef CSWTCH #endif #ifndef _POSIX_VDISABLE # define _POSIX_VDISABLE ((unsigned char) -1) #endif /* _POSIX_VDISABLE */ #if !defined(CREPRINT) && defined(CRPRNT) # define CREPRINT CRPRNT #endif /* !CREPRINT && CRPRNT */ #if !defined(CDISCARD) && defined(CFLUSH) # define CDISCARD CFLUSH #endif /* !CDISCARD && CFLUSH */ #ifndef CINTR # define CINTR CONTROL('c') #endif /* CINTR */ #ifndef CQUIT # define CQUIT 034 /* ^\ */ #endif /* CQUIT */ #ifndef CERASE # define CERASE 0177 /* ^? */ #endif /* CERASE */ #ifndef CKILL # define CKILL CONTROL('u') #endif /* CKILL */ #ifndef CEOF # define CEOF CONTROL('d') #endif /* CEOF */ #ifndef CEOL # define CEOL _POSIX_VDISABLE #endif /* CEOL */ #ifndef CEOL2 # define CEOL2 _POSIX_VDISABLE #endif /* CEOL2 */ #ifndef CSWTCH # define CSWTCH _POSIX_VDISABLE #endif /* CSWTCH */ #ifndef CDSWTCH # define CDSWTCH _POSIX_VDISABLE #endif /* CDSWTCH */ #ifndef CERASE2 # define CERASE2 _POSIX_VDISABLE #endif /* CERASE2 */ #ifndef CSTART # define CSTART CONTROL('q') #endif /* CSTART */ #ifndef CSTOP # define CSTOP CONTROL('s') #endif /* CSTOP */ #ifndef CSUSP # define CSUSP CONTROL('z') #endif /* CSUSP */ #ifndef CDSUSP # define CDSUSP CONTROL('y') #endif /* CDSUSP */ #ifdef hpux # ifndef CREPRINT # define CREPRINT _POSIX_VDISABLE # endif /* CREPRINT */ # ifndef CDISCARD # define CDISCARD _POSIX_VDISABLE # endif /* CDISCARD */ # ifndef CLNEXT # define CLNEXT _POSIX_VDISABLE # endif /* CLNEXT */ # ifndef CWERASE # define CWERASE _POSIX_VDISABLE # endif /* CWERASE */ #else /* !hpux */ # ifndef CREPRINT # define CREPRINT CONTROL('r') # endif /* CREPRINT */ # ifndef CDISCARD # define CDISCARD CONTROL('o') # endif /* CDISCARD */ # ifndef CLNEXT # define CLNEXT CONTROL('v') # endif /* CLNEXT */ # ifndef CWERASE # define CWERASE CONTROL('w') # endif /* CWERASE */ #endif /* hpux */ #ifndef CSTATUS # define CSTATUS CONTROL('t') #endif /* CSTATUS */ #ifndef CPAGE # define CPAGE ' ' #endif /* CPAGE */ #ifndef CPGOFF # define CPGOFF CONTROL('m') #endif /* CPGOFF */ #ifndef CKILL2 # define CKILL2 _POSIX_VDISABLE #endif /* CKILL2 */ #ifndef CBRK # ifndef masscomp # define CBRK 0377 # else # define CBRK '\0' # endif /* masscomp */ #endif /* CBRK */ #ifndef CMIN # define CMIN CEOF #endif /* CMIN */ #ifndef CTIME # define CTIME CEOL #endif /* CTIME */ /* * Fix for sun inconsistency. On termio VSUSP and the rest of the * ttychars > NCC are defined. So we undefine them. */ #if defined(TERMIO) || defined(POSIX) # if defined(POSIX) && defined(NCCS) # define NUMCC NCCS # else # ifdef NCC # define NUMCC NCC # endif /* NCC */ # endif /* POSIX && NCCS */ # ifdef NUMCC # ifdef VINTR # if NUMCC <= VINTR # undef VINTR # endif /* NUMCC <= VINTR */ # endif /* VINTR */ # ifdef VQUIT # if NUMCC <= VQUIT # undef VQUIT # endif /* NUMCC <= VQUIT */ # endif /* VQUIT */ # ifdef VERASE # if NUMCC <= VERASE # undef VERASE # endif /* NUMCC <= VERASE */ # endif /* VERASE */ # ifdef VKILL # if NUMCC <= VKILL # undef VKILL # endif /* NUMCC <= VKILL */ # endif /* VKILL */ # ifdef VEOF # if NUMCC <= VEOF # undef VEOF # endif /* NUMCC <= VEOF */ # endif /* VEOF */ # ifdef VEOL # if NUMCC <= VEOL # undef VEOL # endif /* NUMCC <= VEOL */ # endif /* VEOL */ # ifdef VEOL2 # if NUMCC <= VEOL2 # undef VEOL2 # endif /* NUMCC <= VEOL2 */ # endif /* VEOL2 */ # ifdef VSWTCH # if NUMCC <= VSWTCH # undef VSWTCH # endif /* NUMCC <= VSWTCH */ # endif /* VSWTCH */ # ifdef VDSWTCH # if NUMCC <= VDSWTCH # undef VDSWTCH # endif /* NUMCC <= VDSWTCH */ # endif /* VDSWTCH */ # ifdef VERASE2 # if NUMCC <= VERASE2 # undef VERASE2 # endif /* NUMCC <= VERASE2 */ # endif /* VERASE2 */ # ifdef VSTART # if NUMCC <= VSTART # undef VSTART # endif /* NUMCC <= VSTART */ # endif /* VSTART */ # ifdef VSTOP # if NUMCC <= VSTOP # undef VSTOP # endif /* NUMCC <= VSTOP */ # endif /* VSTOP */ # ifdef VWERASE # if NUMCC <= VWERASE # undef VWERASE # endif /* NUMCC <= VWERASE */ # endif /* VWERASE */ # ifdef VSUSP # if NUMCC <= VSUSP # undef VSUSP # endif /* NUMCC <= VSUSP */ # endif /* VSUSP */ # ifdef VDSUSP # if NUMCC <= VDSUSP # undef VDSUSP # endif /* NUMCC <= VDSUSP */ # endif /* VDSUSP */ # ifdef VREPRINT # if NUMCC <= VREPRINT # undef VREPRINT # endif /* NUMCC <= VREPRINT */ # endif /* VREPRINT */ # ifdef VDISCARD # if NUMCC <= VDISCARD # undef VDISCARD # endif /* NUMCC <= VDISCARD */ # endif /* VDISCARD */ # ifdef VLNEXT # if NUMCC <= VLNEXT # undef VLNEXT # endif /* NUMCC <= VLNEXT */ # endif /* VLNEXT */ # ifdef VSTATUS # if NUMCC <= VSTATUS # undef VSTATUS # endif /* NUMCC <= VSTATUS */ # endif /* VSTATUS */ # ifdef VPAGE # if NUMCC <= VPAGE # undef VPAGE # endif /* NUMCC <= VPAGE */ # endif /* VPAGE */ # ifdef VPGOFF # if NUMCC <= VPGOFF # undef VPGOFF # endif /* NUMCC <= VPGOFF */ # endif /* VPGOFF */ # ifdef VKILL2 # if NUMCC <= VKILL2 # undef VKILL2 # endif /* NUMCC <= VKILL2 */ # endif /* VKILL2 */ # ifdef VBRK # if NUMCC <= VBRK # undef VBRK # endif /* NUMCC <= VBRK */ # endif /* VBRK */ # ifdef VMIN # if NUMCC <= VMIN # undef VMIN # endif /* NUMCC <= VMIN */ # endif /* VMIN */ # ifdef VTIME # if NUMCC <= VTIME # undef VTIME # endif /* NUMCC <= VTIME */ # endif /* VTIME */ # endif /* NUMCC */ #endif /* !POSIX */ #define C_INTR 0 #define C_QUIT 1 #define C_ERASE 2 #define C_KILL 3 #define C_EOF 4 #define C_EOL 5 #define C_EOL2 6 #define C_SWTCH 7 #define C_DSWTCH 8 #define C_ERASE2 9 #define C_START 10 #define C_STOP 11 #define C_WERASE 12 #define C_SUSP 13 #define C_DSUSP 14 #define C_REPRINT 15 #define C_DISCARD 16 #define C_LNEXT 17 #define C_STATUS 18 #define C_PAGE 19 #define C_PGOFF 20 #define C_KILL2 21 #define C_BRK 22 #define C_MIN 23 #define C_TIME 24 #define C_NCC 25 #define C_SH(A) (1 << (A)) /* * Terminal dependend data structures */ #define EX_IO 0 /* while we are executing */ #define ED_IO 1 /* while we are editing */ #define TS_IO 2 /* new mode from terminal */ #define QU_IO 2 /* used only for quoted chars */ #define NN_IO 3 /* The number of entries */ #define MD_INP 0 #define MD_OUT 1 #define MD_CTL 2 #define MD_LIN 3 #define MD_CHAR 4 #define MD_NN 5 typedef struct { const char *t_name; unsigned int t_setmask; unsigned int t_clrmask; } ttyperm_t[NN_IO][MD_NN]; typedef unsigned char ttychar_t[NN_IO][C_NCC]; protected int tty_init(EditLine *); protected void tty_end(EditLine *); protected int tty_stty(EditLine *, int, const char **); protected int tty_rawmode(EditLine *); protected int tty_cookedmode(EditLine *); protected int tty_quotemode(EditLine *); protected int tty_noquotemode(EditLine *); protected void tty_bind_char(EditLine *, int); typedef struct { ttyperm_t t_t; ttychar_t t_c; struct termios t_ex, t_ed, t_ts; int t_tabs; int t_eight; speed_t t_speed; int t_mode; unsigned char t_vdisable; } el_tty_t; #endif /* _h_el_tty */ openipmi-2.0.18/libedit/readline.c0000644000175000017500000010730410373140634015747 0ustar chuckchuck/* $NetBSD: readline.c,v 1.58 2005/07/14 15:00:58 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Jaromir Dolecek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* AIX requires this to be the first thing in the file. */ #if defined (_AIX) && !defined (__GNUC__) #pragma alloca #endif #include "sys.h" #ifdef __GNUC__ # undef alloca # define alloca(n) __builtin_alloca (n) #else # ifdef HAVE_ALLOCA_H # include # else # ifndef _AIX extern char *alloca (); # endif # endif #endif #if !defined(lint) && !defined(SCCSID) __RCSID("$NetBSD: readline.c,v 1.58 2005/07/14 15:00:58 christos Exp $"); #endif /* not lint && not SCCSID */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "el.h" #include "fcns.h" /* for EL_NUM_FCNS */ #include "histedit.h" #include "editline/readline.h" #include "filecomplete.h" /* for rl_complete() */ #define TAB '\r' /* see comment at the #ifdef for sense of this */ /* #define GDB_411_HACK */ /* readline compatibility stuff - look at readline sources/documentation */ /* to see what these variables mean */ const char *rl_library_version = "EditLine wrapper"; static char empty[] = { '\0' }; static char expand_chars[] = { ' ', '\t', '\n', '=', '(', '\0' }; static char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', '$', '>', '<', '=', ';', '|', '&', '{', '(', '\0' }; char *rl_readline_name = empty; FILE *rl_instream = NULL; FILE *rl_outstream = NULL; int rl_point = 0; int rl_end = 0; char *rl_line_buffer = NULL; VCPFunction *rl_linefunc = NULL; int rl_done = 0; VFunction *rl_event_hook = NULL; int history_base = 1; /* probably never subject to change */ int history_length = 0; int max_input_history = 0; char history_expansion_char = '!'; char history_subst_char = '^'; char *history_no_expand_chars = expand_chars; Function *history_inhibit_expansion_function = NULL; char *history_arg_extract(int start, int end, const char *str); int rl_inhibit_completion = 0; int rl_attempted_completion_over = 0; char *rl_basic_word_break_characters = break_chars; char *rl_completer_word_break_characters = NULL; char *rl_completer_quote_characters = NULL; Function *rl_completion_entry_function = NULL; CPPFunction *rl_attempted_completion_function = NULL; Function *rl_pre_input_hook = NULL; Function *rl_startup1_hook = NULL; Function *rl_getc_function = NULL; char *rl_terminal_name = NULL; int rl_already_prompted = 0; int rl_filename_completion_desired = 0; int rl_ignore_completion_duplicates = 0; int rl_catch_signals = 1; VFunction *rl_redisplay_function = NULL; Function *rl_startup_hook = NULL; VFunction *rl_completion_display_matches_hook = NULL; VFunction *rl_prep_term_function = NULL; VFunction *rl_deprep_term_function = NULL; /* * The current prompt string. */ char *rl_prompt = NULL; /* * This is set to character indicating type of completion being done by * rl_complete_internal(); this is available for application completion * functions. */ int rl_completion_type = 0; /* * If more than this number of items results from query for possible * completions, we ask user if they are sure to really display the list. */ int rl_completion_query_items = 100; /* * List of characters which are word break characters, but should be left * in the parsed text when it is passed to the completion function. * Shell uses this to help determine what kind of completing to do. */ char *rl_special_prefixes = NULL; /* * This is the character appended to the completed words if at the end of * the line. Default is ' ' (a space). */ int rl_completion_append_character = ' '; /* stuff below is used internally by libedit for readline emulation */ static History *h = NULL; static EditLine *e = NULL; static Function *map[256]; /* internal functions */ static unsigned char _el_rl_complete(EditLine *, int); static unsigned char _el_rl_tstp(EditLine *, int); static char *_get_prompt(EditLine *); static HIST_ENTRY *_move_history(int); static int _history_expand_command(const char *, size_t, size_t, char **); static char *_rl_compat_sub(const char *, const char *, const char *, int); static int _rl_event_read_char(EditLine *, char *); static void _rl_update_pos(void); /* ARGSUSED */ static char * _get_prompt(EditLine *el __attribute__((__unused__))) { rl_already_prompted = 1; return (rl_prompt); } /* * generic function for moving around history */ static HIST_ENTRY * _move_history(int op) { HistEvent ev; static HIST_ENTRY rl_he; if (history(h, &ev, op) != 0) return (HIST_ENTRY *) NULL; rl_he.line = ev.str; rl_he.data = (histdata_t) &(ev.num); return (&rl_he); } /* * READLINE compatibility stuff */ /* * initialize rl compat stuff */ int rl_initialize(void) { HistEvent ev; const LineInfo *li; int editmode = 1; struct termios t; if (e != NULL) el_end(e); if (h != NULL) history_end(h); if (!rl_instream) rl_instream = stdin; if (!rl_outstream) rl_outstream = stdout; /* * See if we don't really want to run the editor */ if (tcgetattr(fileno(rl_instream), &t) != -1 && (t.c_lflag & ECHO) == 0) editmode = 0; e = el_init(rl_readline_name, rl_instream, rl_outstream, stderr); if (!editmode) el_set(e, EL_EDITMODE, 0); h = history_init(); if (!e || !h) return (-1); history(h, &ev, H_SETSIZE, INT_MAX); /* unlimited */ history_length = 0; max_input_history = INT_MAX; el_set(e, EL_HIST, history, h); /* for proper prompt printing in readline() */ rl_prompt = strdup(""); if (rl_prompt == NULL) { history_end(h); el_end(e); return -1; } el_set(e, EL_PROMPT, _get_prompt); el_set(e, EL_SIGNAL, rl_catch_signals); /* set default mode to "emacs"-style and read setting afterwards */ /* so this can be overriden */ el_set(e, EL_EDITOR, "emacs"); if (rl_terminal_name != NULL) el_set(e, EL_TERMINAL, rl_terminal_name); else el_get(e, EL_TERMINAL, &rl_terminal_name); /* * Word completion - this has to go AFTER rebinding keys * to emacs-style. */ el_set(e, EL_ADDFN, "rl_complete", "ReadLine compatible completion function", _el_rl_complete); el_set(e, EL_BIND, "^I", "rl_complete", NULL); /* * Send TSTP when ^Z is pressed. */ el_set(e, EL_ADDFN, "rl_tstp", "ReadLine compatible suspend function", _el_rl_tstp); el_set(e, EL_BIND, "^Z", "rl_tstp", NULL); /* read settings from configuration file */ el_source(e, NULL); /* * Unfortunately, some applications really do use rl_point * and rl_line_buffer directly. */ li = el_line(e); /* a cheesy way to get rid of const cast. */ rl_line_buffer = memchr(li->buffer, *li->buffer, 1); _rl_update_pos(); if (rl_startup_hook) (*rl_startup_hook)(NULL, 0); return (0); } /* * read one line from input stream and return it, chomping * trailing newline (if there is any) */ char * readline(const char *prompt) { HistEvent ev; int count; const char *ret; char *buf; static int used_event_hook; if (e == NULL || h == NULL) rl_initialize(); rl_done = 0; /* update prompt accordingly to what has been passed */ if (!prompt) prompt = ""; if (strcmp(rl_prompt, prompt) != 0) { free(rl_prompt); rl_prompt = strdup(prompt); if (rl_prompt == NULL) return NULL; } if (rl_pre_input_hook) (*rl_pre_input_hook)(NULL, 0); if (rl_event_hook && !(e->el_flags&NO_TTY)) { el_set(e, EL_GETCFN, _rl_event_read_char); used_event_hook = 1; } if (!rl_event_hook && used_event_hook) { el_set(e, EL_GETCFN, EL_BUILTIN_GETCFN); used_event_hook = 0; } rl_already_prompted = 0; /* get one line from input stream */ ret = el_gets(e, &count); if (ret && count > 0) { int lastidx; buf = strdup(ret); if (buf == NULL) return NULL; lastidx = count - 1; if (buf[lastidx] == '\n') buf[lastidx] = '\0'; } else buf = NULL; history(h, &ev, H_GETSIZE); history_length = ev.num; return buf; } /* * history functions */ /* * is normally called before application starts to use * history expansion functions */ void using_history(void) { if (h == NULL || e == NULL) rl_initialize(); } /* * substitute ``what'' with ``with'', returning resulting string; if * globally == 1, substitutes all occurrences of what, otherwise only the * first one */ static char * _rl_compat_sub(const char *str, const char *what, const char *with, int globally) { const char *s; char *r, *result; size_t len, with_len, what_len; len = strlen(str); with_len = strlen(with); what_len = strlen(what); /* calculate length we need for result */ s = str; while (*s) { if (*s == *what && !strncmp(s, what, what_len)) { len += with_len - what_len; if (!globally) break; s += what_len; } else s++; } r = result = malloc(len + 1); if (result == NULL) return NULL; s = str; while (*s) { if (*s == *what && !strncmp(s, what, what_len)) { (void)strncpy(r, with, with_len); r += with_len; s += what_len; if (!globally) { (void)strcpy(r, s); return(result); } } else *r++ = *s++; } *r = 0; return(result); } static char *last_search_pat; /* last !?pat[?] search pattern */ static char *last_search_match; /* last !?pat[?] that matched */ const char * get_history_event(const char *cmd, int *cindex, int qchar) { int idx, sign, sub, num, begin, ret; size_t len; char *pat; const char *rptr; HistEvent ev; idx = *cindex; if (cmd[idx++] != history_expansion_char) return(NULL); /* find out which event to take */ if (cmd[idx] == history_expansion_char || cmd[idx] == 0) { if (history(h, &ev, H_FIRST) != 0) return(NULL); *cindex = cmd[idx]? (idx + 1):idx; return(ev.str); } sign = 0; if (cmd[idx] == '-') { sign = 1; idx++; } if ('0' <= cmd[idx] && cmd[idx] <= '9') { HIST_ENTRY *rl_he; num = 0; while (cmd[idx] && '0' <= cmd[idx] && cmd[idx] <= '9') { num = num * 10 + cmd[idx] - '0'; idx++; } if (sign) num = history_length - num + 1; if (!(rl_he = history_get(num))) return(NULL); *cindex = idx; return(rl_he->line); } sub = 0; if (cmd[idx] == '?') { sub = 1; idx++; } begin = idx; while (cmd[idx]) { if (cmd[idx] == '\n') break; if (sub && cmd[idx] == '?') break; if (!sub && (cmd[idx] == ':' || cmd[idx] == ' ' || cmd[idx] == '\t' || cmd[idx] == qchar)) break; idx++; } len = idx - begin; if (sub && cmd[idx] == '?') idx++; if (sub && len == 0 && last_search_pat && *last_search_pat) pat = last_search_pat; else if (len == 0) return(NULL); else { if ((pat = malloc(len + 1)) == NULL) return NULL; (void)strncpy(pat, cmd + begin, len); pat[len] = '\0'; } if (history(h, &ev, H_CURR) != 0) { if (pat != last_search_pat) free(pat); return (NULL); } num = ev.num; if (sub) { if (pat != last_search_pat) { if (last_search_pat) free(last_search_pat); last_search_pat = pat; } ret = history_search(pat, -1); } else ret = history_search_prefix(pat, -1); if (ret == -1) { /* restore to end of list on failed search */ history(h, &ev, H_FIRST); (void)fprintf(rl_outstream, "%s: Event not found\n", pat); if (pat != last_search_pat) free(pat); return(NULL); } if (sub && len) { if (last_search_match && last_search_match != pat) free(last_search_match); last_search_match = pat; } if (pat != last_search_pat) free(pat); if (history(h, &ev, H_CURR) != 0) return(NULL); *cindex = idx; rptr = ev.str; /* roll back to original position */ (void)history(h, &ev, H_SET, num); return rptr; } /* * the real function doing history expansion - takes as argument command * to do and data upon which the command should be executed * does expansion the way I've understood readline documentation * * returns 0 if data was not modified, 1 if it was and 2 if the string * should be only printed and not executed; in case of error, * returns -1 and *result points to NULL * it's callers responsibility to free() string returned in *result */ static int _history_expand_command(const char *command, size_t offs, size_t cmdlen, char **result) { char *tmp, *search = NULL, *aptr; const char *ptr, *cmd; static char *from = NULL, *to = NULL; int start, end, idx, has_mods = 0; int p_on = 0, g_on = 0; *result = NULL; aptr = NULL; ptr = NULL; /* First get event specifier */ idx = 0; if (strchr(":^*$", command[offs + 1])) { char str[4]; /* * "!:" is shorthand for "!!:". * "!^", "!*" and "!$" are shorthand for * "!!:^", "!!:*" and "!!:$" respectively. */ str[0] = str[1] = '!'; str[2] = '0'; ptr = get_history_event(str, &idx, 0); idx = (command[offs + 1] == ':')? 1:0; has_mods = 1; } else { if (command[offs + 1] == '#') { /* use command so far */ if ((aptr = malloc(offs + 1)) == NULL) return -1; (void)strncpy(aptr, command, offs); aptr[offs] = '\0'; idx = 1; } else { int qchar; qchar = (offs > 0 && command[offs - 1] == '"')? '"':0; ptr = get_history_event(command + offs, &idx, qchar); } has_mods = command[offs + idx] == ':'; } if (ptr == NULL && aptr == NULL) return(-1); if (!has_mods) { *result = strdup(aptr? aptr : ptr); if (aptr) free(aptr); return(1); } cmd = command + offs + idx + 1; /* Now parse any word designators */ if (*cmd == '%') /* last word matched by ?pat? */ tmp = strdup(last_search_match? last_search_match:""); else if (strchr("^*$-0123456789", *cmd)) { start = end = -1; if (*cmd == '^') start = end = 1, cmd++; else if (*cmd == '$') start = -1, cmd++; else if (*cmd == '*') start = 1, cmd++; else if (*cmd == '-' || isdigit((unsigned char) *cmd)) { start = 0; while (*cmd && '0' <= *cmd && *cmd <= '9') start = start * 10 + *cmd++ - '0'; if (*cmd == '-') { if (isdigit((unsigned char) cmd[1])) { cmd++; end = 0; while (*cmd && '0' <= *cmd && *cmd <= '9') end = end * 10 + *cmd++ - '0'; } else if (cmd[1] == '$') { cmd += 2; end = -1; } else { cmd++; end = -2; } } else if (*cmd == '*') end = -1, cmd++; else end = start; } tmp = history_arg_extract(start, end, aptr? aptr:ptr); if (tmp == NULL) { (void)fprintf(rl_outstream, "%s: Bad word specifier", command + offs + idx); if (aptr) free(aptr); return(-1); } } else tmp = strdup(aptr? aptr:ptr); if (aptr) free(aptr); if (*cmd == 0 || (cmd - (command + offs) >= cmdlen)) { *result = tmp; return(1); } for (; *cmd; cmd++) { if (*cmd == ':') continue; else if (*cmd == 'h') { /* remove trailing path */ if ((aptr = strrchr(tmp, '/')) != NULL) *aptr = 0; } else if (*cmd == 't') { /* remove leading path */ if ((aptr = strrchr(tmp, '/')) != NULL) { aptr = strdup(aptr + 1); free(tmp); tmp = aptr; } } else if (*cmd == 'r') { /* remove trailing suffix */ if ((aptr = strrchr(tmp, '.')) != NULL) *aptr = 0; } else if (*cmd == 'e') { /* remove all but suffix */ if ((aptr = strrchr(tmp, '.')) != NULL) { aptr = strdup(aptr); free(tmp); tmp = aptr; } } else if (*cmd == 'p') /* print only */ p_on = 1; else if (*cmd == 'g') g_on = 2; else if (*cmd == 's' || *cmd == '&') { char *what, *with, delim; size_t len, from_len; size_t size; if (*cmd == '&' && (from == NULL || to == NULL)) continue; else if (*cmd == 's') { delim = *(++cmd), cmd++; size = 16; what = realloc(from, size); if (what == NULL) { free(from); return 0; } len = 0; for (; *cmd && *cmd != delim; cmd++) { if (*cmd == '\\' && cmd[1] == delim) cmd++; if (len >= size) { char *nwhat; nwhat = realloc(what, (size <<= 1)); if (nwhat == NULL) { free(what); return 0; } what = nwhat; } what[len++] = *cmd; } what[len] = '\0'; from = what; if (*what == '\0') { free(what); if (search) { from = strdup(search); if (from == NULL) return 0; } else { from = NULL; return (-1); } } cmd++; /* shift after delim */ if (!*cmd) continue; size = 16; with = realloc(to, size); if (with == NULL) { free(to); return -1; } len = 0; from_len = strlen(from); for (; *cmd && *cmd != delim; cmd++) { if (len + from_len + 1 >= size) { char *nwith; size += from_len + 1; nwith = realloc(with, size); if (nwith == NULL) { free(with); return -1; } with = nwith; } if (*cmd == '&') { /* safe */ (void)strcpy(&with[len], from); len += from_len; continue; } if (*cmd == '\\' && (*(cmd + 1) == delim || *(cmd + 1) == '&')) cmd++; with[len++] = *cmd; } with[len] = '\0'; to = with; } aptr = _rl_compat_sub(tmp, from, to, g_on); if (aptr) { free(tmp); tmp = aptr; } g_on = 0; } } *result = tmp; return (p_on? 2:1); } /* * csh-style history expansion */ int history_expand(char *str, char **output) { int ret = 0; size_t idx, i, size; char *tmp, *result; if (h == NULL || e == NULL) rl_initialize(); if (history_expansion_char == 0) { *output = strdup(str); return(0); } *output = NULL; if (str[0] == history_subst_char) { /* ^foo^foo2^ is equivalent to !!:s^foo^foo2^ */ *output = malloc(strlen(str) + 4 + 1); if (*output == NULL) return 0; (*output)[0] = (*output)[1] = history_expansion_char; (*output)[2] = ':'; (*output)[3] = 's'; (void)strcpy((*output) + 4, str); str = *output; } else { *output = strdup(str); if (*output == NULL) return 0; } #define ADD_STRING(what, len) \ { \ if (idx + len + 1 > size) { \ char *nresult = realloc(result, (size += len + 1));\ if (nresult == NULL) { \ free(*output); \ return 0; \ } \ result = nresult; \ } \ (void)strncpy(&result[idx], what, len); \ idx += len; \ result[idx] = '\0'; \ } result = NULL; size = idx = 0; for (i = 0; str[i];) { int qchar, loop_again; size_t len, start, j; qchar = 0; loop_again = 1; start = j = i; loop: for (; str[j]; j++) { if (str[j] == '\\' && str[j + 1] == history_expansion_char) { (void)strcpy(&str[j], &str[j + 1]); continue; } if (!loop_again) { if (isspace((unsigned char) str[j]) || str[j] == qchar) break; } if (str[j] == history_expansion_char && !strchr(history_no_expand_chars, str[j + 1]) && (!history_inhibit_expansion_function || (*history_inhibit_expansion_function)(str, (int)j) == 0)) break; } if (str[j] && loop_again) { i = j; qchar = (j > 0 && str[j - 1] == '"' )? '"':0; j++; if (str[j] == history_expansion_char) j++; loop_again = 0; goto loop; } len = i - start; tmp = &str[start]; ADD_STRING(tmp, len); if (str[i] == '\0' || str[i] != history_expansion_char) { len = j - i; tmp = &str[i]; ADD_STRING(tmp, len); if (start == 0) ret = 0; else ret = 1; break; } ret = _history_expand_command (str, i, (j - i), &tmp); if (ret > 0 && tmp) { len = strlen(tmp); ADD_STRING(tmp, len); free(tmp); } i = j; } /* ret is 2 for "print only" option */ if (ret == 2) { add_history(result); #ifdef GDB_411_HACK /* gdb 4.11 has been shipped with readline, where */ /* history_expand() returned -1 when the line */ /* should not be executed; in readline 2.1+ */ /* it should return 2 in such a case */ ret = -1; #endif } free(*output); *output = result; return (ret); } /* * Return a string consisting of arguments of "str" from "start" to "end". */ char * history_arg_extract(int start, int end, const char *str) { size_t i, len, max; char **arr, *result; arr = history_tokenize(str); if (!arr) return(NULL); if (arr && *arr == NULL) { free(arr); return(NULL); } for (max = 0; arr[max]; max++) continue; max--; if (start == '$') start = max; if (end == '$') end = max; if (end < 0) end = max + end + 1; if (start < 0) start = end; if (start < 0 || end < 0 || start > max || end > max || start > end) return(NULL); for (i = start, len = 0; i <= end; i++) len += strlen(arr[i]) + 1; len++; result = malloc(len); if (result == NULL) return NULL; for (i = start, len = 0; i <= end; i++) { (void)strcpy(result + len, arr[i]); len += strlen(arr[i]); if (i < end) result[len++] = ' '; } result[len] = 0; for (i = 0; arr[i]; i++) free(arr[i]); free(arr); return(result); } /* * Parse the string into individual tokens, * similar to how shell would do it. */ char ** history_tokenize(const char *str) { int size = 1, idx = 0, i, start; size_t len; char **result = NULL, *temp, delim = '\0'; for (i = 0; str[i];) { while (isspace((unsigned char) str[i])) i++; start = i; for (; str[i];) { if (str[i] == '\\') { if (str[i+1] != '\0') i++; } else if (str[i] == delim) delim = '\0'; else if (!delim && (isspace((unsigned char) str[i]) || strchr("()<>;&|$", str[i]))) break; else if (!delim && strchr("'`\"", str[i])) delim = str[i]; if (str[i]) i++; } if (idx + 2 >= size) { char **nresult; size <<= 1; nresult = realloc(result, size * sizeof(char *)); if (nresult == NULL) { free(result); return NULL; } result = nresult; } len = i - start; temp = malloc(len + 1); if (temp == NULL) { for (i = 0; i < idx; i++) free(result[i]); free(result); return NULL; } (void)strncpy(temp, &str[start], len); temp[len] = '\0'; result[idx++] = temp; result[idx] = NULL; if (str[i]) i++; } return (result); } /* * limit size of history record to ``max'' events */ void stifle_history(int max) { HistEvent ev; if (h == NULL || e == NULL) rl_initialize(); if (history(h, &ev, H_SETSIZE, max) == 0) max_input_history = max; } /* * "unlimit" size of history - set the limit to maximum allowed int value */ int unstifle_history(void) { HistEvent ev; int omax; history(h, &ev, H_SETSIZE, INT_MAX); omax = max_input_history; max_input_history = INT_MAX; return (omax); /* some value _must_ be returned */ } int history_is_stifled(void) { /* cannot return true answer */ return (max_input_history != INT_MAX); } /* * read history from a file given */ int read_history(const char *filename) { HistEvent ev; if (h == NULL || e == NULL) rl_initialize(); return (history(h, &ev, H_LOAD, filename)); } /* * write history to a file given */ int write_history(const char *filename) { HistEvent ev; if (h == NULL || e == NULL) rl_initialize(); return (history(h, &ev, H_SAVE, filename)); } /* * returns history ``num''th event * * returned pointer points to static variable */ HIST_ENTRY * history_get(int num) { static HIST_ENTRY she; HistEvent ev; int curr_num; if (h == NULL || e == NULL) rl_initialize(); /* save current position */ if (history(h, &ev, H_CURR) != 0) return (NULL); curr_num = ev.num; /* start from most recent */ if (history(h, &ev, H_FIRST) != 0) return (NULL); /* error */ /* look backwards for event matching specified offset */ if (history(h, &ev, H_NEXT_EVENT, num)) return (NULL); she.line = ev.str; she.data = NULL; /* restore pointer to where it was */ (void)history(h, &ev, H_SET, curr_num); return (&she); } /* * add the line to history table */ int add_history(const char *line) { HistEvent ev; if (h == NULL || e == NULL) rl_initialize(); (void)history(h, &ev, H_ENTER, line); if (history(h, &ev, H_GETSIZE) == 0) history_length = ev.num; return (!(history_length > 0)); /* return 0 if all is okay */ } /* * remove the specified entry from the history list and return it. */ HIST_ENTRY * remove_history(int num) { static HIST_ENTRY she; HistEvent ev; if (h == NULL || e == NULL) rl_initialize(); if (history(h, &ev, H_DEL, num) != 0) return NULL; she.line = ev.str; she.data = NULL; return &she; } /* * clear the history list - delete all entries */ void clear_history(void) { HistEvent ev; history(h, &ev, H_CLEAR); } /* * returns offset of the current history event */ int where_history(void) { HistEvent ev; int curr_num, off; if (history(h, &ev, H_CURR) != 0) return (0); curr_num = ev.num; history(h, &ev, H_FIRST); off = 1; while (ev.num != curr_num && history(h, &ev, H_NEXT) == 0) off++; return (off); } /* * returns current history event or NULL if there is no such event */ HIST_ENTRY * current_history(void) { return (_move_history(H_CURR)); } /* * returns total number of bytes history events' data are using */ int history_total_bytes(void) { HistEvent ev; int curr_num, size; if (history(h, &ev, H_CURR) != 0) return (-1); curr_num = ev.num; history(h, &ev, H_FIRST); size = 0; do size += strlen(ev.str); while (history(h, &ev, H_NEXT) == 0); /* get to the same position as before */ history(h, &ev, H_PREV_EVENT, curr_num); return (size); } /* * sets the position in the history list to ``pos'' */ int history_set_pos(int pos) { HistEvent ev; int curr_num; if (pos > history_length || pos < 0) return (-1); history(h, &ev, H_CURR); curr_num = ev.num; if (history(h, &ev, H_SET, pos)) { history(h, &ev, H_SET, curr_num); return(-1); } return (0); } /* * returns previous event in history and shifts pointer accordingly */ HIST_ENTRY * previous_history(void) { return (_move_history(H_PREV)); } /* * returns next event in history and shifts pointer accordingly */ HIST_ENTRY * next_history(void) { return (_move_history(H_NEXT)); } /* * searches for first history event containing the str */ int history_search(const char *str, int direction) { HistEvent ev; const char *strp; int curr_num; if (history(h, &ev, H_CURR) != 0) return (-1); curr_num = ev.num; for (;;) { if ((strp = strstr(ev.str, str)) != NULL) return (int) (strp - ev.str); if (history(h, &ev, direction < 0 ? H_NEXT:H_PREV) != 0) break; } history(h, &ev, H_SET, curr_num); return (-1); } /* * searches for first history event beginning with str */ int history_search_prefix(const char *str, int direction) { HistEvent ev; return (history(h, &ev, direction < 0? H_PREV_STR:H_NEXT_STR, str)); } /* * search for event in history containing str, starting at offset * abs(pos); continue backward, if pos<0, forward otherwise */ /* ARGSUSED */ int history_search_pos(const char *str, int direction __attribute__((__unused__)), int pos) { HistEvent ev; int curr_num, off; off = (pos > 0) ? pos : -pos; pos = (pos > 0) ? 1 : -1; if (history(h, &ev, H_CURR) != 0) return (-1); curr_num = ev.num; if (history_set_pos(off) != 0 || history(h, &ev, H_CURR) != 0) return (-1); for (;;) { if (strstr(ev.str, str)) return (off); if (history(h, &ev, (pos < 0) ? H_PREV : H_NEXT) != 0) break; } /* set "current" pointer back to previous state */ history(h, &ev, (pos < 0) ? H_NEXT_EVENT : H_PREV_EVENT, curr_num); return (-1); } /********************************/ /* completion functions */ char * tilde_expand(char *name) { return fn_tilde_expand(name); } char * filename_completion_function(const char *name, int state) { return fn_filename_completion_function(name, state); } /* * a completion generator for usernames; returns _first_ username * which starts with supplied text * text contains a partial username preceded by random character * (usually '~'); state is ignored * it's callers responsibility to free returned value */ char * username_completion_function(const char *text, int state) { struct passwd *pwd; if (text[0] == '\0') return (NULL); if (*text == '~') text++; if (state == 0) setpwent(); while ((pwd = getpwent()) && pwd != NULL && text[0] == pwd->pw_name[0] && strcmp(text, pwd->pw_name) == 0); if (pwd == NULL) { endpwent(); return (NULL); } return (strdup(pwd->pw_name)); } /* * el-compatible wrapper to send TSTP on ^Z */ /* ARGSUSED */ static unsigned char _el_rl_tstp(EditLine *el __attribute__((__unused__)), int ch __attribute__((__unused__))) { (void)kill(0, SIGTSTP); return CC_NORM; } /* * Display list of strings in columnar format on readline's output stream. * 'matches' is list of strings, 'len' is number of strings in 'matches', * 'max' is maximum length of string in 'matches'. */ void rl_display_match_list(char **matches, int len, int max) { fn_display_match_list(e, matches, len, max); } static const char * /*ARGSUSED*/ _rl_completion_append_character_function(const char *dummy __attribute__((__unused__))) { static char buf[2]; buf[1] = rl_completion_append_character; return buf; } /* * complete word at current point */ /* ARGSUSED */ int rl_complete(int ignore __attribute__((__unused__)), int invoking_key) { if (h == NULL || e == NULL) rl_initialize(); if (rl_inhibit_completion) { char arr[2]; arr[0] = (char)invoking_key; arr[1] = '\0'; el_insertstr(e, arr); return (CC_REFRESH); } /* Just look at how many global variables modify this operation! */ return fn_complete(e, (CPFunction *)rl_completion_entry_function, rl_attempted_completion_function, rl_basic_word_break_characters, rl_special_prefixes, _rl_completion_append_character_function, rl_completion_query_items, &rl_completion_type, &rl_attempted_completion_over, &rl_point, &rl_end); } /* ARGSUSED */ static unsigned char _el_rl_complete(EditLine *el __attribute__((__unused__)), int ch) { return (unsigned char)rl_complete(0, ch); } /* * misc other functions */ /* * bind key c to readline-type function func */ int rl_bind_key(int c, int func(int, int)) { int retval = -1; if (h == NULL || e == NULL) rl_initialize(); if (func == rl_insert) { /* XXX notice there is no range checking of ``c'' */ e->el_map.key[c] = ED_INSERT; retval = 0; } return (retval); } /* * read one key from input - handles chars pushed back * to input stream also */ int rl_read_key(void) { char fooarr[2 * sizeof(int)]; if (e == NULL || h == NULL) rl_initialize(); return (el_getc(e, fooarr)); } /* * reset the terminal */ /* ARGSUSED */ void rl_reset_terminal(const char *p __attribute__((__unused__))) { if (h == NULL || e == NULL) rl_initialize(); el_reset(e); } /* * insert character ``c'' back into input stream, ``count'' times */ int rl_insert(int count, int c) { char arr[2]; if (h == NULL || e == NULL) rl_initialize(); /* XXX - int -> char conversion can lose on multichars */ arr[0] = c; arr[1] = '\0'; for (; count > 0; count--) el_push(e, arr); return (0); } /*ARGSUSED*/ int rl_newline(int count, int c) { /* * Readline-4.0 appears to ignore the args. */ return rl_insert(1, '\n'); } /*ARGSUSED*/ static unsigned char rl_bind_wrapper(EditLine *el, unsigned char c) { if (map[c] == NULL) return CC_ERROR; _rl_update_pos(); (*map[c])(NULL, c); /* If rl_done was set by the above call, deal with it here */ if (rl_done) return CC_EOF; return CC_NORM; } int rl_add_defun(const char *name, Function *fun, int c) { char dest[8]; if (c >= sizeof(map) / sizeof(map[0]) || c < 0) return -1; map[(unsigned char)c] = fun; el_set(e, EL_ADDFN, name, name, rl_bind_wrapper); vis(dest, c, VIS_WHITE|VIS_NOSLASH, 0); el_set(e, EL_BIND, dest, name); return 0; } void rl_callback_read_char() { int count = 0, done = 0; const char *buf = el_gets(e, &count); char *wbuf; if (buf == NULL || count-- <= 0) return; #ifdef CTRL2 /* _AIX */ if (count == 0 && buf[0] == CTRL2('d')) #else if (count == 0 && buf[0] == CTRL('d')) #endif done = 1; if (buf[count] == '\n' || buf[count] == '\r') done = 2; if (done && rl_linefunc != NULL) { el_set(e, EL_UNBUFFERED, 0); if (done == 2) { if ((wbuf = strdup(buf)) != NULL) wbuf[count] = '\0'; } else wbuf = NULL; (*(void (*)(const char *))rl_linefunc)(wbuf); el_set(e, EL_UNBUFFERED, 1); } } void rl_callback_handler_install (const char *prompt, VCPFunction *linefunc) { if (e == NULL) { rl_initialize(); } if (rl_prompt) free(rl_prompt); rl_prompt = prompt ? strdup(strchr(prompt, *prompt)) : NULL; rl_linefunc = linefunc; el_set(e, EL_UNBUFFERED, 1); } void rl_callback_handler_remove(void) { el_set(e, EL_UNBUFFERED, 0); } void rl_redisplay(void) { char a[2]; #ifdef CTRL2 /* _AIX */ a[0] = CTRL2('r'); #else a[0] = CTRL('r'); #endif a[1] = '\0'; el_push(e, a); } int rl_get_previous_history(int count, int key) { char a[2]; a[0] = key; a[1] = '\0'; while (count--) el_push(e, a); return 0; } void /*ARGSUSED*/ rl_prep_terminal(int meta_flag) { el_set(e, EL_PREP_TERM, 1); } void rl_deprep_terminal() { el_set(e, EL_PREP_TERM, 0); } int rl_read_init_file(const char *s) { return(el_source(e, s)); } int rl_parse_and_bind(const char *line) { const char **argv; int argc; Tokenizer *tok; tok = tok_init(NULL); tok_str(tok, line, &argc, &argv); argc = el_parse(e, argc, argv); tok_end(tok); return (argc ? 1 : 0); } int rl_variable_bind(const char *var, const char *value) { /* * The proper return value is undocument, but this is what the * readline source seems to do. */ return ((el_set(e, EL_BIND, "", var, value) == -1) ? 1 : 0); } void rl_stuff_char(int c) { char buf[2]; buf[0] = c; buf[1] = '\0'; el_insertstr(e, buf); } static int _rl_event_read_char(EditLine *el, char *cp) { int n, num_read = 0; *cp = 0; while (rl_event_hook) { (*rl_event_hook)(); #if defined(FIONREAD) if (ioctl(el->el_infd, FIONREAD, &n) < 0) return(-1); if (n) num_read = read(el->el_infd, cp, 1); else num_read = 0; #elif defined(F_SETFL) && defined(O_NDELAY) if ((n = fcntl(el->el_infd, F_GETFL, 0)) < 0) return(-1); if (fcntl(el->el_infd, F_SETFL, n|O_NDELAY) < 0) return(-1); num_read = read(el->el_infd, cp, 1); if (fcntl(el->el_infd, F_SETFL, n)) return(-1); #else /* not non-blocking, but what you gonna do? */ num_read = read(el->el_infd, cp, 1); return(-1); #endif if (num_read < 0 && errno == EAGAIN) continue; if (num_read == 0) continue; break; } if (!rl_event_hook) el_set(el, EL_GETCFN, EL_BUILTIN_GETCFN); return(num_read); } static void _rl_update_pos(void) { const LineInfo *li = el_line(e); rl_point = li->cursor - li->buffer; rl_end = li->lastchar - li->buffer; } openipmi-2.0.18/libedit/orig_editline.diff0000644000175000017500000002663210373140634017473 0ustar chuckchuckdiff -u /home/cminyard/m1/libedit-20060103-2.9/src/chared.c ./chared.c --- /home/cminyard/m1/libedit-20060103-2.9/src/chared.c 2006-01-03 06:41:24.000000000 -0600 +++ ./chared.c 2006-02-10 09:57:21.156927844 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/common.c ./common.c --- /home/cminyard/m1/libedit-20060103-2.9/src/common.c 2006-01-03 06:41:24.000000000 -0600 +++ ./common.c 2006-02-10 09:58:01.643795376 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93"; Common subdirectories: /home/cminyard/m1/libedit-20060103-2.9/src/editline and ./editline diff -u /home/cminyard/m1/libedit-20060103-2.9/src/el.c ./el.c --- /home/cminyard/m1/libedit-20060103-2.9/src/el.c 2006-01-03 06:41:24.000000000 -0600 +++ ./el.c 2006-02-10 09:58:10.348691834 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/emacs.c ./emacs.c --- /home/cminyard/m1/libedit-20060103-2.9/src/emacs.c 2006-01-03 06:41:24.000000000 -0600 +++ ./emacs.c 2006-02-10 09:58:19.192570662 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/fgetln.c ./fgetln.c --- /home/cminyard/m1/libedit-20060103-2.9/src/fgetln.c 2006-01-03 06:41:24.000000000 -0600 +++ ./fgetln.c 2006-02-10 10:19:03.644802468 -0600 @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include +#include "sys.h" #include #include #include diff -u /home/cminyard/m1/libedit-20060103-2.9/src/filecomplete.c ./filecomplete.c --- /home/cminyard/m1/libedit-20060103-2.9/src/filecomplete.c 2006-01-03 06:41:24.000000000 -0600 +++ ./filecomplete.c 2006-02-10 10:01:13.792433574 -0600 @@ -41,7 +41,7 @@ #pragma alloca #endif -#include +#include "sys.h" #ifdef __GNUC__ # undef alloca diff -u /home/cminyard/m1/libedit-20060103-2.9/src/hist.c ./hist.c --- /home/cminyard/m1/libedit-20060103-2.9/src/hist.c 2006-01-03 06:41:24.000000000 -0600 +++ ./hist.c 2006-02-10 09:58:32.439891227 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/history.c ./history.c --- /home/cminyard/m1/libedit-20060103-2.9/src/history.c 2006-01-03 06:41:24.000000000 -0600 +++ ./history.c 2006-02-10 10:00:37.375051211 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/key.c ./key.c --- /home/cminyard/m1/libedit-20060103-2.9/src/key.c 2006-01-03 06:41:24.000000000 -0600 +++ ./key.c 2006-02-10 09:58:57.894664113 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/Makefile.am ./Makefile.am --- /home/cminyard/m1/libedit-20060103-2.9/src/Makefile.am 2005-09-11 12:55:32.000000000 -0500 +++ ./Makefile.am 2006-02-10 09:41:42.805887067 -0600 @@ -28,19 +28,15 @@ CLEANFILES = $(BUILT_SOURCES) -lib_LTLIBRARIES = libedit.la -libedit_la_SOURCES = chared.c common.c el.c emacs.c hist.c key.c map.c parse.c \ - prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c \ - fgetln.c strlcat.c strlcpy.c unvis.c vis.c tokenizer.c \ - history.c filecomplete.c readline.c chared.h el.h hist.h \ - histedit.h key.h map.h parse.h prompt.h read.h refresh.h \ - search.h sig.h sys.h el_term.h tty.h vis.h filecomplete.h \ - editline/readline.h +noinst_LIBRARIES = libedit.a +libedit_a_SOURCES = chared.c common.c el.c emacs.c hist.c key.c map.c parse.c \ + prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c \ + fgetln.c strlcat.c strlcpy.c unvis.c vis.c tokenizer.c \ + history.c filecomplete.c readline.c chared.h el.h hist.h \ + histedit.h key.h map.h parse.h prompt.h read.h refresh.h \ + search.h sig.h sys.h el_term.h tty.h vis.h filecomplete.h \ + editline/readline.h -EXTRA_DIST = makelist shlib_version -nobase_include_HEADERS = histedit.h editline/readline.h - -nodist_libedit_la_SOURCES = $(BUILT_SOURCES) - -libedit_la_LDFLAGS = -no-undefined -version-info $(LT_VERSION) +EXTRA_DIST = makelist +nodist_libedit_a_SOURCES = $(BUILT_SOURCES) diff -u /home/cminyard/m1/libedit-20060103-2.9/src/map.c ./map.c --- /home/cminyard/m1/libedit-20060103-2.9/src/map.c 2006-01-03 06:41:24.000000000 -0600 +++ ./map.c 2006-02-10 09:59:04.419836847 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/parse.c ./parse.c --- /home/cminyard/m1/libedit-20060103-2.9/src/parse.c 2006-01-03 06:41:24.000000000 -0600 +++ ./parse.c 2006-02-10 09:59:13.284712941 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/prompt.c ./prompt.c --- /home/cminyard/m1/libedit-20060103-2.9/src/prompt.c 2006-01-03 06:41:24.000000000 -0600 +++ ./prompt.c 2006-02-10 09:59:20.872750903 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)prompt.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/read.c ./read.c --- /home/cminyard/m1/libedit-20060103-2.9/src/read.c 2006-01-03 06:41:24.000000000 -0600 +++ ./read.c 2006-02-10 09:59:32.905225367 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/readline.c ./readline.c --- /home/cminyard/m1/libedit-20060103-2.9/src/readline.c 2006-01-03 06:41:24.000000000 -0600 +++ ./readline.c 2006-02-10 10:01:23.005265379 -0600 @@ -41,7 +41,7 @@ #pragma alloca #endif -#include +#include "sys.h" #ifdef __GNUC__ # undef alloca diff -u /home/cminyard/m1/libedit-20060103-2.9/src/refresh.c ./refresh.c --- /home/cminyard/m1/libedit-20060103-2.9/src/refresh.c 2006-01-03 06:41:24.000000000 -0600 +++ ./refresh.c 2006-02-10 09:59:41.130182554 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/search.c ./search.c --- /home/cminyard/m1/libedit-20060103-2.9/src/search.c 2006-01-03 06:41:24.000000000 -0600 +++ ./search.c 2006-02-10 09:59:48.194286914 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93"; --- /home/cminyard/m1/libedit-20060103-2.9/src/sig.c 2006-01-03 06:41:24.000000000 -0600 +++ ./sig.c 2006-02-10 09:59:54.268516772 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/strlcat.c ./strlcat.c --- /home/cminyard/m1/libedit-20060103-2.9/src/strlcat.c 2006-01-03 06:41:24.000000000 -0600 +++ ./strlcat.c 2006-02-10 10:18:55.072889319 -0600 @@ -17,7 +17,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include +#include "sys.h" #if defined(LIBC_SCCS) && !defined(lint) __RCSID("$NetBSD: strlcat.c,v 1.1 2005/12/20 19:28:52 christos Exp $"); diff -u /home/cminyard/m1/libedit-20060103-2.9/src/strlcpy.c ./strlcpy.c --- /home/cminyard/m1/libedit-20060103-2.9/src/strlcpy.c 2006-01-03 06:41:24.000000000 -0600 +++ ./strlcpy.c 2006-02-10 10:19:14.251457614 -0600 @@ -17,7 +17,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include +#include "sys.h" #if defined(LIBC_SCCS) && !defined(lint) __RCSID("$NetBSD: strlcpy.c,v 1.1 2005/12/20 19:28:52 christos Exp $"); diff -u /home/cminyard/m1/libedit-20060103-2.9/src/sys.h ./sys.h --- /home/cminyard/m1/libedit-20060103-2.9/src/sys.h 2006-01-03 06:41:24.000000000 -0600 +++ ./sys.h 2006-02-10 09:57:51.724052912 -0600 @@ -151,4 +151,7 @@ extern char *fgetline(FILE *, int *); #endif +#define SCCSID +#undef LIBC_SCCS + #endif /* _h_sys */ diff -u /home/cminyard/m1/libedit-20060103-2.9/src/term.c ./term.c --- /home/cminyard/m1/libedit-20060103-2.9/src/term.c 2006-01-03 06:41:24.000000000 -0600 +++ ./term.c 2006-02-10 10:00:02.258503726 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/tokenizer.c ./tokenizer.c --- /home/cminyard/m1/libedit-20060103-2.9/src/tokenizer.c 2006-01-03 06:41:24.000000000 -0600 +++ ./tokenizer.c 2006-02-10 10:00:28.114225431 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)tokenizer.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/tty.c ./tty.c --- /home/cminyard/m1/libedit-20060103-2.9/src/tty.c 2006-01-03 06:41:24.000000000 -0600 +++ ./tty.c 2006-02-10 10:00:09.316608825 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #if !defined(lint) && !defined(SCCSID) #if 0 static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/unvis.c ./unvis.c --- /home/cminyard/m1/libedit-20060103-2.9/src/unvis.c 2006-01-03 06:41:24.000000000 -0600 +++ ./unvis.c 2006-02-10 10:20:11.476201625 -0600 @@ -29,7 +29,7 @@ * SUCH DAMAGE. */ -#include +#include "sys.h" #if defined(LIBC_SCCS) && !defined(lint) #if 0 static char sccsid[] = "@(#)unvis.c 8.1 (Berkeley) 6/4/93"; diff -u /home/cminyard/m1/libedit-20060103-2.9/src/vi.c ./vi.c --- /home/cminyard/m1/libedit-20060103-2.9/src/vi.c 2006-01-03 06:41:24.000000000 -0600 +++ ./vi.c 2006-02-10 10:00:15.555817746 -0600 @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -#include "config.h" +#include "sys.h" #include #include #include diff -u /home/cminyard/m1/libedit-20060103-2.9/src/vis.c ./vis.c --- /home/cminyard/m1/libedit-20060103-2.9/src/vis.c 2006-01-03 06:41:24.000000000 -0600 +++ ./vis.c 2006-02-10 10:19:53.879432910 -0600 @@ -67,7 +67,7 @@ #pragma alloca #endif -#include +#include "sys.h" #ifdef __GNUC__ # undef alloca openipmi-2.0.18/tcl/0000755000175000017500000000000011367555457013202 5ustar chuckchuckopenipmi-2.0.18/tcl/tcl_os_hnd.c0000644000175000017500000003663311267100764015457 0ustar chuckchuck/* * tcl_os_hnd.c * * TCL OS-handlers for OpenIPMI * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2006 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include /* Get the rwlocks for GNU. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_GDBM #include #endif #include #include #include typedef struct t_os_hnd_data_s { int priority; os_vlog_t log_handler; #ifdef HAVE_GDBM char *gdbm_filename; GDBM_FILE gdbmf; Tcl_Mutex gdbm_lock; #endif } t_os_hnd_data_t; struct os_hnd_fd_id_s { int fd; void *cb_data; os_data_ready_t data_ready; os_handler_t *handler; os_fd_data_freed_t freed; }; static void fd_handler(ClientData data, int mask) { os_hnd_fd_id_t *fd_data = (os_hnd_fd_id_t *) data; void *cb_data; os_data_ready_t handler; int fd; handler = fd_data->data_ready; cb_data = fd_data->cb_data; fd = fd_data->fd; handler(fd, cb_data, fd_data); } static int add_fd(os_handler_t *handler, int fd, os_data_ready_t data_ready, void *cb_data, os_fd_data_freed_t freed, os_hnd_fd_id_t **id) { os_hnd_fd_id_t *fd_data; fd_data = malloc(sizeof(*fd_data)); if (!fd_data) return ENOMEM; memset(fd_data, 0, sizeof(*fd_data)); fd_data->fd = fd; fd_data->cb_data = cb_data; fd_data->data_ready = data_ready; fd_data->handler = handler; fd_data->freed = freed; Tcl_CreateFileHandler(fd, TCL_READABLE, fd_handler, fd_data); *id = fd_data; return 0; } static int remove_fd(os_handler_t *handler, os_hnd_fd_id_t *fd_data) { Tcl_DeleteFileHandler(fd_data->fd); free(fd_data); return 0; } struct os_hnd_timer_id_s { void *cb_data; os_timed_out_t timed_out; int running; os_handler_t *handler; Tcl_TimerToken token; }; static void timer_handler(ClientData data) { os_hnd_timer_id_t *timer_data = (os_hnd_timer_id_t *) data; /* Make a copy of this, because the handler may delete the timer data. */ void *cb_data; os_timed_out_t timed_out; timed_out = timer_data->timed_out; cb_data = timer_data->cb_data; timer_data->running = 0; timed_out(cb_data, timer_data); } static int start_timer(os_handler_t *handler, os_hnd_timer_id_t *id, struct timeval *timeout, os_timed_out_t timed_out, void *cb_data) { int interval; if (id->running) return EBUSY; id->running = 1; id->cb_data = cb_data; id->timed_out = timed_out; interval = (timeout->tv_sec * 1000) | ((timeout->tv_usec + 999) / 1000); id->token = Tcl_CreateTimerHandler(interval, timer_handler, id); return 0; } static int stop_timer(os_handler_t *handler, os_hnd_timer_id_t *id) { if (!id->running) return EINVAL; id->running = 0; Tcl_DeleteTimerHandler(id->token); return 0; } static int alloc_timer(os_handler_t *handler, os_hnd_timer_id_t **id) { os_hnd_timer_id_t *timer_data; timer_data = malloc(sizeof(*timer_data)); if (!timer_data) return ENOMEM; timer_data->running = 0; timer_data->timed_out = NULL; timer_data->handler = handler; *id = timer_data; return 0; } static int free_timer(os_handler_t *handler, os_hnd_timer_id_t *id) { if (id->running) return EBUSY; free(id); return 0; } static int get_random(os_handler_t *handler, void *data, unsigned int len) { int fd = open("/dev/urandom", O_RDONLY); int rv = 0; if (fd == -1) return errno; while (len > 0) { rv = read(fd, data, len); if (rv < 0) { rv = errno; goto out; } len -= rv; } rv = 0; out: close(fd); return rv; } static void default_vlog(const char *format, enum ipmi_log_type_e log_type, va_list ap) { int do_nl = 1; switch(log_type) { case IPMI_LOG_INFO: fprintf(stderr, "INFO: "); break; case IPMI_LOG_WARNING: fprintf(stderr, "WARN: "); break; case IPMI_LOG_SEVERE: fprintf(stderr, "SEVR: "); break; case IPMI_LOG_FATAL: fprintf(stderr, "FATL: "); break; case IPMI_LOG_ERR_INFO: fprintf(stderr, "EINF: "); break; case IPMI_LOG_DEBUG_START: do_nl = 0; /* FALLTHROUGH */ case IPMI_LOG_DEBUG: fprintf(stderr, "DEBG: "); break; case IPMI_LOG_DEBUG_CONT: do_nl = 0; /* FALLTHROUGH */ case IPMI_LOG_DEBUG_END: break; } vfprintf(stderr, format, ap); if (do_nl) fprintf(stderr, "\n"); } static void tcl_vlog(os_handler_t *handler, enum ipmi_log_type_e log_type, const char *format, va_list ap) { t_os_hnd_data_t *info = handler->internal_data; os_vlog_t log_handler = info->log_handler; if (log_handler) log_handler(handler, format, log_type, ap); else default_vlog(format, log_type, ap); } static void tcl_log(os_handler_t *handler, enum ipmi_log_type_e log_type, const char *format, ...) { va_list ap; va_start(ap, format); tcl_vlog(handler, log_type, format, ap); va_end(ap); } struct os_hnd_lock_s { Tcl_Mutex mutex; }; static int create_lock(os_handler_t *handler, os_hnd_lock_t **id) { os_hnd_lock_t *lock; lock = malloc(sizeof(*lock)); if (!lock) return ENOMEM; memset(lock, 0, sizeof(*lock)); *id = lock; return 0; } static int destroy_lock(os_handler_t *handler, os_hnd_lock_t *id) { Tcl_MutexFinalize(&id->mutex); free(id); return 0; } static int lock(os_handler_t *handler, os_hnd_lock_t *id) { Tcl_MutexLock(&id->mutex); return 0; } static int unlock(os_handler_t *handler, os_hnd_lock_t *id) { Tcl_MutexUnlock(&id->mutex); return 0; } /* * Tcl conditions provide neither an indication of timeout for a timed * condition wait nor a broadcast function. Those have to be simulated * and that requires some complexity. */ struct os_hnd_cond_s { unsigned int waiters; unsigned int woken; Tcl_Condition cond; }; static int create_cond(os_handler_t *handler, os_hnd_cond_t **new_cond) { os_hnd_cond_t *cond; cond = malloc(sizeof(*cond)); if (!cond) return ENOMEM; memset(cond, 0, sizeof(*cond)); *new_cond = cond; return 0; } static int destroy_cond(os_handler_t *handler, os_hnd_cond_t *cond) { if (cond->waiters) return EBUSY; Tcl_ConditionFinalize(cond->cond); free(cond); return 0; } static int cond_wait(os_handler_t *handler, os_hnd_cond_t *cond, os_hnd_lock_t *lock) { while (cond->waiters >= cond->woken) { cond->waiters++; Tcl_ConditionWait(&cond->cond, &lock->mutex, NULL); cond->waiters--; } cond->woken--; return 0; } static int cond_timedwait(os_handler_t *handler, os_hnd_cond_t *cond, os_hnd_lock_t *lock, struct timeval *rtimeout) { Tcl_Time timeout; Tcl_Time then; Tcl_Time now; /* Calculate when the timeout should occur. */ Tcl_GetTime(&then); then.sec += rtimeout->tv_sec; then.usec += rtimeout->tv_usec; while (then.usec >= 1000000) { then.usec -= 1000000; then.sec += 1; } while (then.usec < 0) { then.usec += 1000000; then.sec -= 1; } timeout.sec = rtimeout->tv_sec; timeout.usec = rtimeout->tv_usec; while (cond->waiters >= cond->woken) { cond->waiters++; Tcl_ConditionWait(&cond->cond, &lock->mutex, &timeout); cond->waiters--; /* If we are woken, just return. */ if (cond->waiters < cond->woken) break; /* Otherwise, calculate the time left. If it is <0, then we have timed out. */ Tcl_GetTime(&now); timeout.sec = then.sec - now.sec; timeout.usec = then.usec - now.usec; while (then.usec < 0) { timeout.usec += 1000000; timeout.sec -= 1; } if (timeout.sec < 0) return ETIMEDOUT; } cond->woken--; return 0; } static int cond_wake(os_handler_t *handler, os_hnd_cond_t *cond) { cond->woken++; Tcl_ConditionNotify(&cond->cond); return 0; } static int cond_broadcast(os_handler_t *handler, os_hnd_cond_t *cond) { while (cond->waiters > cond->woken) { cond->woken++; Tcl_ConditionNotify(&cond->cond); } return 0; } #if 0 static int create_thread(os_handler_t *handler, int priority, void (*startup)(void *data), void *data) { int rv; rv = Tcl_CreateThread(NULL, startup, data, TCL_THREAD_STACK_DEFAULT, TCL_THREAD_NOFLAGS); return 0; } static int thread_exit(os_handler_t *handler) { Tcl_ExitThread(0); return 0; } #endif static void timeout_callback(ClientData data) { /* Nothing to do */ } static int perform_one_op(os_handler_t *os_hnd, struct timeval *timeout) { /* Note that this is not technically 100% correct in a multi-threaded environment, since another thread may run it, but it is pretty close, I guess. */ int time_ms; Tcl_TimerToken token = NULL; if (timeout) { time_ms= (timeout->tv_sec * 1000) + ((timeout->tv_usec+500) / 1000); token = Tcl_CreateTimerHandler(time_ms, timeout_callback, NULL); } Tcl_DoOneEvent(TCL_ALL_EVENTS); if (token) Tcl_DeleteTimerHandler(token); return 0; } static void operation_loop(os_handler_t *os_hnd) { for (;;) Tcl_DoOneEvent(TCL_ALL_EVENTS); } static void free_os_handler(os_handler_t *os_hnd) { t_os_hnd_data_t *info = os_hnd->internal_data; #ifdef HAVE_GDBM Tcl_MutexFinalize(&info->gdbm_lock); if (info->gdbm_filename) free(info->gdbm_filename); if (info->gdbmf) gdbm_close(info->gdbmf); #endif free(info); free(os_hnd); } static void * tcl_malloc(int size) { return malloc(size); } static void tcl_free(void *data) { free(data); } #ifdef HAVE_GDBM #define GDBM_FILE ".OpenIPMI_db" static void init_gdbm(t_os_hnd_data_t *info) { if (!info->gdbm_filename) { char *home = getenv("HOME"); if (!home) return; info->gdbm_filename = malloc(strlen(home)+strlen(GDBM_FILE)+2); if (!info->gdbm_filename) return; strcpy(info->gdbm_filename, home); strcat(info->gdbm_filename, "/"); strcat(info->gdbm_filename, GDBM_FILE); } info->gdbmf = gdbm_open(info->gdbm_filename, 512, GDBM_WRCREAT, 0600, NULL); /* gdbmf will be NULL on error, which is what reports an error. */ } static int database_store(os_handler_t *handler, char *key, unsigned char *data, unsigned int data_len) { t_os_hnd_data_t *info = handler->internal_data; datum gkey, gdata; int rv; Tcl_MutexLock(&info->gdbm_lock); if (!info->gdbmf) { init_gdbm(info); if (!info->gdbmf) { Tcl_MutexUnlock(&info->gdbm_lock); return EINVAL; } } gkey.dptr = key; gkey.dsize = strlen(key); gdata.dptr = (char *) data; gdata.dsize = data_len; rv = gdbm_store(info->gdbmf, gkey, gdata, GDBM_REPLACE); Tcl_MutexUnlock(&info->gdbm_lock); if (rv) return EINVAL; return 0; } static int database_find(os_handler_t *handler, char *key, unsigned int *fetch_completed, unsigned char **data, unsigned int *data_len, void (*got_data)(void *cb_data, int err, unsigned char *data, unsigned int data_len), void *cb_data) { t_os_hnd_data_t *info = handler->internal_data; datum gkey, gdata; Tcl_MutexLock(&info->gdbm_lock); if (!info->gdbmf) { init_gdbm(info); if (!info->gdbmf) { Tcl_MutexUnlock(&info->gdbm_lock); return EINVAL; } } gkey.dptr = key; gkey.dsize = strlen(key); gdata = gdbm_fetch(info->gdbmf, gkey); Tcl_MutexUnlock(&info->gdbm_lock); if (!gdata.dptr) return EINVAL; *data = (unsigned char *) gdata.dptr; *data_len = gdata.dsize; *fetch_completed = 1; return 0; } static void database_free(os_handler_t *handler, unsigned char *data) { free(data); } static int set_gdbm_filename(os_handler_t *os_hnd, char *name) { t_os_hnd_data_t *info = os_hnd->internal_data; char *nname; nname = strdup(name); if (!nname) return ENOMEM; if (info->gdbm_filename) free(info->gdbm_filename); info->gdbm_filename = nname; return 0; } #endif void sset_log_handler(os_handler_t *handler, os_vlog_t log_handler) { t_os_hnd_data_t *info = handler->internal_data; info->log_handler = log_handler; } static os_handler_t ipmi_tcl_os_handler = { .mem_alloc = tcl_malloc, .mem_free = tcl_free, .add_fd_to_wait_for = add_fd, .remove_fd_to_wait_for = remove_fd, .start_timer = start_timer, .stop_timer = stop_timer, .alloc_timer = alloc_timer, .free_timer = free_timer, .get_random = get_random, .log = tcl_log, .vlog = tcl_vlog, .create_lock = create_lock, .destroy_lock = destroy_lock, .lock = lock, .unlock = unlock, .create_cond = create_cond, .destroy_cond = destroy_cond, .cond_wait = cond_wait, .cond_timedwait = cond_timedwait, .cond_wake = cond_wake, .cond_broadcast = cond_broadcast, #if 0 .create_thread = create_thread, .thread_exit = thread_exit, #endif .free_os_handler = free_os_handler, .perform_one_op = perform_one_op, .operation_loop = operation_loop, #ifdef HAVE_GDBM .database_store = database_store, .database_find = database_find, .database_free = database_free, .database_set_filename = set_gdbm_filename, #endif .set_log_handler = sset_log_handler, }; os_handler_t * ipmi_tcl_get_os_handler(int priority) { os_handler_t *rv; t_os_hnd_data_t *info; rv = malloc(sizeof(*rv)); if (!rv) return NULL; memcpy(rv, &ipmi_tcl_os_handler, sizeof(*rv)); info = malloc(sizeof(*info)); if (! info) { free(rv); return NULL; } memset(info, 0, sizeof(*info)); info->priority = priority; rv->internal_data = info; return rv; } openipmi-2.0.18/tcl/Makefile.am0000644000175000017500000000170610705151246015221 0ustar chuckchuck empty:= space:= $(empty) $(empty) LIB_VERSION = 0.0.1 SPACE_VERSION = $(subst .,$(space),$(LIB_VERSION)) VERSION_CURRENT = $(wordlist 1, 1, $(SPACE_VERSION)) VERSION_REVISION = $(wordlist 3, 3, $(SPACE_VERSION)) VERSION_AGE = $(wordlist 2, 2, $(SPACE_VERSION)) LD_VERSION = $(VERSION_CURRENT):$(VERSION_REVISION):$(VERSION_AGE) AM_CFLAGS = -Wall -Wsign-compare -I$(top_srcdir)/include lib_LTLIBRARIES = @TCL_TARGET@ EXTRA_LTLIBRARIES = libOpenIPMItcl.la libOpenIPMItcl_la_SOURCES = tcl_os_hnd.c libOpenIPMItcl_la_CFLAGS = $(TCL_CFLAGS) $(AM_CFLAGS) libOpenIPMItcl_la_LIBADD = $(GDBM_LIB) libOpenIPMItcl_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ -rpath $(libdir) \ -Wl,-Map -Wl,libOpenIPMItcl.map $(TCL_LIBS) noinst_PROGRAMS = test_handlers test_handlers_SOURCES = test_handlers.c test_handlers_LDADD = libOpenIPMItcl.la \ $(top_builddir)/utils/libOpenIPMIutils.la $(GDBM_LIB) $(TCL_LIBS) TESTS = test_handlers CLEANFILES = libOpenIPMItcl.map openipmi-2.0.18/tcl/Makefile.in0000644000175000017500000005176311367554431015252 0ustar chuckchuck# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ noinst_PROGRAMS = test_handlers$(EXEEXT) subdir = tcl DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libOpenIPMItcl_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libOpenIPMItcl_la_OBJECTS = libOpenIPMItcl_la-tcl_os_hnd.lo libOpenIPMItcl_la_OBJECTS = $(am_libOpenIPMItcl_la_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) am_test_handlers_OBJECTS = test_handlers.$(OBJEXT) test_handlers_OBJECTS = $(am_test_handlers_OBJECTS) test_handlers_DEPENDENCIES = libOpenIPMItcl.la \ $(top_builddir)/utils/libOpenIPMIutils.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libOpenIPMItcl_la_SOURCES) $(test_handlers_SOURCES) DIST_SOURCES = $(libOpenIPMItcl_la_SOURCES) $(test_handlers_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BIBTEX = @BIBTEX@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIA = @DIA@ DIA_FILTER_NAME = @DIA_FILTER_NAME@ DSYMUTIL = @DSYMUTIL@ DVIPDF = @DVIPDF@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GDBM_LIB = @GDBM_LIB@ GLIB12_CFLAGS = @GLIB12_CFLAGS@ GLIB12_LIB = @GLIB12_LIB@ GLIB12_LIBS = @GLIB12_LIBS@ GLIB12_PKGCONF = @GLIB12_PKGCONF@ GLIB12_SO = @GLIB12_SO@ GLIB12_TARGET = @GLIB12_TARGET@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_DIR = @GLIB_DIR@ GLIB_LIB = @GLIB_LIB@ GLIB_LIBS = @GLIB_LIBS@ GLIB_PKGCONF = @GLIB_PKGCONF@ GLIB_SINGLE_LIB = @GLIB_SINGLE_LIB@ GLIB_SINGLE_SO = @GLIB_SINGLE_SO@ GLIB_SO = @GLIB_SO@ GLIB_TARGET = @GLIB_TARGET@ GLIB_VERSION = @GLIB_VERSION@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NMEDIT = @NMEDIT@ OBJEXT = @OBJEXT@ OPENIPMI_SMI = @OPENIPMI_SMI@ OPENIPMI_SWIG_LIBS = @OPENIPMI_SWIG_LIBS@ OPENIPMI_SWIG_SO = @OPENIPMI_SWIG_SO@ OPENIPMI_VERSION_EXTRA = @OPENIPMI_VERSION_EXTRA@ OPENIPMI_VERSION_MAJOR = @OPENIPMI_VERSION_MAJOR@ OPENIPMI_VERSION_MINOR = @OPENIPMI_VERSION_MINOR@ OPENIPMI_VERSION_RELEASE = @OPENIPMI_VERSION_RELEASE@ OPENSSLINCS = @OPENSSLINCS@ OPENSSLLIBS = @OPENSSLLIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_DIR = @PERL_DIR@ PERL_HAS_POSIX_THREADS = @PERL_HAS_POSIX_THREADS@ PERL_INSTALL_DIR = @PERL_INSTALL_DIR@ PERL_POSIX_LIB = @PERL_POSIX_LIB@ PERL_POSIX_SO = @PERL_POSIX_SO@ POPTLIBS = @POPTLIBS@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_DIR = @PYTHON_DIR@ PYTHON_GUI_DIR = @PYTHON_GUI_DIR@ PYTHON_HAS_POSIX_THREADS = @PYTHON_HAS_POSIX_THREADS@ PYTHON_INSTALL_DIR = @PYTHON_INSTALL_DIR@ PYTHON_INSTALL_LIB_DIR = @PYTHON_INSTALL_LIB_DIR@ PYTHON_POSIX_LIB = @PYTHON_POSIX_LIB@ PYTHON_POSIX_SO = @PYTHON_POSIX_SO@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNMPLIBS = @SNMPLIBS@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_DIR = @SWIG_DIR@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_DIR = @TCL_DIR@ TCL_LIB = @TCL_LIB@ TCL_LIBS = @TCL_LIBS@ TCL_PKGCONF = @TCL_PKGCONF@ TCL_SO = @TCL_SO@ TCL_TARGET = @TCL_TARGET@ TERM_LIBS = @TERM_LIBS@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ diaprog = @diaprog@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ glibprog = @glibprog@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlprog = @perlprog@ pkgprog = @pkgprog@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pythonprog = @pythonprog@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ swigprog = @swigprog@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ empty := space := $(empty) $(empty) LIB_VERSION = 0.0.1 SPACE_VERSION = $(subst .,$(space),$(LIB_VERSION)) VERSION_CURRENT = $(wordlist 1, 1, $(SPACE_VERSION)) VERSION_REVISION = $(wordlist 3, 3, $(SPACE_VERSION)) VERSION_AGE = $(wordlist 2, 2, $(SPACE_VERSION)) LD_VERSION = $(VERSION_CURRENT):$(VERSION_REVISION):$(VERSION_AGE) AM_CFLAGS = -Wall -Wsign-compare -I$(top_srcdir)/include lib_LTLIBRARIES = @TCL_TARGET@ EXTRA_LTLIBRARIES = libOpenIPMItcl.la libOpenIPMItcl_la_SOURCES = tcl_os_hnd.c libOpenIPMItcl_la_CFLAGS = $(TCL_CFLAGS) $(AM_CFLAGS) libOpenIPMItcl_la_LIBADD = $(GDBM_LIB) libOpenIPMItcl_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ -rpath $(libdir) \ -Wl,-Map -Wl,libOpenIPMItcl.map $(TCL_LIBS) test_handlers_SOURCES = test_handlers.c test_handlers_LDADD = libOpenIPMItcl.la \ $(top_builddir)/utils/libOpenIPMIutils.la $(GDBM_LIB) $(TCL_LIBS) TESTS = test_handlers CLEANFILES = libOpenIPMItcl.map all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tcl/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu tcl/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libOpenIPMItcl.la: $(libOpenIPMItcl_la_OBJECTS) $(libOpenIPMItcl_la_DEPENDENCIES) $(LINK) $(libOpenIPMItcl_la_LDFLAGS) $(libOpenIPMItcl_la_OBJECTS) $(libOpenIPMItcl_la_LIBADD) $(LIBS) clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done test_handlers$(EXEEXT): $(test_handlers_OBJECTS) $(test_handlers_DEPENDENCIES) @rm -f test_handlers$(EXEEXT) $(LINK) $(test_handlers_LDFLAGS) $(test_handlers_OBJECTS) $(test_handlers_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libOpenIPMItcl_la-tcl_os_hnd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_handlers.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libOpenIPMItcl_la-tcl_os_hnd.lo: tcl_os_hnd.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libOpenIPMItcl_la_CFLAGS) $(CFLAGS) -MT libOpenIPMItcl_la-tcl_os_hnd.lo -MD -MP -MF "$(DEPDIR)/libOpenIPMItcl_la-tcl_os_hnd.Tpo" -c -o libOpenIPMItcl_la-tcl_os_hnd.lo `test -f 'tcl_os_hnd.c' || echo '$(srcdir)/'`tcl_os_hnd.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libOpenIPMItcl_la-tcl_os_hnd.Tpo" "$(DEPDIR)/libOpenIPMItcl_la-tcl_os_hnd.Plo"; else rm -f "$(DEPDIR)/libOpenIPMItcl_la-tcl_os_hnd.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tcl_os_hnd.c' object='libOpenIPMItcl_la-tcl_os_hnd.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libOpenIPMItcl_la_CFLAGS) $(CFLAGS) -c -o libOpenIPMItcl_la-tcl_os_hnd.lo `test -f 'tcl_os_hnd.c' || echo '$(srcdir)/'`tcl_os_hnd.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list='$(TESTS)'; \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ echo "XPASS: $$tst"; \ ;; \ *) \ echo "PASS: $$tst"; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xfail=`expr $$xfail + 1`; \ echo "XFAIL: $$tst"; \ ;; \ *) \ failed=`expr $$failed + 1`; \ echo "FAIL: $$tst"; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ echo "SKIP: $$tst"; \ fi; \ done; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="All $$all tests passed"; \ else \ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all tests failed"; \ else \ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ skipped="($$skip tests were not run)"; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-generic clean-libLTLIBRARIES clean-libtool \ clean-noinstPROGRAMS ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-exec install-exec-am \ install-info install-info-am install-libLTLIBRARIES \ install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am uninstall-libLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: openipmi-2.0.18/tcl/test_handlers.c0000644000175000017500000001555710416757124016207 0ustar chuckchuck/* * test_handlers.c * * Basic tests for POSIX OS handlers. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2006 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include os_handler_t *test_os_hnd; static void err_leave(int err, char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); if (err) fprintf(stderr, "error: %s (%d)\n", strerror(err), err); va_end(ap); exit(1); } int expect_log = 0; static void my_vlog(os_handler_t *handler, const char *format, enum ipmi_log_type_e log_type, va_list ap) { if (expect_log == 0) { int ival; char *sval; expect_log++; if (strcmp(format, "This is a test: %d %s") != 0) err_leave(0, "Wrong format\n"); if (log_type != IPMI_LOG_FATAL) err_leave(0, "Invalid log type\n"); ival = va_arg(ap, int); if (ival != 47) err_leave(0, "Invalid log int val\n"); sval = va_arg(ap, char *); if (strcmp(sval, "Hello") != 0) err_leave(0, "Invalid log string val\n"); } else { vfprintf(stderr, format, ap); err_leave(0, "Unexpected log!\n"); } } static inline void diff_timeval(struct timeval *dest, struct timeval *left, struct timeval *right) { if ( (left->tv_sec < right->tv_sec) || ( (left->tv_sec == right->tv_sec) && (left->tv_usec < right->tv_usec))) { /* If left < right, just force to zero, don't allow negative numbers. */ dest->tv_sec = 0; dest->tv_usec = 0; return; } dest->tv_sec = left->tv_sec - right->tv_sec; dest->tv_usec = left->tv_usec - right->tv_usec; while (dest->tv_usec < 0) { dest->tv_usec += 1000000; dest->tv_sec--; } } os_handler_waiter_t *timer_waiter; int expect_timeout = 0; static void timeout_handler(void *cb_data, os_hnd_timer_id_t *id) { struct timeval *then = cb_data; struct timeval now; struct timeval diff; int rv; printf("Timeout!\n"); gettimeofday(&now, NULL); diff_timeval(&diff, &now, then); if (expect_timeout == 0) { expect_timeout++; if (diff.tv_sec != 1) err_leave(0, "Invalid timeout diff 0: %ld %ld\n", diff.tv_sec, diff.tv_usec); diff.tv_sec = 0; diff.tv_usec = 500000; *then = now; rv = test_os_hnd->start_timer(test_os_hnd, id, &diff, timeout_handler, then); } else if (expect_timeout == 1) { expect_timeout++; if (diff.tv_sec != 0) err_leave(0, "Invalid timeout diff 1: %ld %ld\n", diff.tv_sec, diff.tv_usec); os_handler_waiter_release(timer_waiter); } else { err_leave(0, "Unexpected timeout!\n"); } } static void test_os_handler(os_handler_t *os_hnd, os_handler_waiter_factory_t *factory) { os_hnd_timer_id_t *timer; struct timeval now; struct timeval tv; int rv; test_os_hnd = os_hnd; /* Override the default log handler (so I can catch them). */ os_hnd->set_log_handler(os_hnd, my_vlog); printf("Log test\n"); os_hnd->log(os_hnd, IPMI_LOG_FATAL, "This is a test: %d %s", 47, "Hello"); printf("Timer test\n"); timer_waiter = os_handler_alloc_waiter(factory); if (!timer_waiter) err_leave(0, "Unable to allocate waiter\n"); rv = os_hnd->alloc_timer(os_hnd, &timer); if (rv) err_leave(rv, "Unable to allocate timer"); gettimeofday(&now, NULL); tv.tv_sec = 1; tv.tv_usec = 500000; rv = os_hnd->start_timer(os_hnd, timer, &tv, timeout_handler, &now); tv.tv_sec = 3; tv.tv_usec = 0; os_handler_waiter_wait(timer_waiter, &tv); if (expect_timeout != 2) err_leave(0, "Error in timers: %d", expect_timeout); os_handler_free_waiter(timer_waiter); rv = os_handler_free_waiter_factory(factory); if (rv) err_leave(rv, "Error freeing factory\n"); os_hnd->free_os_handler(os_hnd); } static void reset_tests(void) { expect_log = 0; expect_timeout = 0; } int ipmi_malloc_init(os_handler_t *os_hnd); int main(int argc, char *argv[]) { os_handler_waiter_factory_t *factory; os_handler_t *os_hnd; int rv; printf("*** Testing TCL OS handler\n"); reset_tests(); os_hnd = ipmi_tcl_get_os_handler(0); if (!os_hnd) { fprintf(stderr, "ipmi_smi_setup_con: Unable to allocate os handler\n"); exit(1); } ipmi_malloc_init(os_hnd); rv = os_handler_alloc_waiter_factory(os_hnd, 0, 0, &factory); if (rv) err_leave(rv, "Unable to allocate waiter factory\n"); test_os_handler(os_hnd, factory); return 0; } openipmi-2.0.18/OpenIPMIcmdlang.pc.in0000644000175000017500000000043310300532522016225 0ustar chuckchuckprefix=@prefix@ exec_prefix=@prefix@ libdir=@libdir@ includedir=@includedir@ Name: OpenIPMIcmdlang Description: Command language for OpenIPMI Version: @VERSION@ Requires: OpenIPMIutils OpenIPMI Libs: -L${libdir} -lOpenIPMIutils -lOpenIPMI -lOpenIPMIcmdlang Cflags: -I${includedir} openipmi-2.0.18/configure.in0000644000175000017500000006223511367554405014731 0ustar chuckchuckAC_INIT(README.Force) AC_CONFIG_HEADER([config.h]) AC_CANONICAL_TARGET OPENIPMI_PKG_NAME=OpenIPMI OPENIPMI_VERSION_MAJOR=2 OPENIPMI_VERSION_MINOR=0 OPENIPMI_VERSION_RELEASE=18 OPENIPMI_VERSION_EXTRA= AM_INIT_AUTOMAKE(OpenIPMI, ${OPENIPMI_VERSION_MAJOR}.${OPENIPMI_VERSION_MINOR}.${OPENIPMI_VERSION_RELEASE}${OPENIPMI_VERSION_EXTRA}) OPENIPMI_SMI= case $target_os in linux*) AC_DEFINE([HAVE_OPENIPMI_SMI], [], [We have a local IPMI interface]) ;; cygwin*) AC_DEFINE([HAVE_CYGWIN_TARGET], [], [Running on CYGWIN]) ;; esac AC_SUBST(OPENIPMI_SMI) SNMPLIBS= # Where do we find the UCD SNMP includes and libs tryucdsnmp=yes AC_ARG_WITH(ucdsnmp, [ --with-ucdsnmp=PATH Look for ucdsnmp in PATH.], if test "x$withval" = "xyes"; then tryucdsnmp=yes elif test "x$withval" = "xno"; then tryucdsnmp=no elif test -d "$withval"; then CPPFLAGS="-I$withval/include $CPPFLAGS" SNMPLIBS="-L$withval/lib $SNMPLIBS" tryucdsnmp=yes fi, ) AC_ARG_WITH(snmpflags, [ --with-snmpflags=flags Set the flags to compile with SNMP.], CPPFLAGS="$withval $CPPFLAGS" ) AC_ARG_WITH(snmplibs, [ --with-snmplibs=libs Set the libraries to link with SNMP.], SNMPLIBS="$withval" ) POPTCFLAGS= AC_ARG_WITH(poptflags, [ --with-poptflags=flags Set the flags to compile with popt.], CPPFLAGS="$withval $CPPFLAGS" ) POPTCFLAGS= AC_ARG_WITH(poptlibs, [ --with-poptlibs=libs Set the libraries to link with popt.], POPTLIBS="$withval" ) # If UCD SNMP requires OpenSSL, this tells where to find the crypto lib tryopenssl=yes AC_ARG_WITH(openssl, [ --with-openssl[[=yes|no|PATH]] Look for openssl, with the optional path.], if test "x$withval" = "xyes"; then tryopenssl=yes elif test "x$withval" = "xno"; then tryopenssl=no elif test -d "$withval"; then SNMPLIBS="-L$withval/lib $SNMPLIBS" OPENSSLLIBS="-L$withval/lib" OPENSSLINCS="-I$withval/include" tryopenssl=yes fi, ) AC_ARG_WITH(opensslflags, [ --with-opensslflags=flags Set the flags to compile with OpenSSL.], OPENSSLINCS="$withval" ) AC_ARG_WITH(openssllibs, [ --with-openssllibs=libs Set the libraries to link with OpenSSL.], OPENSSLLIBS="$withval", ) tryglib=yes AC_ARG_WITH(glib, [ --with-glib=yes|no Look for glib.], if test "x$withval" = "xyes"; then tryglib=yes elif test "x$withval" = "xno"; then tryglib=no fi, ) glibver= AC_ARG_WITH(glibver, [ --with-glibver=ver Set the glib version, either 1.2 or 2.0.], glibver="$withval", ) glibcflags= AC_ARG_WITH(glibcflags, [ --with-glibcflags=flags Set the flags to compile with glib.], glibcflags="$withval", ) gliblibs= AC_ARG_WITH(gliblibs, [ --with-gliblibs=libs Set the libraries to link with glib.], gliblibs="$withval", ) tryglib12=yes AC_ARG_WITH(glib12, [ --with-glib12=yes|no Look for glib version 1.2.], if test "x$withval" = "xyes"; then tryglib12=yes elif test "x$withval" = "xno"; then tryglib12=no fi, ) glib12cflags= AC_ARG_WITH(glib12cflags, [ --with-glib12cflags=flags Set the flags to compile with glib 1.2.], glibcflags="$withval", ) gliblibs= AC_ARG_WITH(glib12libs, [ --with-glib12libs=libs Set the libraries to link with glib 1.2.], gliblibs="$withval", ) trytcl=yes AC_ARG_WITH(tcl, [ --with-tcl=yes|no Look for tcl.], if test "x$withval" = "xyes"; then trytcl=yes elif test "x$withval" = "xno"; then trytcl=no fi, ) tclcflags= AC_ARG_WITH(tclcflags, [ --with-tclcflags=flags Set the flags to compile with tcl.], tclcflags="$withval", ) tcllibs= AC_ARG_WITH(tcllibs, [ --with-tcllibs=libs Set the libraries to link with tcl.], tcllibs="$withval", ) tryperl=yes perldir= AC_ARG_WITH(perl, [ --with-perl[[=yes|no|PATH]] Look for perl, with the optional path.], if test "x$withval" = "xyes"; then tryperl=yes elif test "x$withval" = "xno"; then tryperl=no elif test -d "$withval"; then perldir="$withval" tryperl=yes fi, ) perlinstalldir= AC_ARG_WITH(perlinstall, [ --with-perlinstall=PATH Install perl modules in the given location.], perlinstalldir="$withval", ) perlcflags= AC_ARG_WITH(perlcflags, [ --with-perlcflags=PATH Use the given flags when compiling perl parts.], perlcflags="$withval", ) perlusepthreads= AC_ARG_WITH(perlusepthreads, [ --with-perlusepthreads[[=yes|no]] Use threads with perl.], if test "x$withval" = "xyes"; then perlusepthreads="yes" elif test "x$withval" = "xno"; then perlusepthreads="no" elif test "x$withval" = "x"; then perlusepthreads="yes" fi, ) trypython=yes AC_ARG_WITH(python, [ --with-python[[=yes|no|PATH]] Look for python, with the optional path.], if test "x$withval" = "xyes"; then trypython=yes elif test "x$withval" = "xno"; then trypython=no elif test -d "$withval"; then trypython=yes fi, ) pythoninstalldir= AC_ARG_WITH(pythoninstall, [ --with-pythoninstall=PATH Install python modules in the given location.], pythoninstalldir="$withval", ) pythoninstalllibdir= AC_ARG_WITH(pythoninstalllib, [ --with-pythoninstalllib=PATH Install python libraries in the given location.], pythoninstalllibdir="$withval", ) pythoncflags= AC_ARG_WITH(pythoncflags, [ --with-pythoncflags=PATH Use the given flags when compiling python parts.], pythoncflags="$withval", ) pythonusepthreads= AC_ARG_WITH(pythonusepthreads, [ --with-pythonusepthreads[[=yes|no]] Use threads with python.], if test "x$withval" = "xyes"; then pythonusepthreads="yes" elif test "x$withval" = "xno"; then pythonusepthreads="no" elif test "x$withval" = "x"; then pythonusepthreads="yes" fi, ) tkinter= AC_ARG_WITH(tkinter, [ --with-tkinter[[=yes|no]] GUI package for python.], if test "x$withval" = "xyes"; then tkinter="yes" elif test "x$withval" = "xno"; then tkinter="no" elif test "x$withval" = "x"; then tkinter="yes" fi, ) tryswig=yes swigprog= AC_ARG_WITH(swig, [ --with-swig[[=yes|no|PATH]] Look for swig, with the optional path.], if test "x$withval" = "x"; then tryswig=yes elif test "x$withval" = "xyes"; then tryswig=yes elif test "x$withval" = "xno"; then tryswig=no else swigprog=$withval fi, ) AC_PROG_CC AC_PROG_LIBTOOL AC_STDC_HEADERS AC_CHECK_FUNCS(getaddrinfo) AC_SUBST(OPENIPMI_VERSION_MAJOR) AC_SUBST(OPENIPMI_VERSION_MINOR) AC_SUBST(OPENIPMI_VERSION_RELEASE) AC_SUBST(OPENIPMI_VERSION_EXTRA) AC_SUBST(POPTLIBS) FOUND_POPT_HEADER=no AC_CHECK_HEADER(popt.h, FOUND_POPT_HEADER=yes; ) if test "x$FOUND_POPT_HEADER" != "xyes"; then echo "Could not find headers for the popt library" exit 1 fi if test "x$POPTLIBS" = "x"; then AC_CHECK_LIB(popt, poptHelpOptions, POPTLIBS=-lpopt) if test "x$POPTLIBS" = ""; then echo "Could not find the popt library" exit 1 fi fi # Check for GDBM have_gdbm_h="no" GDBM_LIB= AC_CHECK_HEADER(gdbm.h, have_gdbm_h="yes"; ) if test "x$have_gdbm_h" = "xyes"; then AC_CHECK_LIB(gdbm, gdbm_open, AC_DEFINE([HAVE_GDBM], [], [Have GDBM libraries]) GDBM_LIB=-lgdbm; ) fi AC_SUBST(GDBM_LIB) # Find pkg-config pkgprog= AC_PATH_PROG(pkgprog, pkg-config) # Handle GLIB support haveglib=no if test "x$glibver" = "x" -o "x$glibcflags" = "x" -o "x$gliblibs" = "x"; then glibprog= if test "x$tryglib" != "xno"; then if test "x$pkgprog" != "x"; then glibprog=$pkgprog else AC_PATH_PROG(glibprog, glib-config) fi fi GLIB_CFLAGS= GLIB_LIBS= if test "x$glibprog" != "x"; then # Try 2.0 first GLIB_CFLAGS=`$glibprog --cflags gthread-2.0 2>/dev/null` if test $? = 0; then haveglib=yes GLIB_VERSION='2.0' GLIB_LIBS=`$glibprog --libs gthread-2.0 2>/dev/null` else # Now try 1.2 GLIB_CFLAGS=`$glibprog --cflags gthread` if test $? = 0; then haveglib=yes GLIB_VERSION='1.2' GLIB_LIBS=`$glibprog --libs gthread` fi fi fi else haveglib=yes GLIB_CFLAGS="$glibcflags" GLIB_VERSION="$glibver" GLIB_LIBS="$gliblibs" fi echo "checking for glib... $haveglib" if test "x$haveglib" = "xyes"; then AC_DEFINE([HAVE_GLIB], [], [Have GLIB libraries]) GLIB_LIB='$(top_builddir)/glib/libOpenIPMIglib.la' GLIB_SO='$(top_builddir)/glib/.libs/libOpenIPMIglib.so' GLIB_PKGCONF=OpenIPMIglib.pc GLIB_TARGET=libOpenIPMIglib.la else GLIB_LIB= GLIB_SO= GLIB_PKGCONF= GLIB_TARGET= fi AC_SUBST(GLIB_VERSION) AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) AC_SUBST(GLIB_LIB) AC_SUBST(GLIB_SO) AC_SUBST(GLIB_PKGCONF) AC_SUBST(GLIB_TARGET) # We allow a glib 1.2 specific library, too. haveglib12=no if test "x$glib12cflags" = "x" -o "x$glib12libs" = "x"; then glibprog= if test "x$tryglib12" != "xno"; then AC_PATH_PROG(glibprog, glib-config) fi GLIB12_CFLAGS= GLIB12_LIBS= if test "x$glibprog" != "x"; then GLIB12_CFLAGS=`$glibprog --cflags gthread` if test $? = 0; then haveglib12=yes GLIB12_LIBS=`$glibprog --libs gthread` fi fi else haveglib12=yes GLIB12_CFLAGS="$glib12cflags" GLIB12_LIBS="$glib12libs" fi echo "checking for glib 1.2... $haveglib12" if test "x$haveglib12" = "xyes"; then AC_DEFINE([HAVE_GLIB12], [], [Have the GLIB 1.2 libraries]) GLIB12_LIB='$(top_builddir)/glib/libOpenIPMIglib12.la' GLIB12_SO='$(top_builddir)/glib/.libs/libOpenIPMIglib12.so' GLIB12_PKGCONF=OpenIPMIglib12.pc GLIB12_TARGET=libOpenIPMIglib12.la else GLIB12_LIB= GLIB12_SO= GLIB12_PKGCONF= GLIB12_TARGET= fi AC_SUBST(GLIB12_CFLAGS) AC_SUBST(GLIB12_LIBS) AC_SUBST(GLIB12_LIB) AC_SUBST(GLIB12_SO) AC_SUBST(GLIB12_PKGCONF) AC_SUBST(GLIB12_TARGET) if test "x$haveglib12" = "xyes" -o "x$haveglib" = "xyes"; then GLIB_DIR=glib # If we only have one glib library, just directly link with it in swig. # If we have two libraries, the swig code dynamically loads it and we # don't directly link with it. if test "x$haveglib12" = "xyes" -a "x$haveglib" = "xyes"; then GLIB_SINGLE_LIB= GLIB_SINGLE_SO= else if test "x$haveglib12" = "xyes"; then GLIB_SINGLE_LIB=$GLIB12_LIB GLIB_SINGLE_SO=$GLIB12_SO else GLIB_SINGLE_LIB=$GLIB_LIB GLIB_SINGLE_SO=$GLIB_SO fi fi else GLIB_DIR= GLIB_SINGLE_LIB= GLIB_SINGLE_SO= fi AC_SUBST(GLIB_DIR) AC_SUBST(GLIB_SINGLE_LIB) AC_SUBST(GLIB_SINGLE_SO) # Handle TCL support TCL_LIBS= TCL_CFLAGS= havetcl=no if test "x$trytcl" != "xno"; then FOUND_TCL_HEADER=no ver=`echo 'puts \$tcl_version' | tclsh` if test "x$tclcflags" = "x"; then AC_CHECK_HEADER(tcl.h, FOUND_TCL_HEADER=yes; ) if test "x$FOUND_TCL_HEADER" != "xyes"; then echo -n "checking for /usr/include/tcl$ver... " if test 'x$ver' != 'x' -a -d "/usr/include/tcl$ver"; then echo "yes" tclcflags="-I /usr/include/tcl$ver" TCL_CFLAGS="$tclcflags" FOUND_TCL_HEADER=yes else echo "no" fi fi else TCL_CFLAGS="$tclcflags" FOUND_TCL_HEADER=yes fi if test "x$tcllibs" = "x"; then if test "x$FOUND_TCL_HEADER" = "xyes"; then AC_CHECK_LIB(tcl, Tcl_DoOneEvent, TCL_LIBS=-ltcl) if test "x$TCL_LIBS" = "x"; then AC_CHECK_LIB(tcl$ver, Tcl_DoOneEvent, TCL_LIBS=-ltcl$ver) fi fi else TCL_LIBS="$tcllibs" fi if test "x$FOUND_TCL_HEADER" = "xyes" -a "x$TCL_LIBS" != "x"; then havetcl=yes fi fi echo "checking for tcl... $havetcl" if test "x$havetcl" == "xyes"; then OLDLIBS="$LIBS" LIBS="$LIBS $TCL_LIBS" AC_LINK_IFELSE([AC_LANG_CALL(, Tcl_GetTime)], [echo "Have Tcl_GetTime"], [echo "Redefine Tcl_GetTime as TclpGetTime"; AC_DEFINE([Tcl_GetTime], [TclpGetTime], [If no Tcl_GetTime, redefine as TclpGetTime])]) LIBS="$OLDLIBS" fi if test "x$havetcl" = "xyes"; then AC_DEFINE([HAVE_TCL], [], [Have TCL libraries]) TCL_LIB='$(top_builddir)/tcl/libOpenIPMItcl.la' TCL_SO='$(top_builddir)/tcl/.libs/libOpenIPMItcl.so' TCL_PKGCONF=OpenIPMItcl.pc TCL_TARGET=libOpenIPMItcl.la TCL_DIR=tcl else TCL_LIB= TCL_SO= TCL_PKGCONF= TCL_TARGET= TCL_DIR= fi AC_SUBST(TCL_CFLAGS) AC_SUBST(TCL_LIBS) AC_SUBST(TCL_LIB) AC_SUBST(TCL_SO) AC_SUBST(TCL_PKGCONF) AC_SUBST(TCL_TARGET) AC_SUBST(TCL_DIR) # Handle PERL support if test "x$perlcflags" = "x" -o "x$perlinstalldir" = "x"; then perlprog= if test "x$tryperl" != "xno"; then AC_PATH_PROG(perlprog, perl) fi if test "x$perlprog" != "x"; then # Find the place where perl lives. if test "x$perldir" = "x"; then perldir=`$perlprog -e 'for $i (@INC) { if (-r "$i/CORE/perl.h") { print "$i"; last; } }'` fi # Now find a proper installation location. if test "x$perlinstalldir" = "x"; then perlinstalldir=`(eval \`perl -V:installvendorarch\`; echo $installvendorarch)` if test "x$perlinstalldir" = "x" -o ! -d "$perlinstalldir"; then perlinstalldir=`$perlprog -e 'for $i (@INC) { if ($i =~ /site_perl\/.+\/.+/) { print "$i"; last; } }'` fi if test "x$perlinstalldir" = "x" -o ! -d "$perlinstalldir"; then perlinstalldir=`$perlprog -e 'for $i (@INC) { if ($i =~ /vendor_perl\/.+\/.+/) { print "$i"; last; } }'` fi if test "x$perlinstalldir" = "x" -o ! -d "$perlinstalldir"; then perlinstalldir=$perldir fi fi fi if test "x$perldir" != "x"; then tpprog=`$perlprog -e "\\$p = \"$perlinstalldir\"; \\$u = \"$prefix\"; \\$p =~ s/\\$u//; print \\$p"` AC_DEFINE([HAVE_PERL], [], [Have perl installed]) PERL_DIR=perl if test "x$perlcflags" = "x"; then PERL_CFLAGS="-I $perldir/CORE `$perlprog -V:ccflags | grep ccflags | sed 's/^.*ccflags=.\(.*\).;$/\1/'`" else PERL_CFLAGS="$perlcflags" fi if test "$tpprog" = "$perlinstalldir"; then PERL_INSTALL_DIR="$perlinstalldir" else PERL_INSTALL_DIR="\${prefix}$tpprog" fi else PERL_DIR= PERL_CFLAGS= PERL_INSTALL_DIR= PERL_HAS_POSIX_THREADS= PERL_POSIX_LIB= PERL_POSIX_SO= fi else AC_DEFINE([HAVE_PERL], [], [Have perl installed]) PERL_DIR=perl PERL_CFLAGS="$perlcflags" PERL_INSTALL_DIR="$perlinstalldir" fi if test "x$perlprog" != "x"; then if test "x$perlusepthreads" = "x"; then if $perlprog -V:usethreads | grep -q 'define'; then perlusepthreads="yes" fi fi echo "checking for perl threads... $perlusepthreads" fi if test "x$perlusepthreads" = "xyes"; then PERL_HAS_POSIX_THREADS=1 PERL_POSIX_LIB='$(top_builddir)/unix/libOpenIPMIpthread.la' PERL_POSIX_SO='$(top_builddir)/unix/.libs/libOpenIPMIpthread.so' else PERL_HAS_POSIX_THREADS=0 PERL_POSIX_LIB='$(top_builddir)/unix/libOpenIPMIposix.la' PERL_POSIX_SO='$(top_builddir)/unix/.libs/libOpenIPMIposix.so' fi AC_SUBST(PERL_DIR) AC_SUBST(PERL_CFLAGS) AC_SUBST(PERL_INSTALL_DIR) AC_SUBST(PERL_HAS_POSIX_THREADS) AC_SUBST(PERL_POSIX_LIB) AC_SUBST(PERL_POSIX_SO) # Handle PYTHON support if test "x$pythoncflags" = "x" -o "x$pythoninstalldir" = "x"; then pythonprog= if test "x$trypython" != "xno"; then AC_PATH_PROG(pythonprog, python) fi if test "x$pythonprog" != "x"; then # Now find a proper installation location. if test "x$pythoninstalldir" = "x"; then pythoninstalldir=`$pythonprog -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib();'` if test "x$pythoninstalldir" = "x" -o ! -d "$pythoninstalldir"; then pythoninstalldir= fi fi fi if test "x$pythoncflags" = "x"; then pythoninc=`$pythonprog -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_inc();'` if test "x$pythoninc" != "x"; then pythoncflags="-I$pythoninc" else pythoncflags="" fi else PYTHON_CFLAGS="$pythoncflags" fi if test "x$pythoninstalldir" != "x"; then if test "x$pythoninstalllibdir" = "x"; then pythoninstalllibdir=$pythoninstalldir fi AC_DEFINE([HAVE_PYTHON], [], [Have Python installed]) PYTHON_DIR=python PYTHON_CFLAGS="$pythoncflags" PYTHON_INSTALL_DIR="$pythoninstalldir" PYTHON_INSTALL_LIB_DIR="$pythoninstalllibdir" else PYTHON_DIR= PYTHON_CFLAGS= PYTHON_INSTALL_DIR= PYTHON_INSTALL_LIB_DIR= fi else if test "x$pythoninstalllibdir" = "x"; then pythoninstalllibdir=$pythoninstalldir fi AC_DEFINE([HAVE_PYTHON], [], [Have Python installed]) PYTHON_DIR=python PYTHON_CFLAGS="$pythoncflags" PYTHON_INSTALL_DIR="$pythoninstalldir" PYTHON_INSTALL_LIB_DIR="$pythoninstalllibdir" fi if test "x$pythonprog" != "x"; then if test "x$pythonusepthreads" = "x"; then pythonusepthreads=`echo -e "try:\n import thread\n print 'yes'\nexcept:\n print 'no'\n" | python` fi echo "checking for python threads... $pythonusepthreads" fi if test "x$pythonusepthreads" = "xyes"; then PYTHON_HAS_POSIX_THREADS=1 PYTHON_POSIX_LIB='$(top_builddir)/unix/libOpenIPMIpthread.la' PYTHON_POSIX_SO='$(top_builddir)/unix/.libs/libOpenIPMIpthread.so' else PYTHON_HAS_POSIX_THREADS=0 PYTHON_POSIX_LIB='$(top_builddir)/unix/libOpenIPMIposix.la' PYTHON_POSIX_SO='$(top_builddir)/unix/.libs/libOpenIPMIposix.so' fi AC_SUBST(PYTHON_DIR) AC_SUBST(PYTHON_CFLAGS) AC_SUBST(PYTHON_INSTALL_DIR) AC_SUBST(PYTHON_INSTALL_LIB_DIR) AC_SUBST(PYTHON_HAS_POSIX_THREADS) AC_SUBST(PYTHON_POSIX_LIB) AC_SUBST(PYTHON_POSIX_SO) # Check for Tkinter/Tix if test "x$tkinter" = "x"; then if test "x$pythonprog" != "x"; then tkinter=`echo -e "try:\n import Tix\n print 'yes'\nexcept:\n print 'no'\n" | python` fi fi echo "checking for tkinter... $tkinter" if test "x$tkinter" = "xyes"; then PYTHON_GUI_DIR=openipmigui else PYTHON_GUI_DIR= fi AC_SUBST(PYTHON_GUI_DIR) # Now check for swig if test "x$swigprog" = "x" -a "x$tryswig" = "xyes"; then AC_PATH_PROG(swigprog, swig) fi if test "x$swigprog" != "x"; then swigver=`$swigprog -version 2>&1 | grep 'SWIG Version' | sed 's/SWIG Version //'` swigmajor=`echo $swigver | sed 's/\.[[0-9]]*\.[[0-9]]*$//'` swigminor=`echo $swigver | sed 's/^[[0-9]]*\.\([[0-9]]*\)\.[[0-9]]*$/\1/'` swigrel=`echo $swigver | sed 's/^[[0-9]]*\.[[0-9]]*\.//'` if test '(' "$swigmajor" -lt 1 ')' -o '(' '(' "$swigmajor" -eq 1 ')' -a '(' "$swigminor" -lt 3 ')' ')' -o '(' '(' "$swigmajor" -eq 1 ')' -a '(' "$swigminor" -eq 3 ')' -a '(' "$swigrel" -lt 21 ')' ')'; then echo "***swig must be version 1.3.21 or greater, disabling swig and perl/python" else echo "swig version $swigver" AC_DEFINE([HAVE_SWIG], [], [Have swig installed]) SWIG_DIR=swig SWIG=$swigprog fi else SWIG_DIR= SWIG= fi AC_SUBST(SWIG_DIR) AC_SUBST(SWIG) # Handle SNMP support if test "x$tryucdsnmp" != "xno"; then HAVE_UCDSNMP=no HAVE_NETSNMP=no FOUND_SNMPINCL=no # Try net snmp first AC_CHECK_HEADER(net-snmp/net-snmp-config.h, FOUND_SNMPINCL=yes; HAVE_NETSNMP=yes; ) if test "x$FOUND_SNMPINCL" = "xno"; then # Try old UCD snmp AC_CHECK_HEADER(snmp_api.h, FOUND_SNMPINCL=yes; ) if test "x$FOUND_SNMPINCL" = "xno"; then AC_CHECK_HEADER(ucd-snmp/snmp_api.h, FOUND_SNMPINCL=yes; AC_DEFINE([HAVE_ALT_UCDSNMP_DIR], [], [Alternate UCD SMP directory])) fi fi if test "x$FOUND_SNMPINCL" = "xyes"; then if test "x$HAVE_NETSNMP" = "xyes"; then AC_CHECK_LIB(netsnmp, snmp_add, SNMPLIBS="-lnetsnmp $SNMPLIBS" AC_DEFINE([HAVE_UCDSNMP], [], [Have UCD SNMP]) AC_DEFINE([HAVE_NETSNMP], [], [Have Net SNMP]) HAVE_UCDSNMP=yes HAVE_NETSNMP=yes, , $SNMPLIBS) if test "x$HAVE_UCDSNMP" = "xno"; then # Try net snmp with crypto AC_CHECK_LIB(netsnmp, snmp_add_full, SNMPLIBS="-lnetsnmp -lcrypto $SNMPLIBS" AC_DEFINE([HAVE_UCDSNMP], [], [Have UCD SNMP]) AC_DEFINE([HAVE_NETSNMP], [], [Have Net SNMP]) HAVE_UCDSNMP=yes HAVE_NETSNMP=yes, , -lcrypto $SNMPLIBS) fi if test "x$HAVE_UCDSNMP" = "xno"; then AC_MSG_WARN([Found NET SNMP include files, but could not find libraries]) fi else AC_CHECK_LIB(snmp, snmp_open_ex, SNMPLIBS="-lsnmp $SNMPLIBS" AC_DEFINE([HAVE_UCDSNMP], [], [Have UCD SNMP]) HAVE_UCDSNMP=yes, , $SNMPLIBS) if test "x$HAVE_UCDSNMP" = "xno"; then # Try with the crypto lib AC_CHECK_LIB(snmp, snmp_sess_perror, SNMPLIBS="-lsnmp -lcrypto $SNMPLIBS" AC_DEFINE([HAVE_UCDSNMP], [], [Have UCD SNMP]) HAVE_UCDSNMP=yes, , -lcrypto $SNMPLIBS) fi if test "x$HAVE_UCDSNMP" = "xno"; then AC_MSG_WARN([Found UCD SNMP include files, but could not find libraries]) fi fi fi fi AC_SUBST(SNMPLIBS) # Handle SNMP support if test "x$tryopenssl" != "xno"; then HAVE_OPENSSL=no # Try net snmp first AC_CHECK_HEADER(openssl/crypto.h, FOUND_OPENSSL=yes; ) if test "x$FOUND_OPENSSL" = "xyes"; then AC_CHECK_LIB(crypto, CRYPTO_malloc, OPENSSLLIBS="-lcrypto $OPENSSLLIBS" AC_DEFINE([HAVE_OPENSSL], [], [Have the openssl libraries]) HAVE_OPENSSL=yes, , $OPENSSLLIBS) fi fi AC_SUBST(OPENSSLLIBS) AC_SUBST(OPENSSLINCS) AC_HAVE_FUNCS(syslog) # Now check for dia and the dia version. They changed the output format # specifier without leaving backwards-compatible handling, so lots of ugly # checks here. DIA= AC_PATH_PROG(diaprog, dia) if test "x$diaprog" != "x"; then diaver=`$diaprog --version | sed 's/Dia version \([[^,]]*\), .*$/\1/'` tmp=`echo $diaver | sed 's/^[[0-9.]]\+$//'` if test "x$diaver" == "x" -o "x$tmp" != 'x'; then # Couldn't get the dia version, give up. echo "Couldn't determine the dia version from '$diaver'" else DIA="$diaprog" diaver_major=`echo $diaver | sed 's/\.[[0-9.]]\+$//'` diaver_minor=`echo $diaver | sed 's/^[[0-9]]\+\.//' | sed 's/\.[[0-9.]]\+$//'` echo "dia version is $diaver_major.$diaver_minor" if test $diaver_major -lt 1 -a $diaver_minor -lt 95; then # 0.94 and below use --export-to-format DIA_FILTER_NAME=--export-to-format else DIA_FILTER_NAME=--filter fi fi fi LATEX= BIBTEX= DVIPDF= AC_PATH_PROG(LATEX, latex) AC_PATH_PROG(BIBTEX, bibtex) AC_PATH_PROG(DVIPDF, dvipdf) if test "x$DIA" == "x" -o "x$LATEX" == "x" -o "x$BIBTEX" == "x" -o "x$DVIPDF" == "x"; then echo "dia, latex, bibtex, and/or dvipdf is not present or not valid, you cannot regenerate documentation" echo "The documentation comes already generated, so this is generally not a problem" fi AC_SUBST(DIA) AC_SUBST(DIA_FILTER_NAME) AC_SUBST(LATEX) AC_SUBST(BIBTEX) AC_SUBST(DVIPDF) OPENIPMI_SWIG_LIBS="${PYTHON_POSIX_LIB} \$(top_builddir)/lib/libOpenIPMI.la \$(top_builddir)/utils/libOpenIPMIutils.la \$(top_builddir)/cmdlang/libOpenIPMIcmdlang.la ${GLIB_SINGLE_LIB} ${TCL_LIB}" OPENIPMI_SWIG_SO="${PYTHON_POSIX_SO}:\$(top_builddir)/lib/.libs/libOpenIPMI.so:\$(top_builddir)/utils/.libs/libOpenIPMIutils.so:\$(top_builddir)/cmdlang/.libs/libOpenIPMIcmdlang.so:${GLIB_SINGLE_SO}:${TCL_SO}" AC_SUBST(OPENIPMI_SWIG_LIBS) AC_SUBST(OPENIPMI_SWIG_SO) # Everything from here to AC_OUTPUT is for libedit # AC_PROG_LIBTOOL runs AC_CANONICAL_HOST case $host in *-sun-*) AC_DEFINE([_SUNOS], [], [Solaris's term.h does horrid things.]);; esac AC_CHECK_LIB(curses, tgetent, TERM_LIBS=-lcurses, [AC_CHECK_LIB(ncurses, tgetent, TERM_LIBS=-lncurses, [AC_MSG_ERROR([libtermcap, libcurses or libncurses are required!])] )] ) # Checks for header files. AC_FUNC_ALLOCA AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/ioctl.h sys/param.h termios.h unistd.h curses.h ncurses.h sys/cdefs.h]) ## include curses.h to prevent "Present But Cannot Be Compiled" AC_CHECK_HEADERS([term.h],,, [[#if HAVE_CURSES_H # include #elif HAVE_NCURSES_H # include #endif ]]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T AC_CHECK_TYPES([u_int32_t]) # Checks for library functions. AC_FUNC_CLOSEDIR_VOID AC_FUNC_FORK AC_CHECK_FUNCS(strlcpy strlcat fgetln) AC_PROG_GCC_TRADITIONAL ## _AIX is offended by rpl_malloc and rpl_realloc #AC_FUNC_MALLOC #AC_FUNC_REALLOC AC_TYPE_SIGNAL AC_FUNC_STAT AC_CHECK_FUNCS([endpwent isascii memchr memset re_comp regcomp strcasecmp strchr strcspn strdup strerror strrchr strstr strtol issetugid]) EL_GETPW_R_POSIX EL_GETPW_R_DRAFT AC_SUBST(TERM_LIBS) # End of libedit inclusions AC_OUTPUT(Makefile utils/Makefile lib/Makefile unix/Makefile glib/Makefile tcl/Makefile ui/Makefile lanserv/Makefile lanserv/OpenIPMI/Makefile sample/Makefile doc/Makefile man/Makefile swig/Makefile swig/perl/Makefile swig/python/Makefile swig/python/openipmigui/Makefile libedit/Makefile cmdlang/Makefile include/Makefile include/OpenIPMI/Makefile include/OpenIPMI/ipmiif.h include/OpenIPMI/internal/Makefile include/linux/Makefile OpenIPMI.spec OpenIPMIutils.pc OpenIPMI.pc OpenIPMIpthread.pc OpenIPMIposix.pc OpenIPMIglib.pc OpenIPMIglib12.pc OpenIPMItcl.pc OpenIPMIcmdlang.pc OpenIPMIui.pc) openipmi-2.0.18/INSTALL0000644000175000017500000002243210405724024013430 0ustar chuckchuckInstallation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Here is a another example: /bin/bash ./configure CONFIG_SHELL=/bin/bash Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent configuration-related scripts to be executed by `/bin/bash'. `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. openipmi-2.0.18/configure0000755000175000017500000321510111367554433014323 0ustar chuckchuck#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac echo=${ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$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 && echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi tagnames=${tagnames+${tagnames},}CXX tagnames=${tagnames+${tagnames},}F77 exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="README.Force" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar OPENIPMI_SMI CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED GREP EGREP LN_S ECHO AR RANLIB DSYMUTIL NMEDIT CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL OPENIPMI_VERSION_MAJOR OPENIPMI_VERSION_MINOR OPENIPMI_VERSION_RELEASE OPENIPMI_VERSION_EXTRA POPTLIBS GDBM_LIB pkgprog glibprog GLIB_VERSION GLIB_CFLAGS GLIB_LIBS GLIB_LIB GLIB_SO GLIB_PKGCONF GLIB_TARGET GLIB12_CFLAGS GLIB12_LIBS GLIB12_LIB GLIB12_SO GLIB12_PKGCONF GLIB12_TARGET GLIB_DIR GLIB_SINGLE_LIB GLIB_SINGLE_SO TCL_CFLAGS TCL_LIBS TCL_LIB TCL_SO TCL_PKGCONF TCL_TARGET TCL_DIR perlprog PERL_DIR PERL_CFLAGS PERL_INSTALL_DIR PERL_HAS_POSIX_THREADS PERL_POSIX_LIB PERL_POSIX_SO pythonprog PYTHON_DIR PYTHON_CFLAGS PYTHON_INSTALL_DIR PYTHON_INSTALL_LIB_DIR PYTHON_HAS_POSIX_THREADS PYTHON_POSIX_LIB PYTHON_POSIX_SO PYTHON_GUI_DIR swigprog SWIG_DIR SWIG SNMPLIBS OPENSSLLIBS OPENSSLINCS diaprog LATEX BIBTEX DVIPDF DIA DIA_FILTER_NAME OPENIPMI_SWIG_LIBS OPENIPMI_SWIG_SO ALLOCA LIBOBJS TERM_LIBS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC CXXCPP F77 FFLAGS' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-ucdsnmp=PATH Look for ucdsnmp in PATH. --with-snmpflags=flags Set the flags to compile with SNMP. --with-snmplibs=libs Set the libraries to link with SNMP. --with-poptflags=flags Set the flags to compile with popt. --with-poptlibs=libs Set the libraries to link with popt. --with-openssl[=yes|no|PATH] Look for openssl, with the optional path. --with-opensslflags=flags Set the flags to compile with OpenSSL. --with-openssllibs=libs Set the libraries to link with OpenSSL. --with-glib=yes|no Look for glib. --with-glibver=ver Set the glib version, either 1.2 or 2.0. --with-glibcflags=flags Set the flags to compile with glib. --with-gliblibs=libs Set the libraries to link with glib. --with-glib12=yes|no Look for glib version 1.2. --with-glib12cflags=flags Set the flags to compile with glib 1.2. --with-glib12libs=libs Set the libraries to link with glib 1.2. --with-tcl=yes|no Look for tcl. --with-tclcflags=flags Set the flags to compile with tcl. --with-tcllibs=libs Set the libraries to link with tcl. --with-perl[=yes|no|PATH] Look for perl, with the optional path. --with-perlinstall=PATH Install perl modules in the given location. --with-perlcflags=PATH Use the given flags when compiling perl parts. --with-perlusepthreads[=yes|no] Use threads with perl. --with-python[=yes|no|PATH] Look for python, with the optional path. --with-pythoninstall=PATH Install python modules in the given location. --with-pythoninstalllib=PATH Install python libraries in the given location. --with-pythoncflags=PATH Use the given flags when compiling python parts. --with-pythonusepthreads[=yes|no] Use threads with python. --with-tkinter[=yes|no] GUI package for python. --with-swig[=yes|no|PATH] Look for swig, with the optional path. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] --with-tags[=TAGS] include additional configurations [automatic] Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6; } if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6; } if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6; } if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 echo "$as_me: error: invalid value of canonical target" >&2;} { (exit 1); exit 1; }; };; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- OPENIPMI_PKG_NAME=OpenIPMI OPENIPMI_VERSION_MAJOR=2 OPENIPMI_VERSION_MINOR=0 OPENIPMI_VERSION_RELEASE=18 OPENIPMI_VERSION_EXTRA= am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm -f conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$AWK" && break done { echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } SET_MAKE= else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=OpenIPMI VERSION=${OPENIPMI_VERSION_MAJOR}.${OPENIPMI_VERSION_MINOR}.${OPENIPMI_VERSION_RELEASE}${OPENIPMI_VERSION_EXTRA} cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' OPENIPMI_SMI= case $target_os in linux*) cat >>confdefs.h <<\_ACEOF #define HAVE_OPENIPMI_SMI _ACEOF ;; cygwin*) cat >>confdefs.h <<\_ACEOF #define HAVE_CYGWIN_TARGET _ACEOF ;; esac SNMPLIBS= # Where do we find the UCD SNMP includes and libs tryucdsnmp=yes # Check whether --with-ucdsnmp was given. if test "${with_ucdsnmp+set}" = set; then withval=$with_ucdsnmp; if test "x$withval" = "xyes"; then tryucdsnmp=yes elif test "x$withval" = "xno"; then tryucdsnmp=no elif test -d "$withval"; then CPPFLAGS="-I$withval/include $CPPFLAGS" SNMPLIBS="-L$withval/lib $SNMPLIBS" tryucdsnmp=yes fi fi # Check whether --with-snmpflags was given. if test "${with_snmpflags+set}" = set; then withval=$with_snmpflags; CPPFLAGS="$withval $CPPFLAGS" fi # Check whether --with-snmplibs was given. if test "${with_snmplibs+set}" = set; then withval=$with_snmplibs; SNMPLIBS="$withval" fi POPTCFLAGS= # Check whether --with-poptflags was given. if test "${with_poptflags+set}" = set; then withval=$with_poptflags; CPPFLAGS="$withval $CPPFLAGS" fi POPTCFLAGS= # Check whether --with-poptlibs was given. if test "${with_poptlibs+set}" = set; then withval=$with_poptlibs; POPTLIBS="$withval" fi # If UCD SNMP requires OpenSSL, this tells where to find the crypto lib tryopenssl=yes # Check whether --with-openssl was given. if test "${with_openssl+set}" = set; then withval=$with_openssl; if test "x$withval" = "xyes"; then tryopenssl=yes elif test "x$withval" = "xno"; then tryopenssl=no elif test -d "$withval"; then SNMPLIBS="-L$withval/lib $SNMPLIBS" OPENSSLLIBS="-L$withval/lib" OPENSSLINCS="-I$withval/include" tryopenssl=yes fi fi # Check whether --with-opensslflags was given. if test "${with_opensslflags+set}" = set; then withval=$with_opensslflags; OPENSSLINCS="$withval" fi # Check whether --with-openssllibs was given. if test "${with_openssllibs+set}" = set; then withval=$with_openssllibs; OPENSSLLIBS="$withval" fi tryglib=yes # Check whether --with-glib was given. if test "${with_glib+set}" = set; then withval=$with_glib; if test "x$withval" = "xyes"; then tryglib=yes elif test "x$withval" = "xno"; then tryglib=no fi fi glibver= # Check whether --with-glibver was given. if test "${with_glibver+set}" = set; then withval=$with_glibver; glibver="$withval" fi glibcflags= # Check whether --with-glibcflags was given. if test "${with_glibcflags+set}" = set; then withval=$with_glibcflags; glibcflags="$withval" fi gliblibs= # Check whether --with-gliblibs was given. if test "${with_gliblibs+set}" = set; then withval=$with_gliblibs; gliblibs="$withval" fi tryglib12=yes # Check whether --with-glib12 was given. if test "${with_glib12+set}" = set; then withval=$with_glib12; if test "x$withval" = "xyes"; then tryglib12=yes elif test "x$withval" = "xno"; then tryglib12=no fi fi glib12cflags= # Check whether --with-glib12cflags was given. if test "${with_glib12cflags+set}" = set; then withval=$with_glib12cflags; glibcflags="$withval" fi gliblibs= # Check whether --with-glib12libs was given. if test "${with_glib12libs+set}" = set; then withval=$with_glib12libs; gliblibs="$withval" fi trytcl=yes # Check whether --with-tcl was given. if test "${with_tcl+set}" = set; then withval=$with_tcl; if test "x$withval" = "xyes"; then trytcl=yes elif test "x$withval" = "xno"; then trytcl=no fi fi tclcflags= # Check whether --with-tclcflags was given. if test "${with_tclcflags+set}" = set; then withval=$with_tclcflags; tclcflags="$withval" fi tcllibs= # Check whether --with-tcllibs was given. if test "${with_tcllibs+set}" = set; then withval=$with_tcllibs; tcllibs="$withval" fi tryperl=yes perldir= # Check whether --with-perl was given. if test "${with_perl+set}" = set; then withval=$with_perl; if test "x$withval" = "xyes"; then tryperl=yes elif test "x$withval" = "xno"; then tryperl=no elif test -d "$withval"; then perldir="$withval" tryperl=yes fi fi perlinstalldir= # Check whether --with-perlinstall was given. if test "${with_perlinstall+set}" = set; then withval=$with_perlinstall; perlinstalldir="$withval" fi perlcflags= # Check whether --with-perlcflags was given. if test "${with_perlcflags+set}" = set; then withval=$with_perlcflags; perlcflags="$withval" fi perlusepthreads= # Check whether --with-perlusepthreads was given. if test "${with_perlusepthreads+set}" = set; then withval=$with_perlusepthreads; if test "x$withval" = "xyes"; then perlusepthreads="yes" elif test "x$withval" = "xno"; then perlusepthreads="no" elif test "x$withval" = "x"; then perlusepthreads="yes" fi fi trypython=yes # Check whether --with-python was given. if test "${with_python+set}" = set; then withval=$with_python; if test "x$withval" = "xyes"; then trypython=yes elif test "x$withval" = "xno"; then trypython=no elif test -d "$withval"; then trypython=yes fi fi pythoninstalldir= # Check whether --with-pythoninstall was given. if test "${with_pythoninstall+set}" = set; then withval=$with_pythoninstall; pythoninstalldir="$withval" fi pythoninstalllibdir= # Check whether --with-pythoninstalllib was given. if test "${with_pythoninstalllib+set}" = set; then withval=$with_pythoninstalllib; pythoninstalllibdir="$withval" fi pythoncflags= # Check whether --with-pythoncflags was given. if test "${with_pythoncflags+set}" = set; then withval=$with_pythoncflags; pythoncflags="$withval" fi pythonusepthreads= # Check whether --with-pythonusepthreads was given. if test "${with_pythonusepthreads+set}" = set; then withval=$with_pythonusepthreads; if test "x$withval" = "xyes"; then pythonusepthreads="yes" elif test "x$withval" = "xno"; then pythonusepthreads="no" elif test "x$withval" = "x"; then pythonusepthreads="yes" fi fi tkinter= # Check whether --with-tkinter was given. if test "${with_tkinter+set}" = set; then withval=$with_tkinter; if test "x$withval" = "xyes"; then tkinter="yes" elif test "x$withval" = "xno"; then tkinter="no" elif test "x$withval" = "x"; then tkinter="yes" fi fi tryswig=yes swigprog= # Check whether --with-swig was given. if test "${with_swig+set}" = set; then withval=$with_swig; if test "x$withval" = "x"; then tryswig=yes elif test "x$withval" = "xyes"; then tryswig=yes elif test "x$withval" = "xno"; then tryswig=no else swigprog=$withval fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi { echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi { echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; } if test "${lt_cv_path_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done fi SED=$lt_cv_path_SED { echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6; } { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } else { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; } if test "${lt_cv_ld_reload_flag+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_reload_flag='-r' fi { echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac { echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; } if test "${lt_cv_path_NM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi { echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 echo "${ECHO_T}$lt_cv_path_NM" >&6; } NM="$lt_cv_path_NM" { echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6; } fi { echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; } if test "${lt_cv_deplibs_check_method+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; 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. 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 lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; } file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 4763 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; } if test "${lt_cv_cc_needs_belf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu depcc="$CXX" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; } if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { echo "$as_me:$LINENO: result: $CXXCPP" >&5 echo "${ECHO_T}$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then { echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_F77" && break done if test "x$ac_ct_F77" = x; then F77="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac F77=$ac_ct_F77 fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F { echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; } if test "${ac_cv_f77_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; } ac_ext=$ac_save_ext ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= { echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_f77_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else FFLAGS=-g cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_f77_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_f77_g=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; } if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi G77=`test $ac_compiler_gnu = yes && echo yes` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! # find the maximum length of command line arguments { echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; } if test "${lt_cv_sys_max_cmd_len+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; } else { echo "$as_me:$LINENO: result: none" >&5 echo "${ECHO_T}none" >&6; } fi # Check for command to grab the raw symbol name followed by C symbol from nm. { echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; } if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; linux* | k*bsd*-gnu) if test "$host_cpu" = ia64; then symcode='[ABCDGIRSTW]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Now try to grab the symbols. nlist=conftest.nm if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { echo "$as_me:$LINENO: result: failed" >&5 echo "${ECHO_T}failed" >&6; } else { echo "$as_me:$LINENO: result: ok" >&5 echo "${ECHO_T}ok" >&6; } fi { echo "$as_me:$LINENO: checking for objdir" >&5 echo $ECHO_N "checking for objdir... $ECHO_C" >&6; } if test "${lt_cv_objdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 echo "${ECHO_T}$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="${ac_tool_prefix}ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done 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 case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; } if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { echo "$as_me:$LINENO: checking for file" >&5 echo $ECHO_N "checking for file... $ECHO_C" >&6; } if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_DSYMUTIL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # 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_DSYMUTIL="${ac_tool_prefix}dsymutil" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { echo "$as_me:$LINENO: result: $DSYMUTIL" >&5 echo "${ECHO_T}$DSYMUTIL" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # 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_DSYMUTIL="dsymutil" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5 echo "${ECHO_T}$ac_ct_DSYMUTIL" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_NMEDIT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # 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_NMEDIT="${ac_tool_prefix}nmedit" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { echo "$as_me:$LINENO: result: $NMEDIT" >&5 echo "${ECHO_T}$NMEDIT" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # 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_NMEDIT="nmedit" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5 echo "${ECHO_T}$ac_ct_NMEDIT" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi { echo "$as_me:$LINENO: checking for -single_module linker flag" >&5 echo $ECHO_N "checking for -single_module linker flag... $ECHO_C" >&6; } if test "${lt_cv_apple_cc_single_mod+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. echo "int foo(void){return 1;}" > conftest.c $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib ${wl}-single_module conftest.c if test -f libconftest.dylib; then lt_cv_apple_cc_single_mod=yes rm -rf libconftest.dylib* fi rm conftest.c fi fi { echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5 echo "${ECHO_T}$lt_cv_apple_cc_single_mod" >&6; } { echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5 echo $ECHO_N "checking for -exported_symbols_list linker flag... $ECHO_C" >&6; } if test "${lt_cv_ld_exported_symbols_list+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then lt_cv_ld_exported_symbols_list=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5 echo "${ECHO_T}$lt_cv_ld_exported_symbols_list" >&6; } case $host_os in rhapsody* | darwin1.[0123]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}" fi if test "$DSYMUTIL" != ":"; then _lt_dsymutil="~$DSYMUTIL \$lib || :" else _lt_dsymutil= fi ;; esac enable_dlopen=no enable_win32_dll=no # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Check whether --with-pic was given. if test "${with_pic+set}" = set; then withval=$with_pic; pic_mode="$withval" else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm -r conftest* lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' { echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:7816: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:7820: \$? = $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 "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 fi fi $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= { echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' ;; esac ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; *) case `$CC -V 2>&1 | sed 5q` in *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 ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 echo "${ECHO_T}$lt_prog_compiler_pic" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8106: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:8110: \$? = $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 "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 fi fi $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" 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 "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 fi else lt_cv_prog_compiler_static_works=yes fi fi $rm -r conftest* LDFLAGS="$save_LDFLAGS" fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8210: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:8214: \$? = $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 "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 fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6; } if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } runpath_var= allow_undefined_flag= enable_shared_with_static_runtimes=no archive_cmds= archive_expsym_cmds= old_archive_From_new_cmds= old_archive_from_expsyms_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported link_all_deplibs=unknown hardcode_automatic=no module_cmds= module_expsym_cmds= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -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' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= 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; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; 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' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; 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; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; *) tmp_sharedflag='-shared' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; 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~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi link_all_deplibs=no else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then 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 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext 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 echo "${wl}${allow_undefined_flag}"; 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' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then 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 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext 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' # 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' fi fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='' link_all_deplibs=yes if test "$GCC" = yes ; then 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}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs=no ;; esac fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) 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 if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) 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 ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld='-rpath $libdir' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi { echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl 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:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 echo "${ECHO_T}$archive_cmds_need_lc" >&6; } ;; esac fi ;; esac { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac 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 -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= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ 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 ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`echo $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # 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;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec" fi sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec" fi sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var" || \ test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { echo "$as_me:$LINENO: result: $hardcode_action" >&5 echo "${ECHO_T}$hardcode_action" >&6; } if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi striplib= old_striplib= { echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi ;; *) { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } ;; esac fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) { echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; } if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_shl_load || defined __stub___shl_load choke me #endif int main () { return shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6; } if test $ac_cv_func_shl_load = yes; then lt_cv_dlopen="shl_load" else { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; } if test "${ac_cv_lib_dld_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; } if test $ac_cv_lib_dld_shl_load = yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else { echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; } if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_dlopen || defined __stub___dlopen choke me #endif int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6; } if test $ac_cv_func_dlopen = yes; then lt_cv_dlopen="dlopen" else { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; } if test "${ac_cv_lib_svld_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; } if test $ac_cv_lib_svld_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; } if test "${ac_cv_lib_dld_dld_link+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; } if test $ac_cv_lib_dld_dld_link = yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; } if test "${lt_cv_dlopen_self+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 echo "${ECHO_T}$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; } if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); } EOF if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Report which library types will actually be built { echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6; } { echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6; } { echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6; } # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler \ CC \ LD \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_prog_compiler_no_builtin_flag \ export_dynamic_flag_spec \ thread_safe_flag_spec \ whole_archive_flag_spec \ enable_shared_with_static_runtimes \ old_archive_cmds \ old_archive_from_new_cmds \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ compiler_lib_search_dirs \ archive_cmds \ archive_expsym_cmds \ postinstall_cmds \ postuninstall_cmds \ old_archive_from_expsyms_cmds \ allow_undefined_flag \ no_undefined_flag \ export_symbols_cmds \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ hardcode_automatic \ module_cmds \ module_expsym_cmds \ lt_cv_prog_compiler_c_o \ fix_srcfile_path \ exclude_expsyms \ include_expsyms; do case $var in old_archive_cmds | \ old_archive_from_new_cmds | \ archive_cmds | \ archive_expsym_cmds | \ module_cmds | \ module_expsym_cmds | \ old_archive_from_expsyms_cmds | \ export_symbols_cmds | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="${ofile}T" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 $rm -f "$cfgfile" { echo "$as_me:$LINENO: creating $ofile" >&5 echo "$as_me: creating $ofile" >&6;} cat <<__EOF__ >> "$cfgfile" #! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # 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 # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps # The directories searched by this compiler when creating a shared # library compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # ### END LIBTOOL CONFIG __EOF__ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" # Check whether --with-tags was given. if test "${with_tags+set}" = set; then withval=$with_tags; tagnames="$withval" fi if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} else { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} fi fi if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in "") ;; *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 echo "$as_me: error: invalid tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} { (exit 1); exit 1; }; } fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= compiler_lib_search_dirs_CXX= # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { echo "$as_me:$LINENO: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } else { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 echo "${ECHO_T}$LD" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then 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 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then 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 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_CXX="\$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' fi fi ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--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... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported whole_archive_flag_spec_CXX='' link_all_deplibs_CXX=yes allow_undefined_flag_CXX="$_lt_dar_allow_undefined" if test "$GXX" = yes ; then output_verbose_link_cmd='echo' archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds_CXX="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}" module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" if test "$lt_cv_apple_cc_single_mod" != "yes"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_CXX=no ;; esac fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${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 # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$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' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${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++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='${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' # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. 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 # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd='echo' else ld_shlibs_CXX=no fi ;; osf3*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes 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 # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" cat > conftest.$ac_ext <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no # The `*' in the case matches for architectures that use `case' in # $output_verbose_cmd can trigger glob expansion during the loop # eval without this substitution. output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` for p in `eval $output_verbose_link_cmd`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" \ || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $rm -f confest.$objext compiler_lib_search_dirs_CXX= if test -n "$compiler_lib_search_path_CXX"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= { echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' ;; esac ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; icpc* | ecpc*) # Intel C++ lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:13088: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:13092: \$? = $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 "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_CXX=yes fi fi $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" 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 "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_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $rm -r conftest* LDFLAGS="$save_LDFLAGS" fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_CXX" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_static_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_CXX=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:13192: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:13196: \$? = $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 "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_CXX=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6; } if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in 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 if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' ;; linux* | k*bsd*-gnu) link_all_deplibs_CXX=no ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' { echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_CXX=no else archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; } ;; esac fi ;; esac { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # 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;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec" fi sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec" fi sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || \ test -n "$runpath_var_CXX" || \ test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 echo "${ECHO_T}$hardcode_action_CXX" >&6; } if test "$hardcode_action_CXX" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_CXX \ CC_CXX \ LD_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_static_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ export_dynamic_flag_spec_CXX \ thread_safe_flag_spec_CXX \ whole_archive_flag_spec_CXX \ enable_shared_with_static_runtimes_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX \ compiler_lib_search_dirs_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ postinstall_cmds_CXX \ postuninstall_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ export_symbols_cmds_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ hardcode_automatic_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ lt_cv_prog_compiler_c_o_CXX \ fix_srcfile_path_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX; do case $var in old_archive_cmds_CXX | \ old_archive_from_new_cmds_CXX | \ archive_cmds_CXX | \ archive_expsym_cmds_CXX | \ module_cmds_CXX | \ module_expsym_cmds_CXX | \ old_archive_from_expsyms_cmds_CXX | \ export_symbols_cmds_CXX | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU C compiler? with_gcc=$GCC_CXX # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_CXX # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_CXX old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_CXX # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_CXX # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_CXX # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_CXX # The directories searched by this compiler when creating a shared # library compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_CXX # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu archive_cmds_need_lc_F77=no allow_undefined_flag_F77= always_export_symbols_F77=no archive_expsym_cmds_F77= export_dynamic_flag_spec_F77= hardcode_direct_F77=no hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_minus_L_F77=no hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= link_all_deplibs_F77=unknown old_archive_cmds_F77=$old_archive_cmds no_undefined_flag_F77= whole_archive_flag_spec_F77= enable_shared_with_static_runtimes_F77=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o objext_F77=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm -r conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` { echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $can_build_shared" >&5 echo "${ECHO_T}$can_build_shared" >&6; } { echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { echo "$as_me:$LINENO: result: $enable_shared" >&5 echo "${ECHO_T}$enable_shared" >&6; } { echo "$as_me:$LINENO: checking whether to build static libraries" >&5 echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6; } GCC_F77="$G77" LD_F77="$LD" lt_prog_compiler_wl_F77= lt_prog_compiler_pic_F77= lt_prog_compiler_static_F77= { echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_static_F77='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_F77='-fno-common' ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_F77=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_F77=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_F77='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' else lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' ;; esac ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_F77='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_F77='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_F77='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_F77='-non_shared' ;; newsos6) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fpic' lt_prog_compiler_static_F77='-Bstatic' ;; ccc*) lt_prog_compiler_wl_F77='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' lt_prog_compiler_wl_F77='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' lt_prog_compiler_wl_F77='' ;; esac ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_F77='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; rdos*) lt_prog_compiler_static_F77='-non_shared' ;; solaris*) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_F77='-Qoption ld ';; *) lt_prog_compiler_wl_F77='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_F77='-Qoption ld ' lt_prog_compiler_pic_F77='-PIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_F77='-Kconform_pic' lt_prog_compiler_static_F77='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; unicos*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_can_build_shared_F77=no ;; uts4*) lt_prog_compiler_pic_F77='-pic' lt_prog_compiler_static_F77='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_F77=no ;; esac fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_F77"; then { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_pic_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_F77" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14790: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:14794: \$? = $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 "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_F77=yes fi fi $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_F77" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_F77" >&6; } if test x"$lt_cv_prog_compiler_pic_works_F77" = xyes; then case $lt_prog_compiler_pic_F77 in "" | " "*) ;; *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; esac else lt_prog_compiler_pic_F77= lt_prog_compiler_can_build_shared_F77=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_F77= ;; *) lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_static_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_static_works_F77=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" 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 "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_F77=yes fi else lt_cv_prog_compiler_static_works_F77=yes fi fi $rm -r conftest* LDFLAGS="$save_LDFLAGS" fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_F77" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_static_works_F77" >&6; } if test x"$lt_cv_prog_compiler_static_works_F77" = xyes; then : else lt_prog_compiler_static_F77= fi { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_F77=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14894: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:14898: \$? = $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 "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_F77=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6; } if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } runpath_var= allow_undefined_flag_F77= enable_shared_with_static_runtimes_F77=no archive_cmds_F77= archive_expsym_cmds_F77= old_archive_From_new_cmds_F77= old_archive_from_expsyms_cmds_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= thread_safe_flag_spec_F77= hardcode_libdir_flag_spec_F77= hardcode_libdir_flag_spec_ld_F77= hardcode_libdir_separator_F77= hardcode_direct_F77=no hardcode_minus_L_F77=no hardcode_shlibpath_var_F77=unsupported link_all_deplibs_F77=unknown hardcode_automatic_F77=no module_cmds_F77= module_expsym_cmds_F77= always_export_symbols_F77=no export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_F77= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_F77='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_F77=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_F77='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_F77= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_F77=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_F77=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_F77=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_F77=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_F77='-L$libdir' allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--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... archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_F77=no fi ;; interix[3-9]*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_F77='${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*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_F77='${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' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec_F77='${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' tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; *) tmp_sharedflag='-shared' ;; esac archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi link_all_deplibs_F77=no else ld_shlibs_F77=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_F77=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_F77=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac ;; sunos4*) archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac if test "$ld_shlibs_F77" = no; then runpath_var= hardcode_libdir_flag_spec_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_F77=unsupported always_export_symbols_F77=yes archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_F77=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_F77=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_F77='' hardcode_direct_F77=yes hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_F77=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_F77=yes hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_libdir_separator_F77= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_F77=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_F77='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then 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 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_F77="-z nodefs" archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then 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 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_F77=' ${wl}-bernotok' allow_undefined_flag_F77=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_F77='$convenience' archive_cmds_need_lc_F77=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_F77="\$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' fi fi ;; amigaos*) archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes # see comment about different semantics on the GNU ld section ld_shlibs_F77=no ;; bsdi[45]*) export_dynamic_flag_spec_F77=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_F77=' ' allow_undefined_flag_F77=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_F77='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_F77=no hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported whole_archive_flag_spec_F77='' link_all_deplibs_F77=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_F77="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds_F77="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}" module_expsym_cmds_F77="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_F77=no ;; esac fi ;; dgux*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; freebsd1*) ld_shlibs_F77=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes export_dynamic_flag_spec_F77='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_F77='+b $libdir' hardcode_direct_F77=no hardcode_shlibpath_var_F77=no ;; *) hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: link_all_deplibs_F77=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; newsos6) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_shlibpath_var_F77=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-R$libdir' ;; *) archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs_F77=no fi ;; os2*) hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes allow_undefined_flag_F77=unsupported archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' fi hardcode_libdir_separator_F77=: ;; solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs_F77=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; sysv4) case $host_vendor in sni) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_F77='$CC -r -o $output$reload_objs' hardcode_direct_F77=no ;; motorola) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_F77=no ;; sysv4.3*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no export_dynamic_flag_spec_F77='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_F77=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_F77='${wl}-z,text' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_F77='${wl}-z,text' allow_undefined_flag_F77='${wl}-z,nodefs' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes export_dynamic_flag_spec_F77='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; *) ld_shlibs_F77=no ;; esac fi { echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 echo "${ECHO_T}$ld_shlibs_F77" >&6; } test "$ld_shlibs_F77" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_F77" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_F77=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_F77 in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_F77 pic_flag=$lt_prog_compiler_pic_F77 compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_F77 allow_undefined_flag_F77= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_F77=no else archive_cmds_need_lc_F77=yes fi allow_undefined_flag_F77=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; } ;; esac fi ;; esac { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # 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;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec" fi sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec" fi sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || \ test -n "$runpath_var_F77" || \ test "X$hardcode_automatic_F77" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_F77" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && test "$hardcode_minus_L_F77" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_F77=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_F77=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_F77=unsupported fi { echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 echo "${ECHO_T}$hardcode_action_F77" >&6; } if test "$hardcode_action_F77" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_F77 \ CC_F77 \ LD_F77 \ lt_prog_compiler_wl_F77 \ lt_prog_compiler_pic_F77 \ lt_prog_compiler_static_F77 \ lt_prog_compiler_no_builtin_flag_F77 \ export_dynamic_flag_spec_F77 \ thread_safe_flag_spec_F77 \ whole_archive_flag_spec_F77 \ enable_shared_with_static_runtimes_F77 \ old_archive_cmds_F77 \ old_archive_from_new_cmds_F77 \ predep_objects_F77 \ postdep_objects_F77 \ predeps_F77 \ postdeps_F77 \ compiler_lib_search_path_F77 \ compiler_lib_search_dirs_F77 \ archive_cmds_F77 \ archive_expsym_cmds_F77 \ postinstall_cmds_F77 \ postuninstall_cmds_F77 \ old_archive_from_expsyms_cmds_F77 \ allow_undefined_flag_F77 \ no_undefined_flag_F77 \ export_symbols_cmds_F77 \ hardcode_libdir_flag_spec_F77 \ hardcode_libdir_flag_spec_ld_F77 \ hardcode_libdir_separator_F77 \ hardcode_automatic_F77 \ module_cmds_F77 \ module_expsym_cmds_F77 \ lt_cv_prog_compiler_c_o_F77 \ fix_srcfile_path_F77 \ exclude_expsyms_F77 \ include_expsyms_F77; do case $var in old_archive_cmds_F77 | \ old_archive_from_new_cmds_F77 | \ archive_cmds_F77 | \ archive_expsym_cmds_F77 | \ module_cmds_F77 | \ module_expsym_cmds_F77 | \ old_archive_from_expsyms_cmds_F77 | \ export_symbols_cmds_F77 | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_F77 # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_F77 # Is the compiler the GNU C compiler? with_gcc=$GCC_F77 # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_F77 # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_F77 # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_F77 pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_F77 # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_F77 old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_F77 archive_expsym_cmds=$lt_archive_expsym_cmds_F77 postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_F77 module_expsym_cmds=$lt_module_expsym_cmds_F77 # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_F77 # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_F77 # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_F77 # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_F77 # The directories searched by this compiler when creating a shared # library compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_F77 # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_F77 # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_F77 # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_F77 # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_F77 # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_F77 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_F77 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_F77 # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_F77 # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_F77 # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_F77 # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_F77 # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_F77 # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o objext_GCJ=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm -r conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no old_archive_cmds_GCJ=$old_archive_cmds lt_prog_compiler_no_builtin_flag_GCJ= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' { echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17114: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:17118: \$? = $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 "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 fi fi $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl_GCJ= lt_prog_compiler_pic_GCJ= lt_prog_compiler_static_GCJ= { echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_static_GCJ='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_GCJ='-fno-common' ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_GCJ=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_GCJ=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac ;; *) lt_prog_compiler_pic_GCJ='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_GCJ='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_GCJ='-Bstatic' else lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' ;; esac ;; mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_GCJ='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_GCJ='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_GCJ='-non_shared' ;; newsos6) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-fpic' lt_prog_compiler_static_GCJ='-Bstatic' ;; ccc*) lt_prog_compiler_wl_GCJ='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' lt_prog_compiler_wl_GCJ='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' lt_prog_compiler_wl_GCJ='' ;; esac ;; esac ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_GCJ='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; rdos*) lt_prog_compiler_static_GCJ='-non_shared' ;; solaris*) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl_GCJ='-Qoption ld ';; *) lt_prog_compiler_wl_GCJ='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_GCJ='-Qoption ld ' lt_prog_compiler_pic_GCJ='-PIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_GCJ='-Kconform_pic' lt_prog_compiler_static_GCJ='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; unicos*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_can_build_shared_GCJ=no ;; uts4*) lt_prog_compiler_pic_GCJ='-pic' lt_prog_compiler_static_GCJ='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_GCJ=no ;; esac fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_GCJ"; then { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_pic_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_pic_works_GCJ=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_GCJ" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17404: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:17408: \$? = $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 "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_GCJ=yes fi fi $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_GCJ" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_GCJ" >&6; } if test x"$lt_cv_prog_compiler_pic_works_GCJ" = xyes; then case $lt_prog_compiler_pic_GCJ in "" | " "*) ;; *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; esac else lt_prog_compiler_pic_GCJ= lt_prog_compiler_can_build_shared_GCJ=no fi fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_GCJ= ;; *) lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" ;; esac # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_static_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_static_works_GCJ=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" 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 "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_GCJ=yes fi else lt_cv_prog_compiler_static_works_GCJ=yes fi fi $rm -r conftest* LDFLAGS="$save_LDFLAGS" fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_GCJ" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_static_works_GCJ" >&6; } if test x"$lt_cv_prog_compiler_static_works_GCJ" = xyes; then : else lt_prog_compiler_static_GCJ= fi { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_compiler_c_o_GCJ=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:17508: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:17512: \$? = $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 "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_GCJ=yes fi fi chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* fi { echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { echo "$as_me:$LINENO: result: $hard_links" >&5 echo "${ECHO_T}$hard_links" >&6; } if test "$hard_links" = no; then { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } runpath_var= allow_undefined_flag_GCJ= enable_shared_with_static_runtimes_GCJ=no archive_cmds_GCJ= archive_expsym_cmds_GCJ= old_archive_From_new_cmds_GCJ= old_archive_from_expsyms_cmds_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= thread_safe_flag_spec_GCJ= hardcode_libdir_flag_spec_GCJ= hardcode_libdir_flag_spec_ld_GCJ= hardcode_libdir_separator_GCJ= hardcode_direct_GCJ=no hardcode_minus_L_GCJ=no hardcode_shlibpath_var_GCJ=unsupported link_all_deplibs_GCJ=unknown hardcode_automatic_GCJ=no module_cmds_GCJ= module_expsym_cmds_GCJ= always_export_symbols_GCJ=no export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_GCJ= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_GCJ='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_GCJ=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_GCJ= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_GCJ=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. ld_shlibs_GCJ=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_GCJ=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_GCJ=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_GCJ='-L$libdir' allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--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... archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_GCJ=no fi ;; interix[3-9]*) hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_GCJ='${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*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_GCJ='${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' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec_GCJ='${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' tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; *) tmp_sharedflag='-shared' ;; esac archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi link_all_deplibs_GCJ=no else ld_shlibs_GCJ=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_GCJ=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_GCJ=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac ;; sunos4*) archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac if test "$ld_shlibs_GCJ" = no; then runpath_var= hardcode_libdir_flag_spec_GCJ= export_dynamic_flag_spec_GCJ= whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=yes archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_GCJ=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_GCJ=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_GCJ='' hardcode_direct_GCJ=yes hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_GCJ=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_GCJ=yes hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_libdir_separator_GCJ= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_GCJ=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_GCJ='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then 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 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_GCJ="-z nodefs" archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then 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 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_GCJ=' ${wl}-bernotok' allow_undefined_flag_GCJ=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_GCJ='$convenience' archive_cmds_need_lc_GCJ=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_GCJ="\$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' fi fi ;; amigaos*) archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes # see comment about different semantics on the GNU ld section ld_shlibs_GCJ=no ;; bsdi[45]*) export_dynamic_flag_spec_GCJ=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_GCJ=' ' allow_undefined_flag_GCJ=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[012]) allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[012]) allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac archive_cmds_need_lc_GCJ=no hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported whole_archive_flag_spec_GCJ='' link_all_deplibs_GCJ=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' archive_cmds_GCJ="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds_GCJ="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds_GCJ="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}" module_expsym_cmds_GCJ="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) ld_shlibs_GCJ=no ;; esac fi ;; dgux*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; freebsd1*) ld_shlibs_GCJ=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no ;; *) hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_GCJ=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: link_all_deplibs_GCJ=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; newsos6) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: hardcode_shlibpath_var_GCJ=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_GCJ=yes hardcode_shlibpath_var_GCJ=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' ;; *) archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs_GCJ=no fi ;; os2*) hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_minus_L_GCJ=yes allow_undefined_flag_GCJ=unsupported archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_GCJ=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' fi hardcode_libdir_separator_GCJ=: ;; solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs_GCJ=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_direct_GCJ=yes hardcode_minus_L_GCJ=yes hardcode_shlibpath_var_GCJ=no ;; sysv4) case $host_vendor in sni) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_GCJ='$CC -r -o $output$reload_objs' hardcode_direct_GCJ=no ;; motorola) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_GCJ=no ;; sysv4.3*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no export_dynamic_flag_spec_GCJ='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_GCJ=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_GCJ=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_GCJ='${wl}-z,text' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_GCJ='${wl}-z,text' allow_undefined_flag_GCJ='${wl}-z,nodefs' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_GCJ='-L$libdir' hardcode_shlibpath_var_GCJ=no ;; *) ld_shlibs_GCJ=no ;; esac fi { echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 echo "${ECHO_T}$ld_shlibs_GCJ" >&6; } test "$ld_shlibs_GCJ" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_GCJ" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_GCJ=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_GCJ in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_GCJ pic_flag=$lt_prog_compiler_pic_GCJ compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ allow_undefined_flag_GCJ= if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } then archive_cmds_need_lc_GCJ=no else archive_cmds_need_lc_GCJ=yes fi allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; } ;; esac fi ;; esac { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # 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;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec" fi sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec" fi sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } hardcode_action_GCJ= if test -n "$hardcode_libdir_flag_spec_GCJ" || \ test -n "$runpath_var_GCJ" || \ test "X$hardcode_automatic_GCJ" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_GCJ" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && test "$hardcode_minus_L_GCJ" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_GCJ=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_GCJ=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_GCJ=unsupported fi { echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 echo "${ECHO_T}$hardcode_action_GCJ" >&6; } if test "$hardcode_action_GCJ" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_GCJ \ CC_GCJ \ LD_GCJ \ lt_prog_compiler_wl_GCJ \ lt_prog_compiler_pic_GCJ \ lt_prog_compiler_static_GCJ \ lt_prog_compiler_no_builtin_flag_GCJ \ export_dynamic_flag_spec_GCJ \ thread_safe_flag_spec_GCJ \ whole_archive_flag_spec_GCJ \ enable_shared_with_static_runtimes_GCJ \ old_archive_cmds_GCJ \ old_archive_from_new_cmds_GCJ \ predep_objects_GCJ \ postdep_objects_GCJ \ predeps_GCJ \ postdeps_GCJ \ compiler_lib_search_path_GCJ \ compiler_lib_search_dirs_GCJ \ archive_cmds_GCJ \ archive_expsym_cmds_GCJ \ postinstall_cmds_GCJ \ postuninstall_cmds_GCJ \ old_archive_from_expsyms_cmds_GCJ \ allow_undefined_flag_GCJ \ no_undefined_flag_GCJ \ export_symbols_cmds_GCJ \ hardcode_libdir_flag_spec_GCJ \ hardcode_libdir_flag_spec_ld_GCJ \ hardcode_libdir_separator_GCJ \ hardcode_automatic_GCJ \ module_cmds_GCJ \ module_expsym_cmds_GCJ \ lt_cv_prog_compiler_c_o_GCJ \ fix_srcfile_path_GCJ \ exclude_expsyms_GCJ \ include_expsyms_GCJ; do case $var in old_archive_cmds_GCJ | \ old_archive_from_new_cmds_GCJ | \ archive_cmds_GCJ | \ archive_expsym_cmds_GCJ | \ module_cmds_GCJ | \ module_expsym_cmds_GCJ | \ old_archive_from_expsyms_cmds_GCJ | \ export_symbols_cmds_GCJ | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_GCJ # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_GCJ # Is the compiler the GNU C compiler? with_gcc=$GCC_GCJ # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_GCJ # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_GCJ # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_GCJ pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_GCJ # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_GCJ old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_GCJ archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_GCJ module_expsym_cmds=$lt_module_expsym_cmds_GCJ # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_GCJ # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_GCJ # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_GCJ # The directories searched by this compiler when creating a shared # library compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_GCJ # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_GCJ # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_GCJ # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_GCJ # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_GCJ # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_GCJ # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_GCJ # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_GCJ # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_GCJ # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_GCJ # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_GCJ # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_GCJ # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" else tagname="" fi ;; RC) # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o objext_RC=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm -r conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then # See if we are running on zsh, and set the options which allow our commands through # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ old_postinstall_cmds old_postuninstall_cmds \ compiler_RC \ CC_RC \ LD_RC \ lt_prog_compiler_wl_RC \ lt_prog_compiler_pic_RC \ lt_prog_compiler_static_RC \ lt_prog_compiler_no_builtin_flag_RC \ export_dynamic_flag_spec_RC \ thread_safe_flag_spec_RC \ whole_archive_flag_spec_RC \ enable_shared_with_static_runtimes_RC \ old_archive_cmds_RC \ old_archive_from_new_cmds_RC \ predep_objects_RC \ postdep_objects_RC \ predeps_RC \ postdeps_RC \ compiler_lib_search_path_RC \ compiler_lib_search_dirs_RC \ archive_cmds_RC \ archive_expsym_cmds_RC \ postinstall_cmds_RC \ postuninstall_cmds_RC \ old_archive_from_expsyms_cmds_RC \ allow_undefined_flag_RC \ no_undefined_flag_RC \ export_symbols_cmds_RC \ hardcode_libdir_flag_spec_RC \ hardcode_libdir_flag_spec_ld_RC \ hardcode_libdir_separator_RC \ hardcode_automatic_RC \ module_cmds_RC \ module_expsym_cmds_RC \ lt_cv_prog_compiler_c_o_RC \ fix_srcfile_path_RC \ exclude_expsyms_RC \ include_expsyms_RC; do case $var in old_archive_cmds_RC | \ old_archive_from_new_cmds_RC | \ archive_cmds_RC | \ archive_expsym_cmds_RC | \ module_cmds_RC | \ module_expsym_cmds_RC | \ old_archive_from_expsyms_cmds_RC | \ export_symbols_cmds_RC | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case $lt_echo in *'\$0 --fallback-echo"') lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac cfgfile="$ofile" cat <<__EOF__ >> "$cfgfile" # ### BEGIN LIBTOOL TAG CONFIG: $tagname # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_RC # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_compiler_RC # Is the compiler the GNU C compiler? with_gcc=$GCC_RC # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_LD_RC # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_RC # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_RC pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_RC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_old_archive_cmds_RC old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC # Commands used to build and install a shared archive. archive_cmds=$lt_archive_cmds_RC archive_expsym_cmds=$lt_archive_expsym_cmds_RC postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_module_cmds_RC module_expsym_cmds=$lt_module_expsym_cmds_RC # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_predep_objects_RC # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_postdep_objects_RC # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_predeps_RC # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_postdeps_RC # The directories searched by this compiler when creating a shared # library compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_RC # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_RC # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_RC # Flag that forces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_RC # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_RC # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct_RC # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L_RC # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_RC # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$hardcode_automatic_RC # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_RC # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_RC # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_RC # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_RC # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_RC # ### END LIBTOOL TAG CONFIG: $tagname __EOF__ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ;; *) { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 echo "$as_me: error: Unsupported tag name: $tagname" >&2;} { (exit 1); exit 1; }; } ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 echo "$as_me: error: unable to update list of available tagged configurations." >&2;} { (exit 1); exit 1; }; } fi fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi for ac_func in getaddrinfo do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done FOUND_POPT_HEADER=no if test "${ac_cv_header_popt_h+set}" = set; then { echo "$as_me:$LINENO: checking for popt.h" >&5 echo $ECHO_N "checking for popt.h... $ECHO_C" >&6; } if test "${ac_cv_header_popt_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_popt_h" >&5 echo "${ECHO_T}$ac_cv_header_popt_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking popt.h usability" >&5 echo $ECHO_N "checking popt.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking popt.h presence" >&5 echo $ECHO_N "checking popt.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: popt.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: popt.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: popt.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: popt.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: popt.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: popt.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: popt.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: popt.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: popt.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: popt.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: popt.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: popt.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: popt.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: popt.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: popt.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: popt.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for popt.h" >&5 echo $ECHO_N "checking for popt.h... $ECHO_C" >&6; } if test "${ac_cv_header_popt_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_popt_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_popt_h" >&5 echo "${ECHO_T}$ac_cv_header_popt_h" >&6; } fi if test $ac_cv_header_popt_h = yes; then FOUND_POPT_HEADER=yes; fi if test "x$FOUND_POPT_HEADER" != "xyes"; then echo "Could not find headers for the popt library" exit 1 fi if test "x$POPTLIBS" = "x"; then { echo "$as_me:$LINENO: checking for poptHelpOptions in -lpopt" >&5 echo $ECHO_N "checking for poptHelpOptions in -lpopt... $ECHO_C" >&6; } if test "${ac_cv_lib_popt_poptHelpOptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpopt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char poptHelpOptions (); int main () { return poptHelpOptions (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_popt_poptHelpOptions=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_popt_poptHelpOptions=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_popt_poptHelpOptions" >&5 echo "${ECHO_T}$ac_cv_lib_popt_poptHelpOptions" >&6; } if test $ac_cv_lib_popt_poptHelpOptions = yes; then POPTLIBS=-lpopt fi if test "x$POPTLIBS" = ""; then echo "Could not find the popt library" exit 1 fi fi # Check for GDBM have_gdbm_h="no" GDBM_LIB= if test "${ac_cv_header_gdbm_h+set}" = set; then { echo "$as_me:$LINENO: checking for gdbm.h" >&5 echo $ECHO_N "checking for gdbm.h... $ECHO_C" >&6; } if test "${ac_cv_header_gdbm_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_gdbm_h" >&5 echo "${ECHO_T}$ac_cv_header_gdbm_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking gdbm.h usability" >&5 echo $ECHO_N "checking gdbm.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking gdbm.h presence" >&5 echo $ECHO_N "checking gdbm.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: gdbm.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: gdbm.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: gdbm.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: gdbm.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: gdbm.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: gdbm.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: gdbm.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: gdbm.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: gdbm.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: gdbm.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: gdbm.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: gdbm.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: gdbm.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: gdbm.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: gdbm.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: gdbm.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for gdbm.h" >&5 echo $ECHO_N "checking for gdbm.h... $ECHO_C" >&6; } if test "${ac_cv_header_gdbm_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_gdbm_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_gdbm_h" >&5 echo "${ECHO_T}$ac_cv_header_gdbm_h" >&6; } fi if test $ac_cv_header_gdbm_h = yes; then have_gdbm_h="yes"; fi if test "x$have_gdbm_h" = "xyes"; then { echo "$as_me:$LINENO: checking for gdbm_open in -lgdbm" >&5 echo $ECHO_N "checking for gdbm_open in -lgdbm... $ECHO_C" >&6; } if test "${ac_cv_lib_gdbm_gdbm_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgdbm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gdbm_open (); int main () { return gdbm_open (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_gdbm_gdbm_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_gdbm_gdbm_open=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_gdbm_gdbm_open" >&5 echo "${ECHO_T}$ac_cv_lib_gdbm_gdbm_open" >&6; } if test $ac_cv_lib_gdbm_gdbm_open = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GDBM _ACEOF GDBM_LIB=-lgdbm; fi fi # Find pkg-config pkgprog= # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_pkgprog+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $pkgprog in [\\/]* | ?:[\\/]*) ac_cv_path_pkgprog="$pkgprog" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_pkgprog="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi pkgprog=$ac_cv_path_pkgprog if test -n "$pkgprog"; then { echo "$as_me:$LINENO: result: $pkgprog" >&5 echo "${ECHO_T}$pkgprog" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi # Handle GLIB support haveglib=no if test "x$glibver" = "x" -o "x$glibcflags" = "x" -o "x$gliblibs" = "x"; then glibprog= if test "x$tryglib" != "xno"; then if test "x$pkgprog" != "x"; then glibprog=$pkgprog else # Extract the first word of "glib-config", so it can be a program name with args. set dummy glib-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_glibprog+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $glibprog in [\\/]* | ?:[\\/]*) ac_cv_path_glibprog="$glibprog" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_glibprog="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi glibprog=$ac_cv_path_glibprog if test -n "$glibprog"; then { echo "$as_me:$LINENO: result: $glibprog" >&5 echo "${ECHO_T}$glibprog" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi GLIB_CFLAGS= GLIB_LIBS= if test "x$glibprog" != "x"; then # Try 2.0 first GLIB_CFLAGS=`$glibprog --cflags gthread-2.0 2>/dev/null` if test $? = 0; then haveglib=yes GLIB_VERSION='2.0' GLIB_LIBS=`$glibprog --libs gthread-2.0 2>/dev/null` else # Now try 1.2 GLIB_CFLAGS=`$glibprog --cflags gthread` if test $? = 0; then haveglib=yes GLIB_VERSION='1.2' GLIB_LIBS=`$glibprog --libs gthread` fi fi fi else haveglib=yes GLIB_CFLAGS="$glibcflags" GLIB_VERSION="$glibver" GLIB_LIBS="$gliblibs" fi echo "checking for glib... $haveglib" if test "x$haveglib" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_GLIB _ACEOF GLIB_LIB='$(top_builddir)/glib/libOpenIPMIglib.la' GLIB_SO='$(top_builddir)/glib/.libs/libOpenIPMIglib.so' GLIB_PKGCONF=OpenIPMIglib.pc GLIB_TARGET=libOpenIPMIglib.la else GLIB_LIB= GLIB_SO= GLIB_PKGCONF= GLIB_TARGET= fi # We allow a glib 1.2 specific library, too. haveglib12=no if test "x$glib12cflags" = "x" -o "x$glib12libs" = "x"; then glibprog= if test "x$tryglib12" != "xno"; then # Extract the first word of "glib-config", so it can be a program name with args. set dummy glib-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_glibprog+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $glibprog in [\\/]* | ?:[\\/]*) ac_cv_path_glibprog="$glibprog" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_glibprog="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi glibprog=$ac_cv_path_glibprog if test -n "$glibprog"; then { echo "$as_me:$LINENO: result: $glibprog" >&5 echo "${ECHO_T}$glibprog" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi GLIB12_CFLAGS= GLIB12_LIBS= if test "x$glibprog" != "x"; then GLIB12_CFLAGS=`$glibprog --cflags gthread` if test $? = 0; then haveglib12=yes GLIB12_LIBS=`$glibprog --libs gthread` fi fi else haveglib12=yes GLIB12_CFLAGS="$glib12cflags" GLIB12_LIBS="$glib12libs" fi echo "checking for glib 1.2... $haveglib12" if test "x$haveglib12" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_GLIB12 _ACEOF GLIB12_LIB='$(top_builddir)/glib/libOpenIPMIglib12.la' GLIB12_SO='$(top_builddir)/glib/.libs/libOpenIPMIglib12.so' GLIB12_PKGCONF=OpenIPMIglib12.pc GLIB12_TARGET=libOpenIPMIglib12.la else GLIB12_LIB= GLIB12_SO= GLIB12_PKGCONF= GLIB12_TARGET= fi if test "x$haveglib12" = "xyes" -o "x$haveglib" = "xyes"; then GLIB_DIR=glib # If we only have one glib library, just directly link with it in swig. # If we have two libraries, the swig code dynamically loads it and we # don't directly link with it. if test "x$haveglib12" = "xyes" -a "x$haveglib" = "xyes"; then GLIB_SINGLE_LIB= GLIB_SINGLE_SO= else if test "x$haveglib12" = "xyes"; then GLIB_SINGLE_LIB=$GLIB12_LIB GLIB_SINGLE_SO=$GLIB12_SO else GLIB_SINGLE_LIB=$GLIB_LIB GLIB_SINGLE_SO=$GLIB_SO fi fi else GLIB_DIR= GLIB_SINGLE_LIB= GLIB_SINGLE_SO= fi # Handle TCL support TCL_LIBS= TCL_CFLAGS= havetcl=no if test "x$trytcl" != "xno"; then FOUND_TCL_HEADER=no ver=`echo 'puts \$tcl_version' | tclsh` if test "x$tclcflags" = "x"; then if test "${ac_cv_header_tcl_h+set}" = set; then { echo "$as_me:$LINENO: checking for tcl.h" >&5 echo $ECHO_N "checking for tcl.h... $ECHO_C" >&6; } if test "${ac_cv_header_tcl_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_tcl_h" >&5 echo "${ECHO_T}$ac_cv_header_tcl_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking tcl.h usability" >&5 echo $ECHO_N "checking tcl.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking tcl.h presence" >&5 echo $ECHO_N "checking tcl.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: tcl.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: tcl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: tcl.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: tcl.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: tcl.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: tcl.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: tcl.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: tcl.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: tcl.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: tcl.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: tcl.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: tcl.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: tcl.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: tcl.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: tcl.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: tcl.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for tcl.h" >&5 echo $ECHO_N "checking for tcl.h... $ECHO_C" >&6; } if test "${ac_cv_header_tcl_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_tcl_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_tcl_h" >&5 echo "${ECHO_T}$ac_cv_header_tcl_h" >&6; } fi if test $ac_cv_header_tcl_h = yes; then FOUND_TCL_HEADER=yes; fi if test "x$FOUND_TCL_HEADER" != "xyes"; then echo -n "checking for /usr/include/tcl$ver... " if test 'x$ver' != 'x' -a -d "/usr/include/tcl$ver"; then echo "yes" tclcflags="-I /usr/include/tcl$ver" TCL_CFLAGS="$tclcflags" FOUND_TCL_HEADER=yes else echo "no" fi fi else TCL_CFLAGS="$tclcflags" FOUND_TCL_HEADER=yes fi if test "x$tcllibs" = "x"; then if test "x$FOUND_TCL_HEADER" = "xyes"; then { echo "$as_me:$LINENO: checking for Tcl_DoOneEvent in -ltcl" >&5 echo $ECHO_N "checking for Tcl_DoOneEvent in -ltcl... $ECHO_C" >&6; } if test "${ac_cv_lib_tcl_Tcl_DoOneEvent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltcl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char Tcl_DoOneEvent (); int main () { return Tcl_DoOneEvent (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_tcl_Tcl_DoOneEvent=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_tcl_Tcl_DoOneEvent=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_tcl_Tcl_DoOneEvent" >&5 echo "${ECHO_T}$ac_cv_lib_tcl_Tcl_DoOneEvent" >&6; } if test $ac_cv_lib_tcl_Tcl_DoOneEvent = yes; then TCL_LIBS=-ltcl fi if test "x$TCL_LIBS" = "x"; then as_ac_Lib=`echo "ac_cv_lib_tcl$ver''_Tcl_DoOneEvent" | $as_tr_sh` { echo "$as_me:$LINENO: checking for Tcl_DoOneEvent in -ltcl$ver" >&5 echo $ECHO_N "checking for Tcl_DoOneEvent in -ltcl$ver... $ECHO_C" >&6; } if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltcl$ver $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char Tcl_DoOneEvent (); int main () { return Tcl_DoOneEvent (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_Lib=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi ac_res=`eval echo '${'$as_ac_Lib'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Lib'}'` = yes; then TCL_LIBS=-ltcl$ver fi fi fi else TCL_LIBS="$tcllibs" fi if test "x$FOUND_TCL_HEADER" = "xyes" -a "x$TCL_LIBS" != "x"; then havetcl=yes fi fi echo "checking for tcl... $havetcl" if test "x$havetcl" == "xyes"; then OLDLIBS="$LIBS" LIBS="$LIBS $TCL_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char Tcl_GetTime (); int main () { return Tcl_GetTime (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then echo "Have Tcl_GetTime" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "Redefine Tcl_GetTime as TclpGetTime"; cat >>confdefs.h <<\_ACEOF #define Tcl_GetTime TclpGetTime _ACEOF fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$OLDLIBS" fi if test "x$havetcl" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_TCL _ACEOF TCL_LIB='$(top_builddir)/tcl/libOpenIPMItcl.la' TCL_SO='$(top_builddir)/tcl/.libs/libOpenIPMItcl.so' TCL_PKGCONF=OpenIPMItcl.pc TCL_TARGET=libOpenIPMItcl.la TCL_DIR=tcl else TCL_LIB= TCL_SO= TCL_PKGCONF= TCL_TARGET= TCL_DIR= fi # Handle PERL support if test "x$perlcflags" = "x" -o "x$perlinstalldir" = "x"; then perlprog= if test "x$tryperl" != "xno"; then # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_perlprog+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $perlprog in [\\/]* | ?:[\\/]*) ac_cv_path_perlprog="$perlprog" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_perlprog="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi perlprog=$ac_cv_path_perlprog if test -n "$perlprog"; then { echo "$as_me:$LINENO: result: $perlprog" >&5 echo "${ECHO_T}$perlprog" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test "x$perlprog" != "x"; then # Find the place where perl lives. if test "x$perldir" = "x"; then perldir=`$perlprog -e 'for $i (@INC) { if (-r "$i/CORE/perl.h") { print "$i"; last; } }'` fi # Now find a proper installation location. if test "x$perlinstalldir" = "x"; then perlinstalldir=`(eval \`perl -V:installvendorarch\`; echo $installvendorarch)` if test "x$perlinstalldir" = "x" -o ! -d "$perlinstalldir"; then perlinstalldir=`$perlprog -e 'for $i (@INC) { if ($i =~ /site_perl\/.+\/.+/) { print "$i"; last; } }'` fi if test "x$perlinstalldir" = "x" -o ! -d "$perlinstalldir"; then perlinstalldir=`$perlprog -e 'for $i (@INC) { if ($i =~ /vendor_perl\/.+\/.+/) { print "$i"; last; } }'` fi if test "x$perlinstalldir" = "x" -o ! -d "$perlinstalldir"; then perlinstalldir=$perldir fi fi fi if test "x$perldir" != "x"; then tpprog=`$perlprog -e "\\$p = \"$perlinstalldir\"; \\$u = \"$prefix\"; \\$p =~ s/\\$u//; print \\$p"` cat >>confdefs.h <<\_ACEOF #define HAVE_PERL _ACEOF PERL_DIR=perl if test "x$perlcflags" = "x"; then PERL_CFLAGS="-I $perldir/CORE `$perlprog -V:ccflags | grep ccflags | sed 's/^.*ccflags=.\(.*\).;$/\1/'`" else PERL_CFLAGS="$perlcflags" fi if test "$tpprog" = "$perlinstalldir"; then PERL_INSTALL_DIR="$perlinstalldir" else PERL_INSTALL_DIR="\${prefix}$tpprog" fi else PERL_DIR= PERL_CFLAGS= PERL_INSTALL_DIR= PERL_HAS_POSIX_THREADS= PERL_POSIX_LIB= PERL_POSIX_SO= fi else cat >>confdefs.h <<\_ACEOF #define HAVE_PERL _ACEOF PERL_DIR=perl PERL_CFLAGS="$perlcflags" PERL_INSTALL_DIR="$perlinstalldir" fi if test "x$perlprog" != "x"; then if test "x$perlusepthreads" = "x"; then if $perlprog -V:usethreads | grep -q 'define'; then perlusepthreads="yes" fi fi echo "checking for perl threads... $perlusepthreads" fi if test "x$perlusepthreads" = "xyes"; then PERL_HAS_POSIX_THREADS=1 PERL_POSIX_LIB='$(top_builddir)/unix/libOpenIPMIpthread.la' PERL_POSIX_SO='$(top_builddir)/unix/.libs/libOpenIPMIpthread.so' else PERL_HAS_POSIX_THREADS=0 PERL_POSIX_LIB='$(top_builddir)/unix/libOpenIPMIposix.la' PERL_POSIX_SO='$(top_builddir)/unix/.libs/libOpenIPMIposix.so' fi # Handle PYTHON support if test "x$pythoncflags" = "x" -o "x$pythoninstalldir" = "x"; then pythonprog= if test "x$trypython" != "xno"; then # Extract the first word of "python", so it can be a program name with args. set dummy python; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_pythonprog+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $pythonprog in [\\/]* | ?:[\\/]*) ac_cv_path_pythonprog="$pythonprog" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_pythonprog="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi pythonprog=$ac_cv_path_pythonprog if test -n "$pythonprog"; then { echo "$as_me:$LINENO: result: $pythonprog" >&5 echo "${ECHO_T}$pythonprog" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test "x$pythonprog" != "x"; then # Now find a proper installation location. if test "x$pythoninstalldir" = "x"; then pythoninstalldir=`$pythonprog -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib();'` if test "x$pythoninstalldir" = "x" -o ! -d "$pythoninstalldir"; then pythoninstalldir= fi fi fi if test "x$pythoncflags" = "x"; then pythoninc=`$pythonprog -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_inc();'` if test "x$pythoninc" != "x"; then pythoncflags="-I$pythoninc" else pythoncflags="" fi else PYTHON_CFLAGS="$pythoncflags" fi if test "x$pythoninstalldir" != "x"; then if test "x$pythoninstalllibdir" = "x"; then pythoninstalllibdir=$pythoninstalldir fi cat >>confdefs.h <<\_ACEOF #define HAVE_PYTHON _ACEOF PYTHON_DIR=python PYTHON_CFLAGS="$pythoncflags" PYTHON_INSTALL_DIR="$pythoninstalldir" PYTHON_INSTALL_LIB_DIR="$pythoninstalllibdir" else PYTHON_DIR= PYTHON_CFLAGS= PYTHON_INSTALL_DIR= PYTHON_INSTALL_LIB_DIR= fi else if test "x$pythoninstalllibdir" = "x"; then pythoninstalllibdir=$pythoninstalldir fi cat >>confdefs.h <<\_ACEOF #define HAVE_PYTHON _ACEOF PYTHON_DIR=python PYTHON_CFLAGS="$pythoncflags" PYTHON_INSTALL_DIR="$pythoninstalldir" PYTHON_INSTALL_LIB_DIR="$pythoninstalllibdir" fi if test "x$pythonprog" != "x"; then if test "x$pythonusepthreads" = "x"; then pythonusepthreads=`echo -e "try:\n import thread\n print 'yes'\nexcept:\n print 'no'\n" | python` fi echo "checking for python threads... $pythonusepthreads" fi if test "x$pythonusepthreads" = "xyes"; then PYTHON_HAS_POSIX_THREADS=1 PYTHON_POSIX_LIB='$(top_builddir)/unix/libOpenIPMIpthread.la' PYTHON_POSIX_SO='$(top_builddir)/unix/.libs/libOpenIPMIpthread.so' else PYTHON_HAS_POSIX_THREADS=0 PYTHON_POSIX_LIB='$(top_builddir)/unix/libOpenIPMIposix.la' PYTHON_POSIX_SO='$(top_builddir)/unix/.libs/libOpenIPMIposix.so' fi # Check for Tkinter/Tix if test "x$tkinter" = "x"; then if test "x$pythonprog" != "x"; then tkinter=`echo -e "try:\n import Tix\n print 'yes'\nexcept:\n print 'no'\n" | python` fi fi echo "checking for tkinter... $tkinter" if test "x$tkinter" = "xyes"; then PYTHON_GUI_DIR=openipmigui else PYTHON_GUI_DIR= fi # Now check for swig if test "x$swigprog" = "x" -a "x$tryswig" = "xyes"; then # Extract the first word of "swig", so it can be a program name with args. set dummy swig; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_swigprog+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $swigprog in [\\/]* | ?:[\\/]*) ac_cv_path_swigprog="$swigprog" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_swigprog="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi swigprog=$ac_cv_path_swigprog if test -n "$swigprog"; then { echo "$as_me:$LINENO: result: $swigprog" >&5 echo "${ECHO_T}$swigprog" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test "x$swigprog" != "x"; then swigver=`$swigprog -version 2>&1 | grep 'SWIG Version' | sed 's/SWIG Version //'` swigmajor=`echo $swigver | sed 's/\.[0-9]*\.[0-9]*$//'` swigminor=`echo $swigver | sed 's/^[0-9]*\.\([0-9]*\)\.[0-9]*$/\1/'` swigrel=`echo $swigver | sed 's/^[0-9]*\.[0-9]*\.//'` if test '(' "$swigmajor" -lt 1 ')' -o '(' '(' "$swigmajor" -eq 1 ')' -a '(' "$swigminor" -lt 3 ')' ')' -o '(' '(' "$swigmajor" -eq 1 ')' -a '(' "$swigminor" -eq 3 ')' -a '(' "$swigrel" -lt 21 ')' ')'; then echo "***swig must be version 1.3.21 or greater, disabling swig and perl/python" else echo "swig version $swigver" cat >>confdefs.h <<\_ACEOF #define HAVE_SWIG _ACEOF SWIG_DIR=swig SWIG=$swigprog fi else SWIG_DIR= SWIG= fi # Handle SNMP support if test "x$tryucdsnmp" != "xno"; then HAVE_UCDSNMP=no HAVE_NETSNMP=no FOUND_SNMPINCL=no # Try net snmp first if test "${ac_cv_header_net_snmp_net_snmp_config_h+set}" = set; then { echo "$as_me:$LINENO: checking for net-snmp/net-snmp-config.h" >&5 echo $ECHO_N "checking for net-snmp/net-snmp-config.h... $ECHO_C" >&6; } if test "${ac_cv_header_net_snmp_net_snmp_config_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_net_snmp_net_snmp_config_h" >&5 echo "${ECHO_T}$ac_cv_header_net_snmp_net_snmp_config_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking net-snmp/net-snmp-config.h usability" >&5 echo $ECHO_N "checking net-snmp/net-snmp-config.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking net-snmp/net-snmp-config.h presence" >&5 echo $ECHO_N "checking net-snmp/net-snmp-config.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: net-snmp/net-snmp-config.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: net-snmp/net-snmp-config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: net-snmp/net-snmp-config.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: net-snmp/net-snmp-config.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: net-snmp/net-snmp-config.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: net-snmp/net-snmp-config.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: net-snmp/net-snmp-config.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: net-snmp/net-snmp-config.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: net-snmp/net-snmp-config.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: net-snmp/net-snmp-config.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: net-snmp/net-snmp-config.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: net-snmp/net-snmp-config.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: net-snmp/net-snmp-config.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: net-snmp/net-snmp-config.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: net-snmp/net-snmp-config.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: net-snmp/net-snmp-config.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for net-snmp/net-snmp-config.h" >&5 echo $ECHO_N "checking for net-snmp/net-snmp-config.h... $ECHO_C" >&6; } if test "${ac_cv_header_net_snmp_net_snmp_config_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_net_snmp_net_snmp_config_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_net_snmp_net_snmp_config_h" >&5 echo "${ECHO_T}$ac_cv_header_net_snmp_net_snmp_config_h" >&6; } fi if test $ac_cv_header_net_snmp_net_snmp_config_h = yes; then FOUND_SNMPINCL=yes; HAVE_NETSNMP=yes; fi if test "x$FOUND_SNMPINCL" = "xno"; then # Try old UCD snmp if test "${ac_cv_header_snmp_api_h+set}" = set; then { echo "$as_me:$LINENO: checking for snmp_api.h" >&5 echo $ECHO_N "checking for snmp_api.h... $ECHO_C" >&6; } if test "${ac_cv_header_snmp_api_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_snmp_api_h" >&5 echo "${ECHO_T}$ac_cv_header_snmp_api_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking snmp_api.h usability" >&5 echo $ECHO_N "checking snmp_api.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking snmp_api.h presence" >&5 echo $ECHO_N "checking snmp_api.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: snmp_api.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: snmp_api.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: snmp_api.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: snmp_api.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: snmp_api.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: snmp_api.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: snmp_api.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: snmp_api.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: snmp_api.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: snmp_api.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: snmp_api.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: snmp_api.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: snmp_api.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: snmp_api.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: snmp_api.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: snmp_api.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for snmp_api.h" >&5 echo $ECHO_N "checking for snmp_api.h... $ECHO_C" >&6; } if test "${ac_cv_header_snmp_api_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_snmp_api_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_snmp_api_h" >&5 echo "${ECHO_T}$ac_cv_header_snmp_api_h" >&6; } fi if test $ac_cv_header_snmp_api_h = yes; then FOUND_SNMPINCL=yes; fi if test "x$FOUND_SNMPINCL" = "xno"; then if test "${ac_cv_header_ucd_snmp_snmp_api_h+set}" = set; then { echo "$as_me:$LINENO: checking for ucd-snmp/snmp_api.h" >&5 echo $ECHO_N "checking for ucd-snmp/snmp_api.h... $ECHO_C" >&6; } if test "${ac_cv_header_ucd_snmp_snmp_api_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_ucd_snmp_snmp_api_h" >&5 echo "${ECHO_T}$ac_cv_header_ucd_snmp_snmp_api_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking ucd-snmp/snmp_api.h usability" >&5 echo $ECHO_N "checking ucd-snmp/snmp_api.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking ucd-snmp/snmp_api.h presence" >&5 echo $ECHO_N "checking ucd-snmp/snmp_api.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: ucd-snmp/snmp_api.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: ucd-snmp/snmp_api.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: ucd-snmp/snmp_api.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: ucd-snmp/snmp_api.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: ucd-snmp/snmp_api.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: ucd-snmp/snmp_api.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: ucd-snmp/snmp_api.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: ucd-snmp/snmp_api.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: ucd-snmp/snmp_api.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: ucd-snmp/snmp_api.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: ucd-snmp/snmp_api.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: ucd-snmp/snmp_api.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: ucd-snmp/snmp_api.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: ucd-snmp/snmp_api.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: ucd-snmp/snmp_api.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: ucd-snmp/snmp_api.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for ucd-snmp/snmp_api.h" >&5 echo $ECHO_N "checking for ucd-snmp/snmp_api.h... $ECHO_C" >&6; } if test "${ac_cv_header_ucd_snmp_snmp_api_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_ucd_snmp_snmp_api_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_ucd_snmp_snmp_api_h" >&5 echo "${ECHO_T}$ac_cv_header_ucd_snmp_snmp_api_h" >&6; } fi if test $ac_cv_header_ucd_snmp_snmp_api_h = yes; then FOUND_SNMPINCL=yes; cat >>confdefs.h <<\_ACEOF #define HAVE_ALT_UCDSNMP_DIR _ACEOF fi fi fi if test "x$FOUND_SNMPINCL" = "xyes"; then if test "x$HAVE_NETSNMP" = "xyes"; then { echo "$as_me:$LINENO: checking for snmp_add in -lnetsnmp" >&5 echo $ECHO_N "checking for snmp_add in -lnetsnmp... $ECHO_C" >&6; } if test "${ac_cv_lib_netsnmp_snmp_add+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnetsnmp $SNMPLIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char snmp_add (); int main () { return snmp_add (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_netsnmp_snmp_add=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_netsnmp_snmp_add=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_netsnmp_snmp_add" >&5 echo "${ECHO_T}$ac_cv_lib_netsnmp_snmp_add" >&6; } if test $ac_cv_lib_netsnmp_snmp_add = yes; then SNMPLIBS="-lnetsnmp $SNMPLIBS" cat >>confdefs.h <<\_ACEOF #define HAVE_UCDSNMP _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_NETSNMP _ACEOF HAVE_UCDSNMP=yes HAVE_NETSNMP=yes fi if test "x$HAVE_UCDSNMP" = "xno"; then # Try net snmp with crypto { echo "$as_me:$LINENO: checking for snmp_add_full in -lnetsnmp" >&5 echo $ECHO_N "checking for snmp_add_full in -lnetsnmp... $ECHO_C" >&6; } if test "${ac_cv_lib_netsnmp_snmp_add_full+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnetsnmp -lcrypto $SNMPLIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char snmp_add_full (); int main () { return snmp_add_full (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_netsnmp_snmp_add_full=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_netsnmp_snmp_add_full=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_netsnmp_snmp_add_full" >&5 echo "${ECHO_T}$ac_cv_lib_netsnmp_snmp_add_full" >&6; } if test $ac_cv_lib_netsnmp_snmp_add_full = yes; then SNMPLIBS="-lnetsnmp -lcrypto $SNMPLIBS" cat >>confdefs.h <<\_ACEOF #define HAVE_UCDSNMP _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_NETSNMP _ACEOF HAVE_UCDSNMP=yes HAVE_NETSNMP=yes fi fi if test "x$HAVE_UCDSNMP" = "xno"; then { echo "$as_me:$LINENO: WARNING: Found NET SNMP include files, but could not find libraries" >&5 echo "$as_me: WARNING: Found NET SNMP include files, but could not find libraries" >&2;} fi else { echo "$as_me:$LINENO: checking for snmp_open_ex in -lsnmp" >&5 echo $ECHO_N "checking for snmp_open_ex in -lsnmp... $ECHO_C" >&6; } if test "${ac_cv_lib_snmp_snmp_open_ex+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsnmp $SNMPLIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char snmp_open_ex (); int main () { return snmp_open_ex (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_snmp_snmp_open_ex=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_snmp_snmp_open_ex=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_snmp_snmp_open_ex" >&5 echo "${ECHO_T}$ac_cv_lib_snmp_snmp_open_ex" >&6; } if test $ac_cv_lib_snmp_snmp_open_ex = yes; then SNMPLIBS="-lsnmp $SNMPLIBS" cat >>confdefs.h <<\_ACEOF #define HAVE_UCDSNMP _ACEOF HAVE_UCDSNMP=yes fi if test "x$HAVE_UCDSNMP" = "xno"; then # Try with the crypto lib { echo "$as_me:$LINENO: checking for snmp_sess_perror in -lsnmp" >&5 echo $ECHO_N "checking for snmp_sess_perror in -lsnmp... $ECHO_C" >&6; } if test "${ac_cv_lib_snmp_snmp_sess_perror+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsnmp -lcrypto $SNMPLIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char snmp_sess_perror (); int main () { return snmp_sess_perror (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_snmp_snmp_sess_perror=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_snmp_snmp_sess_perror=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_snmp_snmp_sess_perror" >&5 echo "${ECHO_T}$ac_cv_lib_snmp_snmp_sess_perror" >&6; } if test $ac_cv_lib_snmp_snmp_sess_perror = yes; then SNMPLIBS="-lsnmp -lcrypto $SNMPLIBS" cat >>confdefs.h <<\_ACEOF #define HAVE_UCDSNMP _ACEOF HAVE_UCDSNMP=yes fi fi if test "x$HAVE_UCDSNMP" = "xno"; then { echo "$as_me:$LINENO: WARNING: Found UCD SNMP include files, but could not find libraries" >&5 echo "$as_me: WARNING: Found UCD SNMP include files, but could not find libraries" >&2;} fi fi fi fi # Handle SNMP support if test "x$tryopenssl" != "xno"; then HAVE_OPENSSL=no # Try net snmp first if test "${ac_cv_header_openssl_crypto_h+set}" = set; then { echo "$as_me:$LINENO: checking for openssl/crypto.h" >&5 echo $ECHO_N "checking for openssl/crypto.h... $ECHO_C" >&6; } if test "${ac_cv_header_openssl_crypto_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_openssl_crypto_h" >&5 echo "${ECHO_T}$ac_cv_header_openssl_crypto_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking openssl/crypto.h usability" >&5 echo $ECHO_N "checking openssl/crypto.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking openssl/crypto.h presence" >&5 echo $ECHO_N "checking openssl/crypto.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: openssl/crypto.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: openssl/crypto.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: openssl/crypto.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: openssl/crypto.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: openssl/crypto.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: openssl/crypto.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: openssl/crypto.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: openssl/crypto.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: openssl/crypto.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: openssl/crypto.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: openssl/crypto.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: openssl/crypto.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: openssl/crypto.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: openssl/crypto.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: openssl/crypto.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: openssl/crypto.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for openssl/crypto.h" >&5 echo $ECHO_N "checking for openssl/crypto.h... $ECHO_C" >&6; } if test "${ac_cv_header_openssl_crypto_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_openssl_crypto_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_openssl_crypto_h" >&5 echo "${ECHO_T}$ac_cv_header_openssl_crypto_h" >&6; } fi if test $ac_cv_header_openssl_crypto_h = yes; then FOUND_OPENSSL=yes; fi if test "x$FOUND_OPENSSL" = "xyes"; then { echo "$as_me:$LINENO: checking for CRYPTO_malloc in -lcrypto" >&5 echo $ECHO_N "checking for CRYPTO_malloc in -lcrypto... $ECHO_C" >&6; } if test "${ac_cv_lib_crypto_CRYPTO_malloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $OPENSSLLIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char CRYPTO_malloc (); int main () { return CRYPTO_malloc (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_crypto_CRYPTO_malloc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_crypto_CRYPTO_malloc=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_CRYPTO_malloc" >&5 echo "${ECHO_T}$ac_cv_lib_crypto_CRYPTO_malloc" >&6; } if test $ac_cv_lib_crypto_CRYPTO_malloc = yes; then OPENSSLLIBS="-lcrypto $OPENSSLLIBS" cat >>confdefs.h <<\_ACEOF #define HAVE_OPENSSL _ACEOF HAVE_OPENSSL=yes fi fi fi for ac_func in syslog do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Now check for dia and the dia version. They changed the output format # specifier without leaving backwards-compatible handling, so lots of ugly # checks here. DIA= # Extract the first word of "dia", so it can be a program name with args. set dummy dia; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_diaprog+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $diaprog in [\\/]* | ?:[\\/]*) ac_cv_path_diaprog="$diaprog" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_diaprog="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi diaprog=$ac_cv_path_diaprog if test -n "$diaprog"; then { echo "$as_me:$LINENO: result: $diaprog" >&5 echo "${ECHO_T}$diaprog" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$diaprog" != "x"; then diaver=`$diaprog --version | sed 's/Dia version \([^,]*\), .*$/\1/'` tmp=`echo $diaver | sed 's/^[0-9.]\+$//'` if test "x$diaver" == "x" -o "x$tmp" != 'x'; then # Couldn't get the dia version, give up. echo "Couldn't determine the dia version from '$diaver'" else DIA="$diaprog" diaver_major=`echo $diaver | sed 's/\.[0-9.]\+$//'` diaver_minor=`echo $diaver | sed 's/^[0-9]\+\.//' | sed 's/\.[0-9.]\+$//'` echo "dia version is $diaver_major.$diaver_minor" if test $diaver_major -lt 1 -a $diaver_minor -lt 95; then # 0.94 and below use --export-to-format DIA_FILTER_NAME=--export-to-format else DIA_FILTER_NAME=--filter fi fi fi LATEX= BIBTEX= DVIPDF= # Extract the first word of "latex", so it can be a program name with args. set dummy latex; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_LATEX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $LATEX in [\\/]* | ?:[\\/]*) ac_cv_path_LATEX="$LATEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_LATEX="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi LATEX=$ac_cv_path_LATEX if test -n "$LATEX"; then { echo "$as_me:$LINENO: result: $LATEX" >&5 echo "${ECHO_T}$LATEX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi # Extract the first word of "bibtex", so it can be a program name with args. set dummy bibtex; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_BIBTEX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $BIBTEX in [\\/]* | ?:[\\/]*) ac_cv_path_BIBTEX="$BIBTEX" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_BIBTEX="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi BIBTEX=$ac_cv_path_BIBTEX if test -n "$BIBTEX"; then { echo "$as_me:$LINENO: result: $BIBTEX" >&5 echo "${ECHO_T}$BIBTEX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi # Extract the first word of "dvipdf", so it can be a program name with args. set dummy dvipdf; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_DVIPDF+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $DVIPDF in [\\/]* | ?:[\\/]*) ac_cv_path_DVIPDF="$DVIPDF" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_DVIPDF="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DVIPDF=$ac_cv_path_DVIPDF if test -n "$DVIPDF"; then { echo "$as_me:$LINENO: result: $DVIPDF" >&5 echo "${ECHO_T}$DVIPDF" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$DIA" == "x" -o "x$LATEX" == "x" -o "x$BIBTEX" == "x" -o "x$DVIPDF" == "x"; then echo "dia, latex, bibtex, and/or dvipdf is not present or not valid, you cannot regenerate documentation" echo "The documentation comes already generated, so this is generally not a problem" fi OPENIPMI_SWIG_LIBS="${PYTHON_POSIX_LIB} \$(top_builddir)/lib/libOpenIPMI.la \$(top_builddir)/utils/libOpenIPMIutils.la \$(top_builddir)/cmdlang/libOpenIPMIcmdlang.la ${GLIB_SINGLE_LIB} ${TCL_LIB}" OPENIPMI_SWIG_SO="${PYTHON_POSIX_SO}:\$(top_builddir)/lib/.libs/libOpenIPMI.so:\$(top_builddir)/utils/.libs/libOpenIPMIutils.so:\$(top_builddir)/cmdlang/.libs/libOpenIPMIcmdlang.so:${GLIB_SINGLE_SO}:${TCL_SO}" # Everything from here to AC_OUTPUT is for libedit # AC_PROG_LIBTOOL runs AC_CANONICAL_HOST case $host in *-sun-*) cat >>confdefs.h <<\_ACEOF #define _SUNOS _ACEOF ;; esac { echo "$as_me:$LINENO: checking for tgetent in -lcurses" >&5 echo $ECHO_N "checking for tgetent in -lcurses... $ECHO_C" >&6; } if test "${ac_cv_lib_curses_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tgetent (); int main () { return tgetent (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_curses_tgetent=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_curses_tgetent=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_curses_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_curses_tgetent" >&6; } if test $ac_cv_lib_curses_tgetent = yes; then TERM_LIBS=-lcurses else { echo "$as_me:$LINENO: checking for tgetent in -lncurses" >&5 echo $ECHO_N "checking for tgetent in -lncurses... $ECHO_C" >&6; } if test "${ac_cv_lib_ncurses_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tgetent (); int main () { return tgetent (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_ncurses_tgetent=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ncurses_tgetent=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_ncurses_tgetent" >&6; } if test $ac_cv_lib_ncurses_tgetent = yes; then TERM_LIBS=-lncurses else { { echo "$as_me:$LINENO: error: libtermcap, libcurses or libncurses are required!" >&5 echo "$as_me: error: libtermcap, libcurses or libncurses are required!" >&2;} { (exit 1); exit 1; }; } fi fi # Checks for header files. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { echo "$as_me:$LINENO: checking for working alloca.h" >&5 echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; } if test "${ac_cv_working_alloca_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_working_alloca_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 echo "${ECHO_T}$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA_H 1 _ACEOF fi { echo "$as_me:$LINENO: checking for alloca" >&5 echo $ECHO_N "checking for alloca... $ECHO_C" >&6; } if test "${ac_cv_func_alloca_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_alloca_works=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 echo "${ECHO_T}$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA 1 _ACEOF else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext cat >>confdefs.h <<\_ACEOF #define C_ALLOCA 1 _ACEOF { echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6; } if test "${ac_cv_os_cray+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 echo "${ECHO_T}$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6; } if test "${ac_cv_c_stack_direction+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { return find_stack_direction () < 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 echo "${ECHO_T}$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { echo "$as_me:$LINENO: checking for library containing opendir" >&5 echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_search_opendir=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 echo "${ECHO_T}$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { echo "$as_me:$LINENO: checking for library containing opendir" >&5 echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_search_opendir=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 echo "${ECHO_T}$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi { echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6; } if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_sys_wait_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_WAIT_H 1 _ACEOF fi for ac_header in fcntl.h limits.h malloc.h stdlib.h string.h sys/ioctl.h sys/param.h termios.h unistd.h curses.h ncurses.h sys/cdefs.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ## include curses.h to prevent "Present But Cannot Be Compiled" for ac_header in term.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if HAVE_CURSES_H # include #elif HAVE_NCURSES_H # include #endif #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi { echo "$as_me:$LINENO: checking for pid_t" >&5 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; } if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef pid_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_pid_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pid_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 echo "${ECHO_T}$ac_cv_type_pid_t" >&6; } if test $ac_cv_type_pid_t = yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi { echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef size_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6; } if test $ac_cv_type_size_t = yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { echo "$as_me:$LINENO: checking for u_int32_t" >&5 echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6; } if test "${ac_cv_type_u_int32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef u_int32_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_u_int32_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_u_int32_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5 echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6; } if test $ac_cv_type_u_int32_t = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_U_INT32_T 1 _ACEOF fi # Checks for library functions. { echo "$as_me:$LINENO: checking whether closedir returns void" >&5 echo $ECHO_N "checking whether closedir returns void... $ECHO_C" >&6; } if test "${ac_cv_func_closedir_void+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_closedir_void=yes else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header_dirent> #ifndef __cplusplus int closedir (); #endif int main () { return closedir (opendir (".")) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_closedir_void=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_closedir_void=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_closedir_void" >&5 echo "${ECHO_T}$ac_cv_func_closedir_void" >&6; } if test $ac_cv_func_closedir_void = yes; then cat >>confdefs.h <<\_ACEOF #define CLOSEDIR_VOID 1 _ACEOF fi for ac_header in vfork.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in fork vfork do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { echo "$as_me:$LINENO: checking for working fork" >&5 echo $ECHO_N "checking for working fork... $ECHO_C" >&6; } if test "${ac_cv_func_fork_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_fork_works=cross else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_fork_works=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 echo "${ECHO_T}$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { echo "$as_me:$LINENO: checking for working vfork" >&5 echo $ECHO_N "checking for working vfork... $ECHO_C" >&6; } if test "${ac_cv_func_vfork_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_vfork_works=cross else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_vfork_works=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 echo "${ECHO_T}$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_WORKING_VFORK 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define vfork fork _ACEOF fi if test "x$ac_cv_func_fork_works" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_WORKING_FORK 1 _ACEOF fi for ac_func in strlcpy strlcat fgetln do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test $ac_cv_c_compiler_gnu = yes; then { echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6; } if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi ## _AIX is offended by rpl_malloc and rpl_realloc #AC_FUNC_MALLOC #AC_FUNC_REALLOC { echo "$as_me:$LINENO: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; } if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_signal=int else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF { echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6; } if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then ac_cv_func_lstat_dereferences_slashed_symlink=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_lstat_dereferences_slashed_symlink=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5 echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6; } if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_stat_empty_string_bug=yes else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return stat ("", &sbuf) == 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_stat_empty_string_bug=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_stat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5 echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 _ACEOF fi for ac_func in endpwent isascii memchr memset re_comp regcomp strcasecmp strchr strcspn strdup strerror strrchr strstr strtol issetugid do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking whether getpwnam_r and getpwuid_r are posix like" >&5 echo $ECHO_N "checking whether getpwnam_r and getpwuid_r are posix like... $ECHO_C" >&6; } # The prototype for the POSIX version is: # int getpwnam_r(char *, struct passwd *, char *, size_t, struct passwd **) # int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **); cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { getpwnam_r(NULL, NULL, NULL, (size_t)0, NULL); getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETPW_R_POSIX 1 _ACEOF { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext { echo "$as_me:$LINENO: checking whether getpwnam_r and getpwuid_r are posix _draft_ like" >&5 echo $ECHO_N "checking whether getpwnam_r and getpwuid_r are posix _draft_ like... $ECHO_C" >&6; } # The prototype for the POSIX draft version is: # struct passwd *getpwuid_r(uid_t, struct passwd *, char *, int); # struct passwd *getpwnam_r(char *, struct passwd *, char *, int); cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { getpwnam_r(NULL, NULL, NULL, (size_t)0); getpwuid_r((uid_t)0, NULL, NULL, (size_t)0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETPW_R_DRAFT 1 _ACEOF { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext # End of libedit inclusions ac_config_files="$ac_config_files Makefile utils/Makefile lib/Makefile unix/Makefile glib/Makefile tcl/Makefile ui/Makefile lanserv/Makefile lanserv/OpenIPMI/Makefile sample/Makefile doc/Makefile man/Makefile swig/Makefile swig/perl/Makefile swig/python/Makefile swig/python/openipmigui/Makefile libedit/Makefile cmdlang/Makefile include/Makefile include/OpenIPMI/Makefile include/OpenIPMI/ipmiif.h include/OpenIPMI/internal/Makefile include/linux/Makefile OpenIPMI.spec OpenIPMIutils.pc OpenIPMI.pc OpenIPMIpthread.pc OpenIPMIposix.pc OpenIPMIglib.pc OpenIPMIglib12.pc OpenIPMItcl.pc OpenIPMIcmdlang.pc OpenIPMIui.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "utils/Makefile") CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "unix/Makefile") CONFIG_FILES="$CONFIG_FILES unix/Makefile" ;; "glib/Makefile") CONFIG_FILES="$CONFIG_FILES glib/Makefile" ;; "tcl/Makefile") CONFIG_FILES="$CONFIG_FILES tcl/Makefile" ;; "ui/Makefile") CONFIG_FILES="$CONFIG_FILES ui/Makefile" ;; "lanserv/Makefile") CONFIG_FILES="$CONFIG_FILES lanserv/Makefile" ;; "lanserv/OpenIPMI/Makefile") CONFIG_FILES="$CONFIG_FILES lanserv/OpenIPMI/Makefile" ;; "sample/Makefile") CONFIG_FILES="$CONFIG_FILES sample/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "swig/Makefile") CONFIG_FILES="$CONFIG_FILES swig/Makefile" ;; "swig/perl/Makefile") CONFIG_FILES="$CONFIG_FILES swig/perl/Makefile" ;; "swig/python/Makefile") CONFIG_FILES="$CONFIG_FILES swig/python/Makefile" ;; "swig/python/openipmigui/Makefile") CONFIG_FILES="$CONFIG_FILES swig/python/openipmigui/Makefile" ;; "libedit/Makefile") CONFIG_FILES="$CONFIG_FILES libedit/Makefile" ;; "cmdlang/Makefile") CONFIG_FILES="$CONFIG_FILES cmdlang/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "include/OpenIPMI/Makefile") CONFIG_FILES="$CONFIG_FILES include/OpenIPMI/Makefile" ;; "include/OpenIPMI/ipmiif.h") CONFIG_FILES="$CONFIG_FILES include/OpenIPMI/ipmiif.h" ;; "include/OpenIPMI/internal/Makefile") CONFIG_FILES="$CONFIG_FILES include/OpenIPMI/internal/Makefile" ;; "include/linux/Makefile") CONFIG_FILES="$CONFIG_FILES include/linux/Makefile" ;; "OpenIPMI.spec") CONFIG_FILES="$CONFIG_FILES OpenIPMI.spec" ;; "OpenIPMIutils.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIutils.pc" ;; "OpenIPMI.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMI.pc" ;; "OpenIPMIpthread.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIpthread.pc" ;; "OpenIPMIposix.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIposix.pc" ;; "OpenIPMIglib.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIglib.pc" ;; "OpenIPMIglib12.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIglib12.pc" ;; "OpenIPMItcl.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMItcl.pc" ;; "OpenIPMIcmdlang.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIcmdlang.pc" ;; "OpenIPMIui.pc") CONFIG_FILES="$CONFIG_FILES OpenIPMIui.pc" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim target!$target$ac_delim target_cpu!$target_cpu$ac_delim target_vendor!$target_vendor$ac_delim target_os!$target_os$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim ACLOCAL!$ACLOCAL$ac_delim AUTOCONF!$AUTOCONF$ac_delim AUTOMAKE!$AUTOMAKE$ac_delim AUTOHEADER!$AUTOHEADER$ac_delim MAKEINFO!$MAKEINFO$ac_delim install_sh!$install_sh$ac_delim STRIP!$STRIP$ac_delim INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim mkdir_p!$mkdir_p$ac_delim AWK!$AWK$ac_delim SET_MAKE!$SET_MAKE$ac_delim am__leading_dot!$am__leading_dot$ac_delim AMTAR!$AMTAR$ac_delim am__tar!$am__tar$ac_delim am__untar!$am__untar$ac_delim OPENIPMI_SMI!$OPENIPMI_SMI$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim DEPDIR!$DEPDIR$ac_delim am__include!$am__include$ac_delim am__quote!$am__quote$ac_delim AMDEP_TRUE!$AMDEP_TRUE$ac_delim AMDEP_FALSE!$AMDEP_FALSE$ac_delim AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim SED!$SED$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim LN_S!$LN_S$ac_delim ECHO!$ECHO$ac_delim AR!$AR$ac_delim RANLIB!$RANLIB$ac_delim DSYMUTIL!$DSYMUTIL$ac_delim NMEDIT!$NMEDIT$ac_delim CPP!$CPP$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF CEOF$ac_eof _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim CXXDEPMODE!$CXXDEPMODE$ac_delim am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim CXXCPP!$CXXCPP$ac_delim F77!$F77$ac_delim FFLAGS!$FFLAGS$ac_delim ac_ct_F77!$ac_ct_F77$ac_delim LIBTOOL!$LIBTOOL$ac_delim OPENIPMI_VERSION_MAJOR!$OPENIPMI_VERSION_MAJOR$ac_delim OPENIPMI_VERSION_MINOR!$OPENIPMI_VERSION_MINOR$ac_delim OPENIPMI_VERSION_RELEASE!$OPENIPMI_VERSION_RELEASE$ac_delim OPENIPMI_VERSION_EXTRA!$OPENIPMI_VERSION_EXTRA$ac_delim POPTLIBS!$POPTLIBS$ac_delim GDBM_LIB!$GDBM_LIB$ac_delim pkgprog!$pkgprog$ac_delim glibprog!$glibprog$ac_delim GLIB_VERSION!$GLIB_VERSION$ac_delim GLIB_CFLAGS!$GLIB_CFLAGS$ac_delim GLIB_LIBS!$GLIB_LIBS$ac_delim GLIB_LIB!$GLIB_LIB$ac_delim GLIB_SO!$GLIB_SO$ac_delim GLIB_PKGCONF!$GLIB_PKGCONF$ac_delim GLIB_TARGET!$GLIB_TARGET$ac_delim GLIB12_CFLAGS!$GLIB12_CFLAGS$ac_delim GLIB12_LIBS!$GLIB12_LIBS$ac_delim GLIB12_LIB!$GLIB12_LIB$ac_delim GLIB12_SO!$GLIB12_SO$ac_delim GLIB12_PKGCONF!$GLIB12_PKGCONF$ac_delim GLIB12_TARGET!$GLIB12_TARGET$ac_delim GLIB_DIR!$GLIB_DIR$ac_delim GLIB_SINGLE_LIB!$GLIB_SINGLE_LIB$ac_delim GLIB_SINGLE_SO!$GLIB_SINGLE_SO$ac_delim TCL_CFLAGS!$TCL_CFLAGS$ac_delim TCL_LIBS!$TCL_LIBS$ac_delim TCL_LIB!$TCL_LIB$ac_delim TCL_SO!$TCL_SO$ac_delim TCL_PKGCONF!$TCL_PKGCONF$ac_delim TCL_TARGET!$TCL_TARGET$ac_delim TCL_DIR!$TCL_DIR$ac_delim perlprog!$perlprog$ac_delim PERL_DIR!$PERL_DIR$ac_delim PERL_CFLAGS!$PERL_CFLAGS$ac_delim PERL_INSTALL_DIR!$PERL_INSTALL_DIR$ac_delim PERL_HAS_POSIX_THREADS!$PERL_HAS_POSIX_THREADS$ac_delim PERL_POSIX_LIB!$PERL_POSIX_LIB$ac_delim PERL_POSIX_SO!$PERL_POSIX_SO$ac_delim pythonprog!$pythonprog$ac_delim PYTHON_DIR!$PYTHON_DIR$ac_delim PYTHON_CFLAGS!$PYTHON_CFLAGS$ac_delim PYTHON_INSTALL_DIR!$PYTHON_INSTALL_DIR$ac_delim PYTHON_INSTALL_LIB_DIR!$PYTHON_INSTALL_LIB_DIR$ac_delim PYTHON_HAS_POSIX_THREADS!$PYTHON_HAS_POSIX_THREADS$ac_delim PYTHON_POSIX_LIB!$PYTHON_POSIX_LIB$ac_delim PYTHON_POSIX_SO!$PYTHON_POSIX_SO$ac_delim PYTHON_GUI_DIR!$PYTHON_GUI_DIR$ac_delim swigprog!$swigprog$ac_delim SWIG_DIR!$SWIG_DIR$ac_delim SWIG!$SWIG$ac_delim SNMPLIBS!$SNMPLIBS$ac_delim OPENSSLLIBS!$OPENSSLLIBS$ac_delim OPENSSLINCS!$OPENSSLINCS$ac_delim diaprog!$diaprog$ac_delim LATEX!$LATEX$ac_delim BIBTEX!$BIBTEX$ac_delim DVIPDF!$DVIPDF$ac_delim DIA!$DIA$ac_delim DIA_FILTER_NAME!$DIA_FILTER_NAME$ac_delim OPENIPMI_SWIG_LIBS!$OPENIPMI_SWIG_LIBS$ac_delim OPENIPMI_SWIG_SO!$OPENIPMI_SWIG_SO$ac_delim ALLOCA!$ALLOCA$ac_delim LIBOBJS!$LIBOBJS$ac_delim TERM_LIBS!$TERM_LIBS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 76; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' ac_dB='\\)[ (].*,\\1define\\2' ac_dC=' ' ac_dD=' ,' uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=50 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: cat >>$CONFIG_STATUS <<_ACEOF # First, check the format of the line: cat >"\$tmp/defines.sed" <<\\CEOF /^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def /^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def b :def _ACEOF sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`$as_dirname -- $ac_file || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| . 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi openipmi-2.0.18/unix/0000755000175000017500000000000011367555456013402 5ustar chuckchuckopenipmi-2.0.18/unix/heap.h0000644000175000017500000003570310336674617014474 0ustar chuckchuck/* * A heap "generic" or "template" in C. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * This is a heap C "generic", it allows you to define a heap for a * given type. To us this, create a file with something like: * * typedef struct heap_val_s { int a; } heap_val_t; -- The included element * * #define heap_node_s test_heap_node_s -- This is the name of the heap * element's structure. * #define heap_s test_heap_s -- This is the name of the heap type. * #define HEAP_EXPORT_NAME(s) test_ ## s -- This will prepend all the * names with a string, here * "test_". * #define HEAP_NAMES_LOCAL static -- This is only if you want the symbols * defined here to be local * static int * heap_cmp_key(heap_t val1, heap_t val2) * { * if (val1.a < val2.a) { * return -1; * } else if (val1.a > val2.a) { * return 1; * } else { * return 0; * } * } * #include * * The included element heap_val_t and the comparison function * heap_cmp_key may be #define's if you desire. * * The heap.h code will create a structure with the name defined by * heap_node_s that contains the element "val", which is heap_val_t. * It also contains other items you should not touch. The heap_node_s * structure is what you deal with. * * It will also create a structure with the named defined by heap_s * for the heap itself. * * The following functions are created, where xxx_ is the value you * give to HEAP_EXPORT_NAME(): * * void xxx_init(sruct heap_s *heap); * struct heap_node_s *xxx_get_top(sruct heap_s *heap); * void xxx_add(struct heap_s *heap, struct heap_node_s *elem); * void xxx_remove(struct heap_s *heap, struct heap_node_s *elem); * * To use the heap, first define or allocate a struct heap_s, and call * xxx_init() with it. * * To add an element to the heap, allocate a struct heap_node_s, fill * in your values, and then call xxx_add(heap, elem). You can only add * an element to the heap once. * * To remove an element, pass it in to xxx_remove(heap, elem). Then * you may free the element. * * The heap does not track membership, so be sure that the element * belongs to the proper heap. * * If you define HEAP_DEBUG, you also need to define the following: * * #define HEAP_OUTPUT_PRINTF "(%d)" * #define HEAP_OUTPUT_DATA pos->val.a * */ struct heap_node_s { heap_val_t val; /* Links for the heap. */ struct heap_node_s *left, *right, *up; }; struct heap_s { struct heap_node_s *top, *last; }; #ifndef HEAP_NAMES_LOCAL #define HEAP_NAMES_LOCAL #endif #ifdef HEAP_DEBUG #include static FILE **HEAP_EXPORT_NAME(debug_out) = &stderr; static void HEAP_EXPORT_NAME(print_item)(struct heap_node_s *pos, int indent) { int i; for (i=0; ileft, pos->right, pos->up, HEAP_OUTPUT_DATA); if (pos->left) HEAP_EXPORT_NAME(print_item)(pos->left, indent+1); if (pos->right) HEAP_EXPORT_NAME(print_item)(pos->right, indent+1); } static void HEAP_EXPORT_NAME(print)(struct heap_s *heap) { fprintf(*HEAP_EXPORT_NAME(debug_out), "top=%p\n", heap->top); if (heap->top) HEAP_EXPORT_NAME(print_item)(heap->top, 0); fprintf(*HEAP_EXPORT_NAME(debug_out), "last=%p\n", heap->last); fflush(*HEAP_EXPORT_NAME(debug_out)); } static void HEAP_EXPORT_NAME(check_item)(struct heap_node_s *curr, unsigned int *depth, unsigned int max_depth, struct heap_node_s **real_last, int *found_last) { if (! curr->left) { if (curr->right) { fprintf(*HEAP_EXPORT_NAME(debug_out), "Tree corrupt B\n"); *((int *) NULL) = 0; } else if (*depth > max_depth) { fprintf(*HEAP_EXPORT_NAME(debug_out), "Tree corrupt C\n"); *((int *) NULL) = 0; } else if ((*depth + 1) < max_depth) { fprintf(*HEAP_EXPORT_NAME(debug_out), "Tree corrupt D\n"); *((int *) NULL) = 0; } else if ((*found_last) && (*depth == max_depth)) { fprintf(*HEAP_EXPORT_NAME(debug_out), "Tree corrupt E\n"); *((int *) NULL) = 0; } else if (*depth == max_depth) { *real_last = curr; } else { *found_last = 1; } } else { if (curr->left->up != curr) { fprintf(*HEAP_EXPORT_NAME(debug_out), "Tree corrupt I\n"); *((int *) NULL) = 0; } if (heap_cmp_key(&(curr->left->val), &(curr->val)) < 0) { fprintf(*HEAP_EXPORT_NAME(debug_out), "Tree corrupt K\n"); *((int *) NULL) = 0; } (*depth)++; HEAP_EXPORT_NAME(check_item)(curr->left, depth, max_depth, real_last, found_last); (*depth)--; if (! curr->right) { if (*depth != (max_depth - 1)) { fprintf(*HEAP_EXPORT_NAME(debug_out), "Tree corrupt F\n"); *((int *) NULL) = 0; } if (*found_last) { fprintf(*HEAP_EXPORT_NAME(debug_out), "Tree corrupt G\n"); *((int *) NULL) = 0; } *found_last = 1; } else { if (curr->right->up != curr) { fprintf(*HEAP_EXPORT_NAME(debug_out), "Tree corrupt H\n"); *((int *) NULL) = 0; } if (heap_cmp_key(&(curr->right->val), &(curr->val)) < 0) { fprintf(*HEAP_EXPORT_NAME(debug_out), "Tree corrupt L\n"); *((int *) NULL) = 0; } (*depth)++; HEAP_EXPORT_NAME(check_item)(curr->right, depth, max_depth, real_last, found_last); (*depth)--; } } } static void HEAP_EXPORT_NAME(check)(struct heap_s *heap) { unsigned int depth = 0, max_depth = 0; int found_last = 0; struct heap_node_s *real_last; if (!heap->top) { if (heap->last) { fprintf(*HEAP_EXPORT_NAME(debug_out), "Tree corrupt A\n"); *((int *) NULL) = 0; } return; } real_last = heap->top; while (real_last->left) { real_last = real_last->left; max_depth++; } real_last = NULL; HEAP_EXPORT_NAME(check_item)(heap->top, &depth, max_depth, &real_last, &found_last); if (real_last != heap->last) { fprintf(*HEAP_EXPORT_NAME(debug_out), "Tree corrupt J\n"); *((int *) NULL) = 0; } fflush(*HEAP_EXPORT_NAME(debug_out)); } #endif static void HEAP_EXPORT_NAME(find_next_pos)(struct heap_node_s *curr, struct heap_node_s ***next, struct heap_node_s **parent) { unsigned int upcount = 0; if (curr->up && (curr->up->left == curr)) { /* We are a left node, the next node is just my right partner. */ *next = &(curr->up->right); *parent = curr->up; return; } /* While we are a right node, go up. */ while (curr->up && (curr->up->right == curr)) { upcount++; curr = curr->up; } if (curr->up) { /* Now we are a left node, trace up then back down. */ curr = curr->up->right; upcount--; } while (upcount) { curr = curr->left; upcount--; } *next = &(curr->left); *parent = curr; } static void HEAP_EXPORT_NAME(find_prev_elem)(struct heap_node_s *curr, struct heap_node_s **prev) { unsigned int upcount = 0; if (curr->up && (curr->up->right == curr)) { /* We are a right node, the previous node is just my left partner. */ *prev = curr->up->left; return; } /* While we are a left node, go up. */ while (curr->up && (curr->up->left == curr)) { upcount++; curr = curr->up; } if (curr->up) { /* Now we are a right node, trace up then back down. */ curr = curr->up->left; } else { /* We are going to the previous "row". */ upcount--; } while (upcount) { curr = curr->right; upcount--; } *prev = curr; } static void HEAP_EXPORT_NAME(send_up)(struct heap_node_s *elem, struct heap_node_s **top, struct heap_node_s **last) { struct heap_node_s *tmp1, *tmp2, *parent; parent = elem->up; while (parent && (heap_cmp_key(&elem->val, &parent->val) < 0)) { tmp1 = elem->left; tmp2 = elem->right; if (parent->left == elem) { elem->left = parent; elem->right = parent->right; if (elem->right) elem->right->up = elem; } else { elem->right = parent; elem->left = parent->left; if (elem->left) elem->left->up = elem; } elem->up = parent->up; if (parent->up) { if (parent->up->left == parent) { parent->up->left = elem; } else { parent->up->right = elem; } } else { *top = elem; } parent->up = elem; parent->left = tmp1; if (parent->left) parent->left->up = parent; parent->right = tmp2; if (parent->right) parent->right->up = parent; if (*last == elem) *last = parent; parent = elem->up; } } static void HEAP_EXPORT_NAME(send_down)(struct heap_node_s *elem, struct heap_node_s **top, struct heap_node_s **last) { struct heap_node_s *tmp1, *tmp2, *left, *right; left = elem->left; while (left) { right = elem->right; /* Choose the smaller of the two below me to swap with. */ if ((right) && (heap_cmp_key(&left->val, &right->val) > 0)) { if (heap_cmp_key(&elem->val, &right->val) > 0) { /* Swap with the right element. */ tmp1 = right->left; tmp2 = right->right; if (elem->up) { if (elem->up->left == elem) { elem->up->left = right; } else { elem->up->right = right; } } else { *top = right; } right->up = elem->up; elem->up = right; right->left = elem->left; right->right = elem; elem->left = tmp1; elem->right = tmp2; if (right->left) right->left->up = right; if (elem->left) elem->left->up = elem; if (elem->right) elem->right->up = elem; if (*last == right) *last = elem; } else goto done; } else { /* The left element is smaller, or the right doesn't exist. */ if (heap_cmp_key(&elem->val, &left->val) > 0) { /* Swap with the left element. */ tmp1 = left->left; tmp2 = left->right; if (elem->up) { if (elem->up->left == elem) { elem->up->left = left; } else { elem->up->right = left; } } else { *top = left; } left->up = elem->up; elem->up = left; left->left = elem; left->right = elem->right; elem->left = tmp1; elem->right = tmp2; if (left->right) left->right->up = left; if (elem->left) elem->left->up = elem; if (elem->right) elem->right->up = elem; if (*last == left) *last = elem; } else goto done; } left = elem->left; } done: return; } HEAP_NAMES_LOCAL void HEAP_EXPORT_NAME(add)(struct heap_s *heap, struct heap_node_s *elem) { struct heap_node_s **next; struct heap_node_s *parent; #ifdef HEAP_MASSIVE_DEBUG fprintf(*HEAP_EXPORT_NAME(debug_out), "HEAP_EXPORT_NAME(add_to_heap) entry\n"); HEAP_EXPORT_NAME(print)(heap->top, heap->last); HEAP_EXPORT_NAME(check)(heap->top, heap->last); #endif elem->left = NULL; elem->right = NULL; elem->up = NULL; if (heap->top == NULL) { heap->top = elem; heap->last = elem; goto out; } HEAP_EXPORT_NAME(find_next_pos)(heap->last, &next, &parent); *next = elem; elem->up = parent; heap->last = elem; if (heap_cmp_key(&elem->val, &parent->val) < 0) { HEAP_EXPORT_NAME(send_up)(elem, &(heap->top), &(heap->last)); } out: #ifdef HEAP_MASSIVE_DEBUG fprintf(*HEAP_EXPORT_NAME(debug_out), "HEAP_EXPORT_NAME(add_to_heap) exit\n"); HEAP_EXPORT_NAME(print)(heap->top, heap->last); HEAP_EXPORT_NAME(check)(heap->top, heap->last); #endif return; } HEAP_NAMES_LOCAL void HEAP_EXPORT_NAME(remove)(struct heap_s *heap, struct heap_node_s *elem) { struct heap_node_s *to_insert; #ifdef HEAP_MASSIVE_DEBUG fprintf(*HEAP_EXPORT_NAME(debug_out), "HEAP_EXPORT_NAME(remove_from_heap) entry\n"); HEAP_EXPORT_NAME(print)(heap->top, heap->last); HEAP_EXPORT_NAME(check)(heap->top, heap->last); #endif /* First remove the last element from the tree, if it's not what's being removed, we will use it for insertion into the removal place. */ to_insert = heap->last; if (! to_insert->up) { /* This is the only element in the heap. */ heap->top = NULL; heap->last = NULL; goto out; } else { /* Set the new last position, and remove the item we will insert. */ HEAP_EXPORT_NAME(find_prev_elem)(to_insert, &(heap->last)); if (to_insert->up->left == to_insert) { to_insert->up->left = NULL; } else { to_insert->up->right = NULL; } } if (elem == to_insert) { /* We got lucky and removed the last element. We are done. */ goto out; } /* Now stick the formerly last element into the removed element's position. */ if (elem->up) { if (elem->up->left == elem) { elem->up->left = to_insert; } else { elem->up->right = to_insert; } } else { /* The head of the tree is being replaced. */ heap->top = to_insert; } to_insert->up = elem->up; if (elem->left) elem->left->up = to_insert; if (elem->right) elem->right->up = to_insert; to_insert->left = elem->left; to_insert->right = elem->right; if (heap->last == elem) heap->last = to_insert; elem = to_insert; /* Now propigate it to the right place in the tree. */ if (elem->up && heap_cmp_key(&elem->val, &elem->up->val) < 0) { HEAP_EXPORT_NAME(send_up)(elem, &(heap->top), &(heap->last)); } else { HEAP_EXPORT_NAME(send_down)(elem, &(heap->top), &(heap->last)); } out: #ifdef HEAP_MASSIVE_DEBUG fprintf(*HEAP_EXPORT_NAME(debug_out), "remove_from_head exit\n"); HEAP_EXPORT_NAME(print)(heap->top, heap->last); HEAP_EXPORT_NAME(check)(heap->top, heap->last); #endif return; } HEAP_NAMES_LOCAL struct heap_node_s * HEAP_EXPORT_NAME(get_top)(struct heap_s *heap) { return heap->top; } HEAP_NAMES_LOCAL void HEAP_EXPORT_NAME(init)(struct heap_s *heap) { heap->top = NULL; heap->last = NULL; } openipmi-2.0.18/unix/test_heap.c0000644000175000017500000000724311363572740015517 0ustar chuckchuck/* * test_heap.c * * Code to test the heap. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002,2003 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #define HEAP_EXPORT_NAME(s) test_ ## s typedef struct heap_val_s { int a; } heap_val_t; #define heap_node_s test_heap_node_s #define heap_s test_heap_s typedef struct test_heap_node_s test_heap_node_t; typedef struct test_heap_s test_heap_t; int debug = 0; int heap_cmp_key(heap_val_t *val1, heap_val_t *val2) { if (val1->a < val2->a) { return -1; } else if (val1->a > val2->a) { return 1; } else { return 0; } } #define HEAP_OUTPUT_PRINTF "(%d)" #define HEAP_OUTPUT_DATA pos->val.a #define HEAP_DEBUG #include "heap.h" static int random_seed; void handle_fault(int sig) { fprintf(stderr, "Died on sig %d\n", sig); printf("Seed was %d\n", random_seed); exit(1); } #define TEST_SIZE 2048 test_heap_node_t *(nodes[TEST_SIZE]); int main(int argc, char *argv[]) { test_heap_t heap; int i; int err; test_heap_node_t *val1; struct sigaction act; int rand_val; i = 1; while ((i < argc) && (argv[i][0] == '-')) { if (strcmp(argv[i], "--") == 0) break; else if (strcmp(argv[i], "-d") == 0) debug++; else { fprintf(stderr, "Invalid option: '%s'\n", argv[i]); exit(1); } i++; } if (i < argc) { random_seed = atoi(argv[i]); } else { random_seed = time(NULL); } if (debug) printf("Random seed is %d\n", random_seed); srand(random_seed); test_debug_out = &stdout; act.sa_handler = handle_fault; sigemptyset(&act.sa_mask); act.sa_flags = 0; err = sigaction(SIGSEGV, &act, NULL); if (err) { perror("sigaction"); } test_init(&heap); for (i=0; i 1) printf("Removing item %d\n", nodes[rand_val]->val.a); test_remove(&heap, nodes[rand_val]); free(nodes[rand_val]); nodes[rand_val] = NULL; } else { val1 = malloc(sizeof(*val1)); val1->val.a = rand(); if (debug > 1) printf("Adding item %d\n", val1->val.a); test_add(&heap, val1); nodes[rand_val] = val1; } test_check(&heap); } if (debug > 1) test_print(&heap); if (debug) printf("Seed was %d\n", random_seed); return 0; } openipmi-2.0.18/unix/posix_thread_os_hnd.c0000644000175000017500000004751211267077121017565 0ustar chuckchuck/* * posix_os.c * * POSIX OS-handlers for OpenIPMI * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002,2003 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include /* Get the rwlocks for GNU. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_GDBM #include #endif #include #include #include #include /* CHEAP HACK - we don't want the user to have to provide this any more. */ extern void posix_vlog(char *format, enum ipmi_log_type_e log_type, va_list ap); #pragma weak posix_vlog typedef struct pt_os_hnd_data_s { selector_t *sel; os_vlog_t log_handler; int wake_sig; struct sigaction oldact; #ifdef HAVE_GDBM char *gdbm_filename; GDBM_FILE gdbmf; pthread_mutex_t gdbm_lock; #endif } pt_os_hnd_data_t; struct os_hnd_fd_id_s { int fd; void *cb_data; os_data_ready_t data_ready; os_handler_t *handler; os_fd_data_freed_t freed; }; static void fd_handler(int fd, void *data) { os_hnd_fd_id_t *fd_data = (os_hnd_fd_id_t *) data; void *cb_data; os_data_ready_t handler; handler = fd_data->data_ready; cb_data = fd_data->cb_data; handler(fd, cb_data, fd_data); } static void free_fd_data(int fd, void *data) { os_hnd_fd_id_t *fd_data = data; if (fd_data->freed) fd_data->freed(fd, fd_data->cb_data); free(data); } static int add_fd(os_handler_t *handler, int fd, os_data_ready_t data_ready, void *cb_data, os_fd_data_freed_t freed, os_hnd_fd_id_t **id) { os_hnd_fd_id_t *fd_data; int rv; pt_os_hnd_data_t *info = handler->internal_data; selector_t *posix_sel = info->sel; fd_data = malloc(sizeof(*fd_data)); if (!fd_data) return ENOMEM; fd_data->fd = fd; fd_data->cb_data = cb_data; fd_data->data_ready = data_ready; fd_data->handler = handler; fd_data->freed = freed; sel_set_fd_write_handler(posix_sel, fd, SEL_FD_HANDLER_DISABLED); sel_set_fd_except_handler(posix_sel, fd, SEL_FD_HANDLER_DISABLED); rv = sel_set_fd_handlers(posix_sel, fd, fd_data, fd_handler, NULL, NULL, free_fd_data); if (rv) { free(fd_data); return rv; } sel_set_fd_read_handler(posix_sel, fd, SEL_FD_HANDLER_ENABLED); *id = fd_data; return 0; } static int remove_fd(os_handler_t *handler, os_hnd_fd_id_t *fd_data) { pt_os_hnd_data_t *info = handler->internal_data; selector_t *posix_sel = info->sel; sel_set_fd_read_handler(posix_sel, fd_data->fd, SEL_FD_HANDLER_DISABLED); sel_clear_fd_handlers(posix_sel, fd_data->fd); /* fd_data gets freed in the free_fd_data callback registered at set time. */ return 0; } struct os_hnd_timer_id_s { void *cb_data; os_timed_out_t timed_out; sel_timer_t *timer; int running; os_handler_t *handler; }; static void timer_handler(selector_t *sel, sel_timer_t *timer, void *data) { os_hnd_timer_id_t *timer_data = (os_hnd_timer_id_t *) data; /* Make a copy of this, because the handler may delete the timer data. */ void *cb_data; os_timed_out_t timed_out; timed_out = timer_data->timed_out; cb_data = timer_data->cb_data; timer_data->running = 0; timed_out(cb_data, timer_data); } static int start_timer(os_handler_t *handler, os_hnd_timer_id_t *id, struct timeval *timeout, os_timed_out_t timed_out, void *cb_data) { struct timeval now; if (id->running) return EBUSY; id->running = 1; id->cb_data = cb_data; id->timed_out = timed_out; gettimeofday(&now, NULL); now.tv_sec += timeout->tv_sec; now.tv_usec += timeout->tv_usec; while (now.tv_usec >= 1000000) { now.tv_usec -= 1000000; now.tv_sec += 1; } return sel_start_timer(id->timer, &now); } static int stop_timer(os_handler_t *handler, os_hnd_timer_id_t *timer_data) { return sel_stop_timer(timer_data->timer); } static int alloc_timer(os_handler_t *handler, os_hnd_timer_id_t **id) { os_hnd_timer_id_t *timer_data; int rv; pt_os_hnd_data_t *info = handler->internal_data; selector_t *posix_sel = info->sel; timer_data = malloc(sizeof(*timer_data)); if (!timer_data) return ENOMEM; timer_data->running = 0; timer_data->timed_out = NULL; timer_data->handler = handler; rv = sel_alloc_timer(posix_sel, timer_handler, timer_data, &(timer_data->timer)); if (rv) { free(timer_data); return rv; } *id = timer_data; return 0; } static int free_timer(os_handler_t *handler, os_hnd_timer_id_t *timer_data) { sel_free_timer(timer_data->timer); free(timer_data); return 0; } static int get_random(os_handler_t *handler, void *data, unsigned int len) { int fd = open("/dev/urandom", O_RDONLY); int rv; if (fd == -1) return errno; while (len > 0) { rv = read(fd, data, len); if (rv < 0) { rv = errno; goto out; } len -= rv; data += rv; } rv = 0; out: close(fd); return rv; } static void default_vlog(const char *format, enum ipmi_log_type_e log_type, va_list ap) { int do_nl = 1; switch(log_type) { case IPMI_LOG_INFO: fprintf(stderr, "INFO: "); break; case IPMI_LOG_WARNING: fprintf(stderr, "WARN: "); break; case IPMI_LOG_SEVERE: fprintf(stderr, "SEVR: "); break; case IPMI_LOG_FATAL: fprintf(stderr, "FATL: "); break; case IPMI_LOG_ERR_INFO: fprintf(stderr, "EINF: "); break; case IPMI_LOG_DEBUG_START: do_nl = 0; /* FALLTHROUGH */ case IPMI_LOG_DEBUG: fprintf(stderr, "DEBG: "); break; case IPMI_LOG_DEBUG_CONT: do_nl = 0; /* FALLTHROUGH */ case IPMI_LOG_DEBUG_END: break; } vfprintf(stderr, format, ap); if (do_nl) fprintf(stderr, "\n"); } static void sposix_vlog(os_handler_t *handler, enum ipmi_log_type_e log_type, const char *format, va_list ap) { pt_os_hnd_data_t *info = handler->internal_data; os_vlog_t log_handler = info->log_handler; if (log_handler) log_handler(handler, format, log_type, ap); else if (posix_vlog) posix_vlog((char *) format, log_type, ap); else default_vlog(format, log_type, ap); } static void sposix_log(os_handler_t *handler, enum ipmi_log_type_e log_type, const char *format, ...) { va_list ap; va_start(ap, format); sposix_vlog(handler, log_type, format, ap); va_end(ap); } struct os_hnd_lock_s { pthread_mutex_t mutex; int lock_count; /* This is volatile and we always set the owner before we set the count. That avoids race conditions checking the count and owner. */ volatile pthread_t owner; }; static int create_lock(os_handler_t *handler, os_hnd_lock_t **id) { os_hnd_lock_t *lock; int rv; lock = malloc(sizeof(*lock)); if (!lock) return ENOMEM; rv = pthread_mutex_init(&lock->mutex, NULL); if (rv) { free(lock); return rv; } lock->lock_count = 0; *id = lock; return 0; } static int destroy_lock(os_handler_t *handler, os_hnd_lock_t *id) { int rv; if (id->lock_count != 0) handler->log(handler, IPMI_LOG_FATAL, "Destroy of lock when count is not zero"); rv = pthread_mutex_destroy(&id->mutex); if (rv) return rv; free(id); return 0; } static int lock(os_handler_t *handler, os_hnd_lock_t *id) { int rv; if ((id->lock_count == 0) || (pthread_self() != id->owner)) { rv = pthread_mutex_lock(&id->mutex); if (rv) return rv; } id->owner = pthread_self(); id->lock_count++; return 0; } static int unlock(os_handler_t *handler, os_hnd_lock_t *id) { int rv; if (id->lock_count == 0) handler->log(handler, IPMI_LOG_FATAL, "lock count went negative"); if (pthread_self() != id->owner) handler->log(handler, IPMI_LOG_FATAL, "lock release by non-owner"); id->lock_count--; if (id->lock_count == 0) { rv = pthread_mutex_unlock(&id->mutex); if (rv) { id->lock_count++; return rv; } } return 0; } struct os_hnd_cond_s { pthread_cond_t cond; }; static int create_cond(os_handler_t *handler, os_hnd_cond_t **new_cond) { os_hnd_cond_t *cond; int rv; cond = malloc(sizeof(*cond)); if (!cond) return ENOMEM; rv = pthread_cond_init(&cond->cond, NULL); if (rv) { free(cond); return rv; } *new_cond = cond; return 0; } static int destroy_cond(os_handler_t *handler, os_hnd_cond_t *cond) { int rv; rv = pthread_cond_destroy(&cond->cond); if (rv) return rv; free(cond); return 0; } static int cond_wait(os_handler_t *handler, os_hnd_cond_t *cond, os_hnd_lock_t *lock) { int rv; int old_lock_count; pthread_t old_owner; old_lock_count = lock->lock_count; old_owner = lock->owner; lock->lock_count = 0; rv = pthread_cond_wait(&cond->cond, &lock->mutex); lock->lock_count = old_lock_count; lock->owner = old_owner; return rv; } static int cond_timedwait(os_handler_t *handler, os_hnd_cond_t *cond, os_hnd_lock_t *lock, struct timeval *timeout) { struct timespec spec; struct timeval now; int rv; int old_lock_count; pthread_t old_owner; gettimeofday(&now, NULL); spec.tv_sec = timeout->tv_sec + now.tv_sec; spec.tv_nsec = (timeout->tv_usec + now.tv_usec) * 1000; while (spec.tv_nsec > 1000000000) { spec.tv_sec += 1; spec.tv_nsec -= 1000000000; } old_lock_count = lock->lock_count; old_owner = lock->owner; lock->lock_count = 0; rv = pthread_cond_timedwait(&cond->cond, &lock->mutex, &spec); lock->lock_count = old_lock_count; lock->owner = old_owner; return rv; } static int cond_wake(os_handler_t *handler, os_hnd_cond_t *cond) { return pthread_cond_signal(&cond->cond); } static int cond_broadcast(os_handler_t *handler, os_hnd_cond_t *cond) { return pthread_cond_broadcast(&cond->cond); } static int create_thread(os_handler_t *handler, int priority, void (*startup)(void *data), void *data) { pthread_attr_t attr, *pattr = NULL; struct sched_param param; int rv; pthread_t tid; if (priority) { rv = pthread_attr_init(&attr); if (rv) return rv; rv = pthread_attr_setschedpolicy(&attr, SCHED_FIFO); if (rv) goto out; param.sched_priority = priority; rv = pthread_attr_setschedparam(&attr, ¶m); if (rv) goto out; pattr = &attr; } rv = pthread_create(&tid, pattr, (void *(*)(void *)) startup, data); out: if (pattr) pthread_attr_destroy(pattr); return rv; } static int thread_exit(os_handler_t *handler) { pthread_exit(NULL); } void ipmi_posix_thread_free_os_handler(os_handler_t *os_hnd) { pt_os_hnd_data_t *info = os_hnd->internal_data; #ifdef HAVE_GDBM pthread_mutex_destroy(&info->gdbm_lock); if (info->gdbm_filename) free(info->gdbm_filename); if (info->gdbmf) gdbm_close(info->gdbmf); #endif free(info); free(os_hnd); } void ipmi_posix_thread_os_handler_set_sel(os_handler_t *os_hnd, selector_t *sel) { pt_os_hnd_data_t *info = os_hnd->internal_data; info->sel = sel; } selector_t * ipmi_posix_thread_os_handler_get_sel(os_handler_t *os_hnd) { pt_os_hnd_data_t *info = os_hnd->internal_data; return info->sel; } static void posix_thread_sighandler(int sig) { /* Nothing to do, sending the sig just wakes up select(). */ } static void posix_thread_send_sig(long thread_id, void *cb_data) { pthread_t *id = (void *) thread_id; pt_os_hnd_data_t *info = cb_data; pthread_kill(*id, info->wake_sig); } static int perform_one_op(os_handler_t *os_hnd, struct timeval *timeout) { pthread_t self = pthread_self(); pt_os_hnd_data_t *info = os_hnd->internal_data; int rv; rv = sel_select(info->sel, posix_thread_send_sig, (long) &self, info, timeout); if (rv == -1) return errno; return 0; } static void operation_loop(os_handler_t *os_hnd) { pthread_t self = pthread_self(); pt_os_hnd_data_t *info = os_hnd->internal_data; sel_select_loop(info->sel, posix_thread_send_sig, (long) &self, info); } static void free_os_handler(os_handler_t *os_hnd) { pt_os_hnd_data_t *info = os_hnd->internal_data; sigaction(info->wake_sig, &info->oldact, NULL); sel_free_selector(info->sel); ipmi_posix_thread_free_os_handler(os_hnd); } static void * posix_malloc(int size) { return malloc(size); } static void posix_free(void *data) { free(data); } #ifdef HAVE_GDBM #define GDBM_FILE ".OpenIPMI_db" static void init_gdbm(pt_os_hnd_data_t *info) { if (!info->gdbm_filename) { char *home = getenv("HOME"); if (!home) return; info->gdbm_filename = malloc(strlen(home)+strlen(GDBM_FILE)+2); if (!info->gdbm_filename) return; strcpy(info->gdbm_filename, home); strcat(info->gdbm_filename, "/"); strcat(info->gdbm_filename, GDBM_FILE); } info->gdbmf = gdbm_open(info->gdbm_filename, 512, GDBM_WRCREAT, 0600, NULL); /* gdbmf will be NULL on error, which is what reports an error. */ } static int database_store(os_handler_t *handler, char *key, unsigned char *data, unsigned int data_len) { pt_os_hnd_data_t *info = handler->internal_data; datum gkey, gdata; int rv; pthread_mutex_lock(&info->gdbm_lock); if (!info->gdbmf) { init_gdbm(info); if (!info->gdbmf) { pthread_mutex_unlock(&info->gdbm_lock); return EINVAL; } } gkey.dptr = key; gkey.dsize = strlen(key); gdata.dptr = (char *) data; gdata.dsize = data_len; rv = gdbm_store(info->gdbmf, gkey, gdata, GDBM_REPLACE); pthread_mutex_unlock(&info->gdbm_lock); if (rv) return EINVAL; return 0; } static int database_find(os_handler_t *handler, char *key, unsigned int *fetch_completed, unsigned char **data, unsigned int *data_len, void (*got_data)(void *cb_data, int err, unsigned char *data, unsigned int data_len), void *cb_data) { pt_os_hnd_data_t *info = handler->internal_data; datum gkey, gdata; pthread_mutex_lock(&info->gdbm_lock); if (!info->gdbmf) { init_gdbm(info); if (!info->gdbmf) { pthread_mutex_unlock(&info->gdbm_lock); return EINVAL; } } gkey.dptr = key; gkey.dsize = strlen(key); gdata = gdbm_fetch(info->gdbmf, gkey); pthread_mutex_unlock(&info->gdbm_lock); if (!gdata.dptr) return EINVAL; *data = (unsigned char *) gdata.dptr; *data_len = gdata.dsize; *fetch_completed = 1; return 0; } static void database_free(os_handler_t *handler, unsigned char *data) { free(data); } static int set_gdbm_filename(os_handler_t *os_hnd, char *name) { pt_os_hnd_data_t *info = os_hnd->internal_data; char *nname; nname = strdup(name); if (!nname) return ENOMEM; if (info->gdbm_filename) free(info->gdbm_filename); info->gdbm_filename = nname; return 0; } #endif static void sset_log_handler(os_handler_t *handler, os_vlog_t log_handler) { pt_os_hnd_data_t *info = handler->internal_data; info->log_handler = log_handler; } static os_handler_t ipmi_posix_thread_os_handler = { .mem_alloc = posix_malloc, .mem_free = posix_free, .add_fd_to_wait_for = add_fd, .remove_fd_to_wait_for = remove_fd, .start_timer = start_timer, .stop_timer = stop_timer, .alloc_timer = alloc_timer, .free_timer = free_timer, .create_lock = create_lock, .destroy_lock = destroy_lock, .lock = lock, .unlock = unlock, .get_random = get_random, .log = sposix_log, .vlog = sposix_vlog, .create_cond = create_cond, .destroy_cond = destroy_cond, .cond_wait = cond_wait, .cond_timedwait = cond_timedwait, .cond_wake = cond_wake, .cond_broadcast = cond_broadcast, .create_thread = create_thread, .thread_exit = thread_exit, .free_os_handler = free_os_handler, .perform_one_op = perform_one_op, .operation_loop = operation_loop, #ifdef HAVE_GDBM .database_store = database_store, .database_find = database_find, .database_free = database_free, .database_set_filename = set_gdbm_filename, #endif .set_log_handler = sset_log_handler, }; os_handler_t * ipmi_posix_thread_get_os_handler(void) { os_handler_t *rv; pt_os_hnd_data_t *info; #ifdef HAVE_GDBM int err; #endif rv = malloc(sizeof(*rv)); if (!rv) return NULL; memcpy(rv, &ipmi_posix_thread_os_handler, sizeof(*rv)); info = malloc(sizeof(pt_os_hnd_data_t)); if (!info) { free(rv); return NULL; } memset(info, 0, sizeof(*info)); rv->internal_data = info; #ifdef HAVE_GDBM err = pthread_mutex_init(&info->gdbm_lock, NULL); if (err) { free(info); free(rv); return NULL; } #endif return rv; } os_handler_t * ipmi_posix_thread_setup_os_handler(int wake_sig) { os_handler_t *os_hnd; pt_os_hnd_data_t *info; struct sigaction act; int rv; os_hnd = ipmi_posix_thread_get_os_handler(); if (!os_hnd) return NULL; info = os_hnd->internal_data; info->wake_sig = wake_sig; rv = sel_alloc_selector(os_hnd, &info->sel); if (rv) { ipmi_posix_thread_free_os_handler(os_hnd); os_hnd = NULL; goto out; } act.sa_handler = posix_thread_sighandler; sigemptyset(&act.sa_mask); act.sa_flags = 0; rv = sigaction(wake_sig, &act, &info->oldact); if (rv) { ipmi_posix_thread_free_os_handler(os_hnd); os_hnd = NULL; goto out; } out: return os_hnd; } /* * Cruft below, do not use these any more. */ int ipmi_posix_thread_sel_select(os_handler_t *os_hnd, struct timeval *timeout) { return perform_one_op(os_hnd, timeout); } void ipmi_posix_thread_sel_select_loop(os_handler_t *os_hnd) { operation_loop(os_hnd); } void ipmi_posix_thread_cleanup_os_handler(os_handler_t *os_hnd) { free_os_handler(os_hnd); } openipmi-2.0.18/unix/Makefile.am0000644000175000017500000000251410700453404015414 0ustar chuckchuck empty:= space:= $(empty) $(empty) LIB_VERSION = 0.0.1 SPACE_VERSION = $(subst .,$(space),$(LIB_VERSION)) VERSION_CURRENT = $(wordlist 1, 1, $(SPACE_VERSION)) VERSION_REVISION = $(wordlist 3, 3, $(SPACE_VERSION)) VERSION_AGE = $(wordlist 2, 2, $(SPACE_VERSION)) LD_VERSION = $(VERSION_CURRENT):$(VERSION_REVISION):$(VERSION_AGE) AM_CFLAGS = -Wall -Wsign-compare -I$(top_srcdir)/include lib_LTLIBRARIES = libOpenIPMIposix.la libOpenIPMIpthread.la libOpenIPMIpthread_la_SOURCES = posix_thread_os_hnd.c selector.c libOpenIPMIpthread_la_LIBADD = -lpthread $(GDBM_LIB) \ $(top_builddir)/utils/libOpenIPMIutils.la libOpenIPMIpthread_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ -Wl,-Map -Wl,libOpenIPMIpthread.map libOpenIPMIposix_la_SOURCES = posix_os_hnd.c selector.c libOpenIPMIposix_la_LIBADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(GDBM_LIB) libOpenIPMIposix_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ -Wl,-Map -Wl,libOpenIPMIposix.map -R$(libdir) noinst_HEADERS = heap.h noinst_PROGRAMS = test_heap test_handlers test_heap_SOURCES = test_heap.c test_heap_LDADD = test_handlers_SOURCES = test_handlers.c test_handlers_LDADD = libOpenIPMIposix.la libOpenIPMIpthread.la \ $(top_builddir)/utils/libOpenIPMIutils.la $(GDBM_LIB) TESTS = test_heap test_handlers CLEANFILES = libOpenIPMIposix.map libOpenIPMIpthread.map openipmi-2.0.18/unix/Makefile.in0000644000175000017500000005303711367554431015447 0ustar chuckchuck# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ noinst_PROGRAMS = test_heap$(EXEEXT) test_handlers$(EXEEXT) subdir = unix DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libOpenIPMIposix_la_DEPENDENCIES = \ $(top_builddir)/utils/libOpenIPMIutils.la \ $(am__DEPENDENCIES_1) am_libOpenIPMIposix_la_OBJECTS = posix_os_hnd.lo selector.lo libOpenIPMIposix_la_OBJECTS = $(am_libOpenIPMIposix_la_OBJECTS) libOpenIPMIpthread_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(top_builddir)/utils/libOpenIPMIutils.la am_libOpenIPMIpthread_la_OBJECTS = posix_thread_os_hnd.lo selector.lo libOpenIPMIpthread_la_OBJECTS = $(am_libOpenIPMIpthread_la_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) am_test_handlers_OBJECTS = test_handlers.$(OBJEXT) test_handlers_OBJECTS = $(am_test_handlers_OBJECTS) test_handlers_DEPENDENCIES = libOpenIPMIposix.la libOpenIPMIpthread.la \ $(top_builddir)/utils/libOpenIPMIutils.la \ $(am__DEPENDENCIES_1) am_test_heap_OBJECTS = test_heap.$(OBJEXT) test_heap_OBJECTS = $(am_test_heap_OBJECTS) test_heap_DEPENDENCIES = DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libOpenIPMIposix_la_SOURCES) \ $(libOpenIPMIpthread_la_SOURCES) $(test_handlers_SOURCES) \ $(test_heap_SOURCES) DIST_SOURCES = $(libOpenIPMIposix_la_SOURCES) \ $(libOpenIPMIpthread_la_SOURCES) $(test_handlers_SOURCES) \ $(test_heap_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BIBTEX = @BIBTEX@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIA = @DIA@ DIA_FILTER_NAME = @DIA_FILTER_NAME@ DSYMUTIL = @DSYMUTIL@ DVIPDF = @DVIPDF@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GDBM_LIB = @GDBM_LIB@ GLIB12_CFLAGS = @GLIB12_CFLAGS@ GLIB12_LIB = @GLIB12_LIB@ GLIB12_LIBS = @GLIB12_LIBS@ GLIB12_PKGCONF = @GLIB12_PKGCONF@ GLIB12_SO = @GLIB12_SO@ GLIB12_TARGET = @GLIB12_TARGET@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_DIR = @GLIB_DIR@ GLIB_LIB = @GLIB_LIB@ GLIB_LIBS = @GLIB_LIBS@ GLIB_PKGCONF = @GLIB_PKGCONF@ GLIB_SINGLE_LIB = @GLIB_SINGLE_LIB@ GLIB_SINGLE_SO = @GLIB_SINGLE_SO@ GLIB_SO = @GLIB_SO@ GLIB_TARGET = @GLIB_TARGET@ GLIB_VERSION = @GLIB_VERSION@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NMEDIT = @NMEDIT@ OBJEXT = @OBJEXT@ OPENIPMI_SMI = @OPENIPMI_SMI@ OPENIPMI_SWIG_LIBS = @OPENIPMI_SWIG_LIBS@ OPENIPMI_SWIG_SO = @OPENIPMI_SWIG_SO@ OPENIPMI_VERSION_EXTRA = @OPENIPMI_VERSION_EXTRA@ OPENIPMI_VERSION_MAJOR = @OPENIPMI_VERSION_MAJOR@ OPENIPMI_VERSION_MINOR = @OPENIPMI_VERSION_MINOR@ OPENIPMI_VERSION_RELEASE = @OPENIPMI_VERSION_RELEASE@ OPENSSLINCS = @OPENSSLINCS@ OPENSSLLIBS = @OPENSSLLIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_CFLAGS = @PERL_CFLAGS@ PERL_DIR = @PERL_DIR@ PERL_HAS_POSIX_THREADS = @PERL_HAS_POSIX_THREADS@ PERL_INSTALL_DIR = @PERL_INSTALL_DIR@ PERL_POSIX_LIB = @PERL_POSIX_LIB@ PERL_POSIX_SO = @PERL_POSIX_SO@ POPTLIBS = @POPTLIBS@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_DIR = @PYTHON_DIR@ PYTHON_GUI_DIR = @PYTHON_GUI_DIR@ PYTHON_HAS_POSIX_THREADS = @PYTHON_HAS_POSIX_THREADS@ PYTHON_INSTALL_DIR = @PYTHON_INSTALL_DIR@ PYTHON_INSTALL_LIB_DIR = @PYTHON_INSTALL_LIB_DIR@ PYTHON_POSIX_LIB = @PYTHON_POSIX_LIB@ PYTHON_POSIX_SO = @PYTHON_POSIX_SO@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SNMPLIBS = @SNMPLIBS@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_DIR = @SWIG_DIR@ TCL_CFLAGS = @TCL_CFLAGS@ TCL_DIR = @TCL_DIR@ TCL_LIB = @TCL_LIB@ TCL_LIBS = @TCL_LIBS@ TCL_PKGCONF = @TCL_PKGCONF@ TCL_SO = @TCL_SO@ TCL_TARGET = @TCL_TARGET@ TERM_LIBS = @TERM_LIBS@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ diaprog = @diaprog@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ glibprog = @glibprog@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlprog = @perlprog@ pkgprog = @pkgprog@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pythonprog = @pythonprog@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ swigprog = @swigprog@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ empty := space := $(empty) $(empty) LIB_VERSION = 0.0.1 SPACE_VERSION = $(subst .,$(space),$(LIB_VERSION)) VERSION_CURRENT = $(wordlist 1, 1, $(SPACE_VERSION)) VERSION_REVISION = $(wordlist 3, 3, $(SPACE_VERSION)) VERSION_AGE = $(wordlist 2, 2, $(SPACE_VERSION)) LD_VERSION = $(VERSION_CURRENT):$(VERSION_REVISION):$(VERSION_AGE) AM_CFLAGS = -Wall -Wsign-compare -I$(top_srcdir)/include lib_LTLIBRARIES = libOpenIPMIposix.la libOpenIPMIpthread.la libOpenIPMIpthread_la_SOURCES = posix_thread_os_hnd.c selector.c libOpenIPMIpthread_la_LIBADD = -lpthread $(GDBM_LIB) \ $(top_builddir)/utils/libOpenIPMIutils.la libOpenIPMIpthread_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ -Wl,-Map -Wl,libOpenIPMIpthread.map libOpenIPMIposix_la_SOURCES = posix_os_hnd.c selector.c libOpenIPMIposix_la_LIBADD = $(top_builddir)/utils/libOpenIPMIutils.la \ $(GDBM_LIB) libOpenIPMIposix_la_LDFLAGS = -rdynamic -version-info $(LD_VERSION) \ -Wl,-Map -Wl,libOpenIPMIposix.map -R$(libdir) noinst_HEADERS = heap.h test_heap_SOURCES = test_heap.c test_heap_LDADD = test_handlers_SOURCES = test_handlers.c test_handlers_LDADD = libOpenIPMIposix.la libOpenIPMIpthread.la \ $(top_builddir)/utils/libOpenIPMIutils.la $(GDBM_LIB) TESTS = test_heap test_handlers CLEANFILES = libOpenIPMIposix.map libOpenIPMIpthread.map all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu unix/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu unix/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libOpenIPMIposix.la: $(libOpenIPMIposix_la_OBJECTS) $(libOpenIPMIposix_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libOpenIPMIposix_la_LDFLAGS) $(libOpenIPMIposix_la_OBJECTS) $(libOpenIPMIposix_la_LIBADD) $(LIBS) libOpenIPMIpthread.la: $(libOpenIPMIpthread_la_OBJECTS) $(libOpenIPMIpthread_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libOpenIPMIpthread_la_LDFLAGS) $(libOpenIPMIpthread_la_OBJECTS) $(libOpenIPMIpthread_la_LIBADD) $(LIBS) clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done test_handlers$(EXEEXT): $(test_handlers_OBJECTS) $(test_handlers_DEPENDENCIES) @rm -f test_handlers$(EXEEXT) $(LINK) $(test_handlers_LDFLAGS) $(test_handlers_OBJECTS) $(test_handlers_LDADD) $(LIBS) test_heap$(EXEEXT): $(test_heap_OBJECTS) $(test_heap_DEPENDENCIES) @rm -f test_heap$(EXEEXT) $(LINK) $(test_heap_LDFLAGS) $(test_heap_OBJECTS) $(test_heap_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_os_hnd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_thread_os_hnd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/selector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_handlers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_heap.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list='$(TESTS)'; \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ echo "XPASS: $$tst"; \ ;; \ *) \ echo "PASS: $$tst"; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xfail=`expr $$xfail + 1`; \ echo "XFAIL: $$tst"; \ ;; \ *) \ failed=`expr $$failed + 1`; \ echo "FAIL: $$tst"; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ echo "SKIP: $$tst"; \ fi; \ done; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="All $$all tests passed"; \ else \ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all tests failed"; \ else \ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ skipped="($$skip tests were not run)"; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-generic clean-libLTLIBRARIES clean-libtool \ clean-noinstPROGRAMS ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-exec install-exec-am \ install-info install-info-am install-libLTLIBRARIES \ install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am uninstall-libLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: openipmi-2.0.18/unix/posix_os_hnd.c0000644000175000017500000003271011267100730016221 0ustar chuckchuck/* * posix_os.c * * POSIX OS-handlers for OpenIPMI * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002,2003 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_GDBM #include #endif #include /* CHEAP HACK - we don't want the user to have to provide this any more. */ extern void posix_vlog(char *format, enum ipmi_log_type_e log_type, va_list ap); #pragma weak posix_vlog typedef struct iposix_info_s { selector_t *sel; os_vlog_t log_handler; #ifdef HAVE_GDBM char *gdbm_filename; GDBM_FILE gdbmf; #endif } iposix_info_t; struct os_hnd_fd_id_s { int fd; void *cb_data; os_data_ready_t data_ready; os_handler_t *handler; os_fd_data_freed_t freed; }; static void fd_handler(int fd, void *data) { os_hnd_fd_id_t *fd_data = (os_hnd_fd_id_t *) data; void *cb_data; os_handler_t *handler; handler = fd_data->handler; cb_data = fd_data->cb_data; fd_data->data_ready(fd, fd_data->cb_data, fd_data); } static void free_fd_data(int fd, void *data) { os_hnd_fd_id_t *fd_data = data; if (fd_data->freed) fd_data->freed(fd, fd_data->cb_data); free(data); } static int add_fd(os_handler_t *handler, int fd, os_data_ready_t data_ready, void *cb_data, os_fd_data_freed_t freed, os_hnd_fd_id_t **id) { os_hnd_fd_id_t *fd_data; int rv; iposix_info_t *info = handler->internal_data; selector_t *posix_sel = info->sel; fd_data = malloc(sizeof(*fd_data)); if (!fd_data) return ENOMEM; fd_data->fd = fd; fd_data->cb_data = cb_data; fd_data->data_ready = data_ready; fd_data->handler = handler; fd_data->freed = freed; sel_set_fd_write_handler(posix_sel, fd, SEL_FD_HANDLER_DISABLED); sel_set_fd_except_handler(posix_sel, fd, SEL_FD_HANDLER_DISABLED); rv = sel_set_fd_handlers(posix_sel, fd, fd_data, fd_handler, NULL, NULL, free_fd_data); if (rv) { free(fd_data); return rv; } sel_set_fd_read_handler(posix_sel, fd, SEL_FD_HANDLER_ENABLED); *id = fd_data; return 0; } static int remove_fd(os_handler_t *handler, os_hnd_fd_id_t *fd_data) { iposix_info_t *info = handler->internal_data; selector_t *posix_sel = info->sel; sel_set_fd_read_handler(posix_sel, fd_data->fd, SEL_FD_HANDLER_DISABLED); sel_clear_fd_handlers(posix_sel, fd_data->fd); /* fd_data gets freed in the free_fd_data callback registered at set time. */ return 0; } struct os_hnd_timer_id_s { void *cb_data; os_timed_out_t timed_out; sel_timer_t *timer; int running; os_handler_t *handler; }; static void timer_handler(selector_t *sel, sel_timer_t *timer, void *data) { os_hnd_timer_id_t *timer_data = (os_hnd_timer_id_t *) data; /* Make a copy of this, because the handler may delete the timer data. */ void *cb_data; os_timed_out_t timed_out; timed_out = timer_data->timed_out; cb_data = timer_data->cb_data; timer_data->running = 0; timed_out(cb_data, timer_data); } static int start_timer(os_handler_t *handler, os_hnd_timer_id_t *id, struct timeval *timeout, os_timed_out_t timed_out, void *cb_data) { struct timeval now; if (id->running) return EBUSY; id->running = 1; id->cb_data = cb_data; id->timed_out = timed_out; gettimeofday(&now, NULL); now.tv_sec += timeout->tv_sec; now.tv_usec += timeout->tv_usec; while (now.tv_usec >= 1000000) { now.tv_usec -= 1000000; now.tv_sec += 1; } return sel_start_timer(id->timer, &now); } static int stop_timer(os_handler_t *handler, os_hnd_timer_id_t *timer_data) { return sel_stop_timer(timer_data->timer); } static int alloc_timer(os_handler_t *handler, os_hnd_timer_id_t **id) { os_hnd_timer_id_t *timer_data; int rv; iposix_info_t *info = handler->internal_data; selector_t *posix_sel = info->sel; timer_data = malloc(sizeof(*timer_data)); if (!timer_data) return ENOMEM; timer_data->running = 0; timer_data->timed_out = NULL; timer_data->handler = handler; rv = sel_alloc_timer(posix_sel, timer_handler, timer_data, &(timer_data->timer)); if (rv) { free(timer_data); return rv; } *id = timer_data; return 0; } static int free_timer(os_handler_t *handler, os_hnd_timer_id_t *timer_data) { sel_free_timer(timer_data->timer); free(timer_data); return 0; } static int get_random(os_handler_t *handler, void *data, unsigned int len) { int fd = open("/dev/urandom", O_RDONLY); int rv = 0; if (fd == -1) return errno; while (len > 0) { rv = read(fd, data, len); if (rv < 0) { rv = errno; goto out; } len -= rv; data += rv; } rv = 0; out: close(fd); return rv; } static void default_vlog(const char *format, enum ipmi_log_type_e log_type, va_list ap) { int do_nl = 1; switch(log_type) { case IPMI_LOG_INFO: fprintf(stderr, "INFO: "); break; case IPMI_LOG_WARNING: fprintf(stderr, "WARN: "); break; case IPMI_LOG_SEVERE: fprintf(stderr, "SEVR: "); break; case IPMI_LOG_FATAL: fprintf(stderr, "FATL: "); break; case IPMI_LOG_ERR_INFO: fprintf(stderr, "EINF: "); break; case IPMI_LOG_DEBUG_START: do_nl = 0; /* FALLTHROUGH */ case IPMI_LOG_DEBUG: fprintf(stderr, "DEBG: "); break; case IPMI_LOG_DEBUG_CONT: do_nl = 0; /* FALLTHROUGH */ case IPMI_LOG_DEBUG_END: break; } vfprintf(stderr, format, ap); if (do_nl) fprintf(stderr, "\n"); } static void sposix_vlog(os_handler_t *handler, enum ipmi_log_type_e log_type, const char *format, va_list ap) { iposix_info_t *info = handler->internal_data; os_vlog_t log_handler = info->log_handler; if (log_handler) log_handler(handler, format, log_type, ap); else if (posix_vlog) posix_vlog((char *) format, log_type, ap); else default_vlog(format, log_type, ap); } static void sposix_log(os_handler_t *handler, enum ipmi_log_type_e log_type, const char *format, ...) { va_list ap; va_start(ap, format); sposix_vlog(handler, log_type, format, ap); va_end(ap); } static int perform_one_op(os_handler_t *os_hnd, struct timeval *timeout) { iposix_info_t *info = os_hnd->internal_data; int rv; rv = sel_select(info->sel, NULL, 0, NULL, timeout); if (rv == -1) return errno; return 0; } static void operation_loop(os_handler_t *os_hnd) { iposix_info_t *info = os_hnd->internal_data; sel_select_loop(info->sel, NULL, 0, NULL); } static void free_os_handler(os_handler_t *os_hnd) { iposix_info_t *info = os_hnd->internal_data; sel_free_selector(info->sel); ipmi_posix_free_os_handler(os_hnd); } static void * posix_malloc(int size) { return malloc(size); } static void posix_free(void *data) { free(data); } #ifdef HAVE_GDBM #define GDBM_FILE ".OpenIPMI_db" static void init_gdbm(iposix_info_t *info) { if (!info->gdbm_filename) { char *home = getenv("HOME"); if (!home) return; info->gdbm_filename = malloc(strlen(home)+strlen(GDBM_FILE)+2); if (!info->gdbm_filename) return; strcpy(info->gdbm_filename, home); strcat(info->gdbm_filename, "/"); strcat(info->gdbm_filename, GDBM_FILE); } info->gdbmf = gdbm_open(info->gdbm_filename, 512, GDBM_WRCREAT, 0600, NULL); /* gdbmf will be NULL on error, which is what reports an error. */ } static int database_store(os_handler_t *handler, char *key, unsigned char *data, unsigned int data_len) { iposix_info_t *info = handler->internal_data; datum gkey, gdata; int rv; if (!info->gdbmf) { init_gdbm(info); if (!info->gdbmf) return EINVAL; } gkey.dptr = key; gkey.dsize = strlen(key); gdata.dptr = (char *) data; gdata.dsize = data_len; rv = gdbm_store(info->gdbmf, gkey, gdata, GDBM_REPLACE); if (rv) return EINVAL; return 0; } static int database_find(os_handler_t *handler, char *key, unsigned int *fetch_completed, unsigned char **data, unsigned int *data_len, void (*got_data)(void *cb_data, int err, unsigned char *data, unsigned int data_len), void *cb_data) { iposix_info_t *info = handler->internal_data; datum gkey, gdata; if (!info->gdbmf) { init_gdbm(info); if (!info->gdbmf) return EINVAL; } gkey.dptr = key; gkey.dsize = strlen(key); gdata = gdbm_fetch(info->gdbmf, gkey); if (!gdata.dptr) return EINVAL; *data = (unsigned char *) gdata.dptr; *data_len = gdata.dsize; *fetch_completed = 1; return 0; } static void database_free(os_handler_t *handler, unsigned char *data) { free(data); } static int set_gdbm_filename(os_handler_t *os_hnd, char *name) { iposix_info_t *info = os_hnd->internal_data; char *nname; nname = strdup(name); if (!nname) return ENOMEM; if (info->gdbm_filename) free(info->gdbm_filename); info->gdbm_filename = nname; return 0; } #endif static void sset_log_handler(os_handler_t *handler, os_vlog_t log_handler) { iposix_info_t *info = handler->internal_data; info->log_handler = log_handler; } static os_handler_t ipmi_posix_os_handler = { .mem_alloc = posix_malloc, .mem_free = posix_free, .add_fd_to_wait_for = add_fd, .remove_fd_to_wait_for = remove_fd, .start_timer = start_timer, .stop_timer = stop_timer, .alloc_timer = alloc_timer, .free_timer = free_timer, .get_random = get_random, .log = sposix_log, .vlog = sposix_vlog, .free_os_handler = free_os_handler, .perform_one_op = perform_one_op, .operation_loop = operation_loop, #ifdef HAVE_GDBM .database_store = database_store, .database_find = database_find, .database_free = database_free, .database_set_filename = set_gdbm_filename, #endif .set_log_handler = sset_log_handler, }; os_handler_t * ipmi_posix_get_os_handler(void) { os_handler_t *rv; iposix_info_t *info; rv = malloc(sizeof(*rv)); if (!rv) return NULL; memcpy(rv, &ipmi_posix_os_handler, sizeof(*rv)); info = malloc(sizeof(*info)); if (!info) { free(rv); return NULL; } memset(info, 0, sizeof(*info)); rv->internal_data = info; return rv; } void ipmi_posix_free_os_handler(os_handler_t *os_hnd) { iposix_info_t *info = os_hnd->internal_data; #ifdef HAVE_GDBM if (info->gdbm_filename) free(info->gdbm_filename); if (info->gdbmf) gdbm_close(info->gdbmf); #endif free(info); free(os_hnd); } void ipmi_posix_os_handler_set_sel(os_handler_t *os_hnd, selector_t *sel) { iposix_info_t *info = os_hnd->internal_data; info->sel = sel; } selector_t * ipmi_posix_os_handler_get_sel(os_handler_t *os_hnd) { iposix_info_t *info = os_hnd->internal_data; return info->sel; } os_handler_t * ipmi_posix_setup_os_handler(void) { os_handler_t *os_hnd; selector_t *sel; int rv; iposix_info_t *info; os_hnd = ipmi_posix_get_os_handler(); if (!os_hnd) return NULL; rv = sel_alloc_selector(os_hnd, &sel); if (rv) { ipmi_posix_free_os_handler(os_hnd); os_hnd = NULL; goto out; } info = os_hnd->internal_data; info->sel = sel; out: return os_hnd; } /* * Cruft below, do not use. */ int ipmi_posix_sel_select(os_handler_t *os_hnd, struct timeval *timeout) { return perform_one_op(os_hnd, timeout); } void ipmi_posix_sel_select_loop(os_handler_t *os_hnd) { operation_loop(os_hnd); } void ipmi_posix_cleanup_os_handler(os_handler_t *os_hnd) { free_os_handler(os_hnd); } openipmi-2.0.18/unix/selector.c0000644000175000017500000005751311363572740015370 0ustar chuckchuck/* * selector.c * * Code for abstracting select for files and timers. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2002,2003 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* This file holds code to abstract the "select" call and make it easier to use. The main thread lives here, the rest of the code uses a callback interface. Basically, other parts of the program can register file descriptors with this code, when interesting things happen on those file descriptors this code will call routines registered with it. */ #include #include #include #include #include #include #include #include #include #include typedef struct fd_state_s { int deleted; unsigned int use_count; sel_fd_cleared_cb done; } fd_state_t; /* The control structure for each file descriptor. */ typedef struct fd_control_s { /* This structure is allocated when an FD is set and it holds whether the FD has been deleted and information to handle the deletion. */ fd_state_t *state; void *data; /* Operation-specific data */ sel_fd_handler_t handle_read; sel_fd_handler_t handle_write; sel_fd_handler_t handle_except; } fd_control_t; typedef struct heap_val_s { /* Set this to the function to call when the timeout occurs. */ sel_timeout_handler_t handler; /* Set this to whatever you like. You can use this to store your own data. */ void *user_data; /* Set this to the time when the timer will go off. */ struct timeval timeout; /* Who owns me? */ selector_t *sel; /* Am I currently running? */ int in_heap; } heap_val_t; typedef struct theap_s theap_t; #define heap_s theap_s #define heap_node_s sel_timer_s #define HEAP_EXPORT_NAME(s) theap_ ## s #define HEAP_NAMES_LOCAL static #define HEAP_OUTPUT_PRINTF "(%ld.%7.7ld)" #define HEAP_OUTPUT_DATA pos->timeout.tv_sec, pos->timeout.tv_usec static int cmp_timeval(const struct timeval *tv1, const struct timeval *tv2) { if (tv1->tv_sec < tv2->tv_sec) return -1; if (tv1->tv_sec > tv2->tv_sec) return 1; if (tv1->tv_usec < tv2->tv_usec) return -1; if (tv1->tv_usec > tv2->tv_usec) return 1; return 0; } static int heap_cmp_key(heap_val_t *v1, heap_val_t *v2) { return cmp_timeval(&v1->timeout, &v2->timeout); } #include "heap.h" /* Used to build a list of threads that may need to be woken if a timer on the top of the heap changes, or an FD is added/removed. See wake_sel_thread() for more info. */ typedef struct sel_wait_list_s { /* The thread to wake up. */ long thread_id; /* How to wake it. */ sel_send_sig_cb send_sig; void *send_sig_cb_data; /* This is the memory used to hold the timeout for select operation. */ volatile struct timeval *timeout; struct sel_wait_list_s *next, *prev; } sel_wait_list_t; struct selector_s { /* This is an array of all the file descriptors possible. This is moderately wasteful of space, but easy to do. Hey, memory is cheap. */ volatile fd_control_t fds[FD_SETSIZE]; /* These are the offical fd_sets used to track what file descriptors need to be monitored. */ volatile fd_set read_set; volatile fd_set write_set; volatile fd_set except_set; os_hnd_lock_t *fd_lock; int have_fd_lock; volatile int maxfd; /* The largest file descriptor registered with this code. */ /* The timer heap. */ theap_t timer_heap; os_hnd_lock_t *timer_lock; int have_timer_lock; /* Handlers to allow other code to work with the select. */ ipmi_sel_add_read_fds_cb add_read; ipmi_sel_check_read_fds_cb check_read; ipmi_sel_check_timeout_cb check_timeout; void *read_cb_data; os_handler_t *os_hnd; /* This is a list of items waiting to be woken up because they are sitting in a select. See wake_sel_thread() for more info. */ sel_wait_list_t wait_list; }; /* This function will wake the SEL thread. It must be called with the timer lock held, because it messes with timeout. The operation is is subtle, but it does work. The timeout in the selector is the data passed in (must be the actual data) as the timeout to select. When we want to wake the select, we set the timeout to zero first. That way, if the select has calculated the timeout but has not yet called select, then this will set it to zero (causing it to wait zero time). If select has already been called, then the signal send should wake it up. We only need to do this after we have calculated the timeout, but before we have called select, thus only things in the wait list matter. */ static void wake_sel_thread(selector_t *sel) { sel_wait_list_t *item; item = sel->wait_list.next; while (item != &sel->wait_list) { item->timeout->tv_sec = 0; item->timeout->tv_usec = 0; if (item->send_sig) item->send_sig(item->thread_id, item->send_sig_cb_data); item = item->next; } } /* Wait list management. These *must* be called with the timer list locked, and the values in the item *must not* change while in the list. */ static void add_sel_wait_list(selector_t *sel, sel_wait_list_t *item, sel_send_sig_cb send_sig, void *cb_data, long thread_id, volatile struct timeval *timeout) { item->thread_id = thread_id; item->timeout = timeout; item->send_sig = send_sig; item->send_sig_cb_data = cb_data; item->next = sel->wait_list.next; item->prev = &sel->wait_list; sel->wait_list.next->prev = item; sel->wait_list.next = item; } static void remove_sel_wait_list(selector_t *sel, sel_wait_list_t *item) { item->next->prev = item->prev; item->prev->next = item->next; } static void wake_sel_thread_lock(selector_t *sel) { if (sel->have_timer_lock) sel->os_hnd->lock(sel->os_hnd, sel->timer_lock); wake_sel_thread(sel); if (sel->have_timer_lock) sel->os_hnd->unlock(sel->os_hnd, sel->timer_lock); } /* Initialize a single file descriptor. */ static void init_fd(fd_control_t *fd) { fd->state = NULL; fd->data = NULL; fd->handle_read = NULL; fd->handle_write = NULL; fd->handle_except = NULL; } /* Set the handlers for a file descriptor. */ int sel_set_fd_handlers(selector_t *sel, int fd, void *data, sel_fd_handler_t read_handler, sel_fd_handler_t write_handler, sel_fd_handler_t except_handler, sel_fd_cleared_cb done) { fd_control_t *fdc; fd_state_t *state; state = malloc(sizeof(*state)); if (!state) return ENOMEM; state->deleted = 0; state->use_count = 0; state->done = done; if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); fdc = (fd_control_t *) &(sel->fds[fd]); if (fdc->state) { fdc->state->deleted = 1; if (fdc->state->use_count == 0) { if (fdc->state->done) fdc->state->done(fd, fdc->data); free(fdc->state); } } fdc->state = state; fdc->data = data; fdc->handle_read = read_handler; fdc->handle_write = write_handler; fdc->handle_except = except_handler; /* Move maxfd up if necessary. */ if (fd > sel->maxfd) { sel->maxfd = fd; } wake_sel_thread_lock(sel); if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); return 0; } /* Clear the handlers for a file descriptor and remove it from select's monitoring. */ void sel_clear_fd_handlers(selector_t *sel, int fd) { fd_control_t *fdc; if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); fdc = (fd_control_t *) &(sel->fds[fd]); if (fdc->state) { fdc->state->deleted = 1; if (fdc->state->use_count == 0) { if (fdc->state->done) fdc->state->done(fd, fdc->data); free(fdc->state); } fdc->state = NULL; } init_fd(fdc); FD_CLR(fd, &sel->read_set); FD_CLR(fd, &sel->write_set); FD_CLR(fd, &sel->except_set); /* Move maxfd down if necessary. */ if (fd == sel->maxfd) { while ((sel->maxfd >= 0) && (! sel->fds[sel->maxfd].state)) { sel->maxfd--; } } wake_sel_thread_lock(sel); if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); } /* Set whether the file descriptor will be monitored for data ready to read on the file descriptor. */ void sel_set_fd_read_handler(selector_t *sel, int fd, int state) { if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); if (state == SEL_FD_HANDLER_ENABLED) { FD_SET(fd, &sel->read_set); } else if (state == SEL_FD_HANDLER_DISABLED) { FD_CLR(fd, &sel->read_set); } wake_sel_thread_lock(sel); if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); } /* Set whether the file descriptor will be monitored for when the file descriptor can be written to. */ void sel_set_fd_write_handler(selector_t *sel, int fd, int state) { if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); if (state == SEL_FD_HANDLER_ENABLED) { FD_SET(fd, &sel->write_set); } else if (state == SEL_FD_HANDLER_DISABLED) { FD_CLR(fd, &sel->write_set); } wake_sel_thread_lock(sel); if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); } /* Set whether the file descriptor will be monitored for exceptions on the file descriptor. */ void sel_set_fd_except_handler(selector_t *sel, int fd, int state) { if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); if (state == SEL_FD_HANDLER_ENABLED) { FD_SET(fd, &sel->except_set); } else if (state == SEL_FD_HANDLER_DISABLED) { FD_CLR(fd, &sel->except_set); } wake_sel_thread_lock(sel); if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); } static void diff_timeval(struct timeval *dest, struct timeval *left, struct timeval *right) { if ( (left->tv_sec < right->tv_sec) || ( (left->tv_sec == right->tv_sec) && (left->tv_usec < right->tv_usec))) { /* If left < right, just force to zero, don't allow negative numbers. */ dest->tv_sec = 0; dest->tv_usec = 0; return; } dest->tv_sec = left->tv_sec - right->tv_sec; dest->tv_usec = left->tv_usec - right->tv_usec; while (dest->tv_usec < 0) { dest->tv_usec += 1000000; dest->tv_sec--; } } int sel_alloc_timer(selector_t *sel, sel_timeout_handler_t handler, void *user_data, sel_timer_t **new_timer) { sel_timer_t *timer; timer = malloc(sizeof(*timer)); if (!timer) return ENOMEM; timer->val.handler = handler; timer->val.user_data = user_data; timer->val.in_heap = 0; timer->val.sel = sel; *new_timer = timer; return 0; } int sel_free_timer(sel_timer_t *timer) { selector_t *sel = timer->val.sel; if (sel->have_timer_lock) sel->os_hnd->lock(sel->os_hnd, sel->timer_lock); if (timer->val.in_heap) { sel_stop_timer(timer); } if (sel->have_timer_lock) sel->os_hnd->unlock(sel->os_hnd, sel->timer_lock); free(timer); return 0; } int sel_start_timer(sel_timer_t *timer, struct timeval *timeout) { selector_t *sel = timer->val.sel; volatile sel_timer_t *top; if (sel->have_timer_lock) sel->os_hnd->lock(sel->os_hnd, sel->timer_lock); if (timer->val.in_heap) { if (sel->have_timer_lock) sel->os_hnd->unlock(sel->os_hnd, sel->timer_lock); return EBUSY; } top = theap_get_top(&timer->val.sel->timer_heap); timer->val.timeout = *timeout; theap_add(&timer->val.sel->timer_heap, timer); timer->val.in_heap = 1; if (top != theap_get_top(&timer->val.sel->timer_heap)) /* If the top value changed, restart the waiting thread. */ wake_sel_thread(timer->val.sel); if (sel->have_timer_lock) sel->os_hnd->unlock(sel->os_hnd, sel->timer_lock); return 0; } int sel_stop_timer(sel_timer_t *timer) { selector_t *sel = timer->val.sel; volatile sel_timer_t *top; if (sel->have_timer_lock) sel->os_hnd->lock(sel->os_hnd, sel->timer_lock); if (!timer->val.in_heap) { if (sel->have_timer_lock) sel->os_hnd->unlock(sel->os_hnd, sel->timer_lock); return ETIMEDOUT; } top = theap_get_top(&timer->val.sel->timer_heap); theap_remove(&timer->val.sel->timer_heap, timer); timer->val.in_heap = 0; if (top != theap_get_top(&timer->val.sel->timer_heap)) /* If the top value changed, restart the waiting thread. */ wake_sel_thread(timer->val.sel); if (sel->have_timer_lock) sel->os_hnd->unlock(sel->os_hnd, sel->timer_lock); return 0; } /* * Process timers on selector. The timeout is always set, to a very * long value if no timers are waiting. Note that this *must* be * called with sel->timer_lock held. Note that if this processes * any timers, the timeout will be set to { 0,0 }. */ static void process_timers(selector_t *sel, volatile struct timeval *timeout) { struct timeval now; sel_timer_t *timer; int called = 0; timer = theap_get_top(&sel->timer_heap); gettimeofday(&now, NULL); while (timer && cmp_timeval(&now, &timer->val.timeout) >= 0) { called = 1; theap_remove(&(sel->timer_heap), timer); timer->val.in_heap = 0; if (sel->have_timer_lock) sel->os_hnd->unlock(sel->os_hnd, sel->timer_lock); timer->val.handler(sel, timer, timer->val.user_data); if (sel->have_timer_lock) sel->os_hnd->lock(sel->os_hnd, sel->timer_lock); timer = theap_get_top(&sel->timer_heap); } if (called) { /* If called, set the timeout to zero. */ timeout->tv_sec = 0; timeout->tv_usec = 0; } else if (timer) { gettimeofday(&now, NULL); diff_timeval((struct timeval *) timeout, (struct timeval *) &timer->val.timeout, &now); } else { /* No timers, just set a long time. */ timeout->tv_sec = 100000; timeout->tv_usec = 0; } } /* * return == 0 when timeout * > 0 when successful * < 0 when error */ static int process_fds(selector_t *sel, sel_send_sig_cb send_sig, long thread_id, void *cb_data, volatile struct timeval *timeout) { fd_set tmp_read_set; fd_set tmp_write_set; fd_set tmp_except_set; int i; int err; int num_fds; if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); memcpy(&tmp_read_set, (void *) &sel->read_set, sizeof(tmp_read_set)); memcpy(&tmp_write_set, (void *) &sel->write_set, sizeof(tmp_write_set)); memcpy(&tmp_except_set, (void *) &sel->except_set, sizeof(tmp_except_set)); num_fds = sel->maxfd+1; if (sel->add_read) { int timeout_invalid; struct timeval ttimeout; timeout_invalid = 1; sel->add_read(sel, &num_fds, &tmp_read_set, &ttimeout, &timeout_invalid, sel->read_cb_data); if (!timeout_invalid && (cmp_timeval(&ttimeout, (struct timeval *)timeout) <= 0)) { *timeout= ttimeout; } } if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); err = select(num_fds, &tmp_read_set, &tmp_write_set, &tmp_except_set, (struct timeval *) timeout); if (err <= 0) { if ((err == 0) && (sel->check_timeout)) sel->check_timeout(sel, sel->read_cb_data); goto out; } if (sel->check_read) sel->check_read(sel, &tmp_read_set, sel->read_cb_data); /* We got some I/O. */ for (i=0; i<=sel->maxfd; i++) { if (FD_ISSET(i, &tmp_read_set)) { sel_fd_handler_t handle_read; void *data; fd_state_t *state; if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); if (sel->fds[i].handle_read == NULL) { /* Somehow we don't have a handler for this. Just shut it down. */ sel_set_fd_read_handler(sel, i, SEL_FD_HANDLER_DISABLED); } else { handle_read = sel->fds[i].handle_read; data = sel->fds[i].data; state = sel->fds[i].state; state->use_count++; if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); handle_read(i, data); if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); state->use_count--; if (state->deleted && state->use_count == 0) { if (state->done) state->done(i, data); free(state); } } if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); } if (FD_ISSET(i, &tmp_write_set)) { sel_fd_handler_t handle_write; void *data; fd_state_t *state; if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); if (sel->fds[i].handle_write == NULL) { /* Somehow we don't have a handler for this. Just shut it down. */ sel_set_fd_write_handler(sel, i, SEL_FD_HANDLER_DISABLED); } else { handle_write = sel->fds[i].handle_write; data = sel->fds[i].data; state = sel->fds[i].state; state->use_count++; if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); handle_write(i, data); if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); state->use_count--; if (state->deleted && state->use_count == 0) { if (state->done) state->done(i, data); free(state); } } if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); } if (FD_ISSET(i, &tmp_except_set)) { sel_fd_handler_t handle_except; void *data; fd_state_t *state; if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); if (sel->fds[i].handle_except == NULL) { /* Somehow we don't have a handler for this. Just shut it down. */ sel_set_fd_except_handler(sel, i, SEL_FD_HANDLER_DISABLED); } else { handle_except = sel->fds[i].handle_except; data = sel->fds[i].data; state = sel->fds[i].state; state->use_count++; if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); handle_except(i, data); if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); state->use_count--; if (state->deleted && state->use_count == 0) { if (state->done) state->done(i, data); free(state); } } if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); } } out: return err; } int sel_select(selector_t *sel, sel_send_sig_cb send_sig, long thread_id, void *cb_data, struct timeval *timeout) { int err; struct timeval loc_timeout; sel_wait_list_t wait_entry; if (sel->have_timer_lock) sel->os_hnd->lock(sel->os_hnd, sel->timer_lock); process_timers(sel, (struct timeval *)(&loc_timeout)); if (timeout) { if (cmp_timeval((struct timeval *)(&loc_timeout), timeout) >= 0) memcpy(&loc_timeout, timeout, sizeof(loc_timeout)); } add_sel_wait_list(sel, &wait_entry, send_sig, cb_data, thread_id, &loc_timeout); if (sel->have_timer_lock) sel->os_hnd->unlock(sel->os_hnd, sel->timer_lock); err = process_fds(sel, send_sig, thread_id, cb_data, &loc_timeout); if (sel->have_timer_lock) sel->os_hnd->lock(sel->os_hnd, sel->timer_lock); remove_sel_wait_list(sel, &wait_entry); if (sel->have_timer_lock) sel->os_hnd->unlock(sel->os_hnd, sel->timer_lock); return err; } /* The main loop for the program. This will select on the various sets, then scan for any available I/O to process. It also monitors the time and call the timeout handlers periodically. */ int sel_select_loop(selector_t *sel, sel_send_sig_cb send_sig, long thread_id, void *cb_data) { int err; sel_wait_list_t wait_entry; struct timeval loc_timeout; for (;;) { if (sel->have_timer_lock) sel->os_hnd->lock(sel->os_hnd, sel->timer_lock); process_timers(sel, &loc_timeout); add_sel_wait_list(sel, &wait_entry, send_sig, cb_data, thread_id, &loc_timeout); if (sel->have_timer_lock) sel->os_hnd->unlock(sel->os_hnd, sel->timer_lock); err = process_fds(sel, send_sig, thread_id, cb_data, &loc_timeout); if (sel->have_timer_lock) sel->os_hnd->lock(sel->os_hnd, sel->timer_lock); remove_sel_wait_list(sel, &wait_entry); if (sel->have_timer_lock) sel->os_hnd->unlock(sel->os_hnd, sel->timer_lock); if ((err < 0) && (errno != EINTR)) { err = errno; /* An error occurred. */ /* An error is bad, we need to abort. */ syslog(LOG_ERR, "select_loop() - select: %m"); return err; } } } void ipmi_sel_set_read_fds_handler(selector_t *sel, ipmi_sel_add_read_fds_cb add, ipmi_sel_check_read_fds_cb handle, ipmi_sel_check_timeout_cb timeout, void *cb_data) { if (sel->have_fd_lock) sel->os_hnd->lock(sel->os_hnd, sel->fd_lock); sel->add_read = add; sel->check_read = handle; sel->check_timeout = timeout; sel->read_cb_data = cb_data; if (sel->have_fd_lock) sel->os_hnd->unlock(sel->os_hnd, sel->fd_lock); } /* Initialize the select code. */ int sel_alloc_selector(os_handler_t *os_hnd, selector_t **new_selector) { selector_t *sel; unsigned int i; int rv; sel = malloc(sizeof(*sel)); if (!sel) return ENOMEM; memset(sel, 0, sizeof(*sel)); sel->os_hnd = os_hnd; /* The list is initially empty. */ sel->wait_list.next = &sel->wait_list; sel->wait_list.prev = &sel->wait_list; rv = 0; if (sel->os_hnd->create_lock) { rv = sel->os_hnd->create_lock(sel->os_hnd, &sel->timer_lock); if (!rv) sel->have_timer_lock = 1; } if (rv) goto out_err; rv = 0; if (sel->os_hnd->create_lock) { rv = sel->os_hnd->create_lock(sel->os_hnd, &sel->fd_lock); if (!rv) sel->have_fd_lock = 1; } if (rv) goto out_err; FD_ZERO((fd_set *) &sel->read_set); FD_ZERO((fd_set *) &sel->write_set); FD_ZERO((fd_set *) &sel->except_set); for (i=0; ifds[i])); } theap_init(&sel->timer_heap); *new_selector = sel; out_err: if (rv) { if (sel->have_timer_lock) sel->os_hnd->destroy_lock(sel->os_hnd, sel->timer_lock); if (sel->have_fd_lock) sel->os_hnd->destroy_lock(sel->os_hnd, sel->fd_lock); free(sel); } return rv; } int sel_free_selector(selector_t *sel) { sel_timer_t *elem; if (sel->have_timer_lock) sel->os_hnd->destroy_lock(sel->os_hnd, sel->timer_lock); if (sel->have_fd_lock) sel->os_hnd->destroy_lock(sel->os_hnd, sel->fd_lock); elem = theap_get_top(&(sel->timer_heap)); while (elem) { theap_remove(&(sel->timer_heap), elem); free(elem); elem = theap_get_top(&(sel->timer_heap)); } free(sel); return 0; } openipmi-2.0.18/unix/test_handlers.c0000644000175000017500000001761410415221033016364 0ustar chuckchuck/* * test_handlers.c * * Basic tests for POSIX OS handlers. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2006 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include os_handler_t *test_os_hnd; static void err_leave(int err, char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); if (err) fprintf(stderr, "error: %s (%d)\n", strerror(err), err); va_end(ap); exit(1); } int expect_log = 0; static void my_vlog(os_handler_t *handler, const char *format, enum ipmi_log_type_e log_type, va_list ap) { if (expect_log == 0) { int ival; char *sval; expect_log++; if (strcmp(format, "This is a test: %d %s") != 0) err_leave(0, "Wrong format\n"); if (log_type != IPMI_LOG_FATAL) err_leave(0, "Invalid log type\n"); ival = va_arg(ap, int); if (ival != 47) err_leave(0, "Invalid log int val\n"); sval = va_arg(ap, char *); if (strcmp(sval, "Hello") != 0) err_leave(0, "Invalid log string val\n"); } else { vfprintf(stderr, format, ap); err_leave(0, "Unexpected log!\n"); } } static inline void diff_timeval(struct timeval *dest, struct timeval *left, struct timeval *right) { if ( (left->tv_sec < right->tv_sec) || ( (left->tv_sec == right->tv_sec) && (left->tv_usec < right->tv_usec))) { /* If left < right, just force to zero, don't allow negative numbers. */ dest->tv_sec = 0; dest->tv_usec = 0; return; } dest->tv_sec = left->tv_sec - right->tv_sec; dest->tv_usec = left->tv_usec - right->tv_usec; while (dest->tv_usec < 0) { dest->tv_usec += 1000000; dest->tv_sec--; } } os_handler_waiter_t *timer_waiter; int expect_timeout = 0; static void timeout_handler(void *cb_data, os_hnd_timer_id_t *id) { struct timeval *then = cb_data; struct timeval now; struct timeval diff; int rv; printf("Timeout!\n"); gettimeofday(&now, NULL); diff_timeval(&diff, &now, then); if (expect_timeout == 0) { expect_timeout++; if (diff.tv_sec != 1) err_leave(0, "Invalid timeout diff 0: %ld %ld\n", diff.tv_sec, diff.tv_usec); diff.tv_sec = 0; diff.tv_usec = 500000; *then = now; rv = test_os_hnd->start_timer(test_os_hnd, id, &diff, timeout_handler, then); } else if (expect_timeout == 1) { expect_timeout++; if (diff.tv_sec != 0) err_leave(0, "Invalid timeout diff 1: %ld %ld\n", diff.tv_sec, diff.tv_usec); os_handler_waiter_release(timer_waiter); } else { err_leave(0, "Unexpected timeout!\n"); } } static void test_os_handler(os_handler_t *os_hnd, os_handler_waiter_factory_t *factory) { os_hnd_timer_id_t *timer; struct timeval now; struct timeval tv; int rv; test_os_hnd = os_hnd; /* Override the default log handler (so I can catch them). */ os_hnd->set_log_handler(os_hnd, my_vlog); printf("Log test\n"); os_hnd->log(os_hnd, IPMI_LOG_FATAL, "This is a test: %d %s", 47, "Hello"); printf("Timer test\n"); timer_waiter = os_handler_alloc_waiter(factory); if (!timer_waiter) err_leave(0, "Unable to allocate waiter\n"); rv = os_hnd->alloc_timer(os_hnd, &timer); if (rv) err_leave(rv, "Unable to allocate timer"); gettimeofday(&now, NULL); tv.tv_sec = 1; tv.tv_usec = 500000; rv = os_hnd->start_timer(os_hnd, timer, &tv, timeout_handler, &now); tv.tv_sec = 3; tv.tv_usec = 0; os_handler_waiter_wait(timer_waiter, &tv); if (expect_timeout != 2) err_leave(0, "Error in timers"); os_handler_free_waiter(timer_waiter); rv = os_handler_free_waiter_factory(factory); if (rv) err_leave(rv, "Error freeing factory\n"); os_hnd->free_os_handler(os_hnd); } static void reset_tests(void) { expect_log = 0; expect_timeout = 0; } int ipmi_malloc_init(os_handler_t *os_hnd); int main(int argc, char *argv[]) { os_handler_waiter_factory_t *factory; os_handler_t *os_hnd; int rv; printf("*** Testing POSIX OS handler\n"); reset_tests(); os_hnd = ipmi_posix_setup_os_handler(); if (!os_hnd) { fprintf(stderr, "ipmi_smi_setup_con: Unable to allocate os handler\n"); exit(1); } ipmi_malloc_init(os_hnd); rv = os_handler_alloc_waiter_factory(os_hnd, 2, 0, &factory); if (rv != ENOSYS) err_leave(rv, "Expected ENOSYS allocating threaded factory\n"); rv = os_handler_alloc_waiter_factory(os_hnd, 0, 0, &factory); if (rv) err_leave(rv, "Unable to allocate waiter factory\n"); test_os_handler(os_hnd, factory); printf("*** Testing POSIX Threaded OS handler (multithread)\n"); reset_tests(); os_hnd = ipmi_posix_thread_setup_os_handler(SIGUSR1); if (!os_hnd) { fprintf(stderr, "ipmi_smi_setup_con: Unable to allocate os handler\n"); exit(1); } ipmi_malloc_init(os_hnd); rv = os_handler_alloc_waiter_factory(os_hnd, 2, 0, &factory); if (rv) err_leave(rv, "Unable to allocate waiter factory\n"); test_os_handler(os_hnd, factory); printf("*** Testing POSIX Threaded OS handler (singlethread)\n"); reset_tests(); os_hnd = ipmi_posix_thread_setup_os_handler(SIGUSR1); if (!os_hnd) { fprintf(stderr, "ipmi_smi_setup_con: Unable to allocate os handler\n"); exit(1); } ipmi_malloc_init(os_hnd); rv = os_handler_alloc_waiter_factory(os_hnd, 0, 0, &factory); if (rv) err_leave(rv, "Unable to allocate waiter factory\n"); test_os_handler(os_hnd, factory); return 0; } openipmi-2.0.18/OpenIPMIpthread.pc.in0000644000175000017500000000041410300532522016246 0ustar chuckchuckprefix=@prefix@ exec_prefix=@prefix@ libdir=@libdir@ includedir=@includedir@ Name: OpenIPMIpthread Description: Pthread OS handler for OpenIPMI Version: @VERSION@ Requires: OpenIPMI pthread Libs: -L${libdir} -lOpenIPMIutils -lOpenIPMIpthread Cflags: -I${includedir} openipmi-2.0.18/OpenIPMI.spec0000644000175000017500000001271011367554457014654 0ustar chuckchuck# For common adjustments that are needed for this file, search for # "USERFIX" Name: OpenIPMI Summary: %{name} - Library interface to IPMI Version: 2.0.18 Release: 2 License: LGPL URL: http://openipmi.sourceforge.net Group: Utilities Vendor: OpenIPMI Project Packager: Tariq Shureih Source: %{name}-2.0.18.tar.gz Buildroot: /var/tmp/%{name}-root BuildRequires: pkgconfig, perl >= 5, swig >= 1.3 Summary: IPMI Library Group: Utilities # Figure out if glib12 is installed %define glib12 %(if ls -l /usr/lib/libglib-1.2* >/dev/null 2>&1; then echo yes; else echo no; fi) %description This package contains a shared library implementation of IPMI and the basic tools used with OpenIPMI. %package devel Summary: Development files for OpenIPMI Group: Utilities Requires: OpenIPMI = %{version}, pkgconfig %description devel Contains additional files need for a developer to create applications and/or middleware that depends on libOpenIPMI %package perl Summary: Perl interface for OpenIPMI Group: Utilities Requires: OpenIPMI = %{version}, perl >= 5 %description perl A Perl interface for OpenIPMI. %package python Summary: Python interface for OpenIPMI Group: Utilities Requires: OpenIPMI = %{version}, python %description python A Python interface for OpenIPMI. %package gui Summary: GUI (in python) for OpenIPMI Group: Utilities Requires: OpenIPMI-python = %{version}, tkinter %description gui A GUI interface for OpenIPMI. Written in python an requiring wxWidgets. %package ui Summary: User Interface (ui) Group: Utilities Requires: OpenIPMI = %{version} %description ui This package contains a user interface %package lanserv Summary: Emulates an IPMI network listener Group: Utilities Requires: OpenIPMI = %{version} %description lanserv This package contains a network IPMI listener. ################################################### %prep ################################################### %setup ################################################### %build ################################################### # USERFIX: Things you might have to add to configure: # --with-tclcflags='-I /usr/include/tclN.M' --with-tcllibs=-ltclN.M # Obviously, replace N.M with the version of tcl on your system. %configure make ################################################### %install ################################################### rm -rf %{buildroot} make DESTDIR=%{buildroot} install install -d %{buildroot}/etc/init.d install -d %{buildroot}/etc/sysconfig install ipmi.init %{buildroot}/etc/init.d/ipmi install ipmi.sysconf %{buildroot}/etc/sysconfig/ipmi ################################################### %post ################################################### chkconfig --add ipmi ################################################### %preun ################################################### if [ $1 = 0 ]; then /etc/init.d/ipmi stop >/dev/null 2>&1 /sbin/chkconfig --del ipmi fi ################################################### %postun ################################################### if [ "$1" -ge "1" ]; then /etc/init.d/ipmi condrestart >/dev/null 2>&1 || : fi ################################################### %files ################################################### %defattr(-,root,root) %{_libdir}/libOpenIPMIcmdlang.so.* %{_libdir}/libOpenIPMIglib.so.* # USERFIX: You might need to modify the following if glib12 is not # handled properly by the autodetection %if %{glib12} != "no" %{_libdir}/libOpenIPMIglib12.so.* %endif %{_libdir}/libOpenIPMItcl.so.* %{_libdir}/libOpenIPMIposix.so.* %{_libdir}/libOpenIPMIpthread.so.* %{_libdir}/libOpenIPMI.so.* %{_libdir}/libOpenIPMIutils.so.* %doc COPYING COPYING.LIB FAQ INSTALL README README.Force %doc README.MotorolaMXP CONFIGURING_FOR_LAN COPYING.BSD /etc/init.d/ipmi /etc/sysconfig/ipmi ################################################### %files perl ################################################### %defattr(-,root,root) %{perl_vendorarch} %doc swig/OpenIPMI.i swig/perl/sample swig/perl/ipmi_powerctl ################################################### %files python ################################################### %defattr(-,root,root) %{_libdir}/python*/site-packages/*OpenIPMI.* %doc swig/OpenIPMI.i ################################################### %files gui ################################################### %defattr(-,root,root) %dir %{_libdir}/python*/site-packages/openipmigui %{_libdir}/python*/site-packages/openipmigui/* %{_bindir}/openipmigui ################################################### %files devel ################################################### %defattr(-,root,root) %{_includedir}/OpenIPMI %{_libdir}/*.a %{_libdir}/*.la %{_libdir}/*.so %{_libdir}/pkgconfig %doc doc/IPMI.pdf ################################################### %files ui ################################################### %defattr(-,root,root) %{_bindir}/ipmi_ui %{_bindir}/ipmicmd %{_bindir}/openipmicmd %{_bindir}/ipmish %{_bindir}/openipmish %{_bindir}/solterm %{_bindir}/rmcp_ping %{_libdir}/libOpenIPMIui.so.* %doc %{_mandir}/man1/ipmi_ui.1* %doc %{_mandir}/man1/openipmicmd.1* %doc %{_mandir}/man1/openipmish.1* %doc %{_mandir}/man1/openipmigui.1* %doc %{_mandir}/man1/solterm.1* %doc %{_mandir}/man1/rmcp_ping.1* %doc %{_mandir}/man7/ipmi_cmdlang.7* %doc %{_mandir}/man7/openipmi_conparms.7* ################################################### %files lanserv ################################################### %defattr(-,root,root) %{_bindir}/ipmilan %{_libdir}/libIPMIlanserv.so.* %doc %{_mandir}/man8/ipmilan.8* openipmi-2.0.18/lanserv/0000755000175000017500000000000011367555457014072 5ustar chuckchuckopenipmi-2.0.18/lanserv/emu_cmd.c0000644000175000017500000004614110414571621015634 0ustar chuckchuck #include #include #include #include #include "emu.h" typedef int (*ipmi_emu_cmd_handler)(emu_data_t *emu, lmc_data_t *mc, char **toks); static int get_uchar(char **toks, unsigned char *val, char *errstr, int empty_ok) { char *str, *tmpstr; str = strtok_r(NULL, " \t\n", toks); if (!str) { if (empty_ok) return ENOSPC; if (errstr) printf("**No %s given\n", errstr); return EINVAL; } if (str[0] == '\'') { *val = str[1]; return 0; } *val = strtoul(str, &tmpstr, 16); if (*tmpstr != '\0') { if (errstr) printf("**Invalid %s given\n", errstr); return EINVAL; } return 0; } static int get_bitmask(char **toks, unsigned char *val, char *errstr, unsigned int size, int empty_ok) { char *str; int i, j; str = strtok_r(NULL, " \t\n", toks); if (!str) { if (empty_ok) return ENOSPC; if (errstr) printf("**No %s given\n", errstr); return EINVAL; } if (strlen(str) != size) { if (errstr) printf("**invalid number of bits in %s\n", errstr); return EINVAL; } for (i=size-1, j=0; i>=0; i--, j++) { if (str[j] == '0') { val[i] = 0; } else if (str[j] == '1') { val[i] = 1; } else { if (errstr) printf("**Invalid bit value '%c' in %s\n", str[j], errstr); return EINVAL; } } return 0; } static int get_uint(char **toks, unsigned int *val, char *errstr) { char *str, *tmpstr; str = strtok_r(NULL, " \t\n", toks); if (!str) { if (errstr) printf("**No %s given\n", errstr); return EINVAL; } *val = strtoul(str, &tmpstr, 16); if (*tmpstr != '\0') { if (errstr) printf("**Invalid %s given\n", errstr); return EINVAL; } return 0; } #define INPUT_BUFFER_SIZE 65536 int read_command_file(emu_data_t *emu, char *command_file) { FILE *f = fopen(command_file, "r"); int rv; if (!f) { fprintf(stderr, "Unable to open command file '%s'\n", command_file); } else { char *buffer; int pos = 0; buffer = malloc(INPUT_BUFFER_SIZE); if (!buffer) { fprintf(stderr, "Could not allocate buffer memory\n"); goto out; } while (fgets(buffer+pos, INPUT_BUFFER_SIZE-pos, f)) { printf("%s", buffer+pos); if (buffer[pos] == '#') continue; pos = strlen(buffer); if (pos == 0) continue; pos--; while ((pos > 0) && (buffer[pos] == '\n')) pos--; if (pos == 0) continue; if ((pos > 0) && (buffer[pos] == '\\')) { /* Continue the line. */ /* Don't do pos--, write over the "\\" */ continue; } pos++; buffer[pos] = 0; rv = ipmi_emu_cmd(emu, buffer); if (rv) return rv; pos = 0; } out: if (buffer) free(buffer); fclose(f); } return 0; } static int sel_enable(emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned int max_records; unsigned char flags; rv = get_uint(toks, &max_records, "max records"); if (rv) return rv; rv = get_uchar(toks, &flags, "flags", 0); if (rv) return rv; rv = ipmi_mc_enable_sel(mc, max_records, flags); if (rv) printf("**Unable to enable sel, error 0x%x\n", rv); return rv; } static int sel_add(emu_data_t *emu, lmc_data_t *mc, char **toks) { int i; int rv; unsigned char record_type; unsigned char data[13]; unsigned int r; rv = get_uchar(toks, &record_type, "record type", 0); if (rv) return rv; for (i=0; i<13; i++) { rv = get_uchar(toks, &data[i], "data byte", 0); if (rv) return rv; } rv = ipmi_mc_add_to_sel(mc, record_type, data, &r); if (rv) printf("**Unable to add to sel, error 0x%x\n", rv); else printf("Added record %d\n", r); return rv; } static int main_sdr_add(emu_data_t *emu, lmc_data_t *mc, char **toks) { int i; int rv; unsigned char data[256]; for (i=0; i<256; i++) { rv = get_uchar(toks, &data[i], "data byte", 1); if (rv == ENOSPC) break; if (rv) { printf("**Error 0x%x in data byte %d\n", rv, i); return rv; } } rv = ipmi_mc_add_main_sdr(mc, data, i); if (rv) printf("**Unable to add to sdr, error 0x%x\n", rv); return rv; } static int device_sdr_add(emu_data_t *emu, lmc_data_t *mc, char **toks) { int i; int rv; unsigned char data[256]; unsigned char lun; rv = get_uchar(toks, &lun, "LUN", 0); if (rv) return rv; for (i=0; i<256; i++) { rv = get_uchar(toks, &data[i], "data byte", 1); if (rv == ENOSPC) break; if (rv) { printf("**Error 0x%x in data byte %d\n", rv, i); return rv; } } rv = ipmi_mc_add_device_sdr(mc, lun, data, i); if (rv) printf("**Unable to add to sdr, error 0x%x\n", rv); return rv; } static int sensor_add(emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char type; unsigned char code; rv = get_uchar(toks, &lun, "LUN", 0); if (rv) return rv; rv = get_uchar(toks, &num, "sensor num", 0); if (rv) return rv; rv = get_uchar(toks, &type, "sensor type", 0); if (rv) return rv; rv = get_uchar(toks, &code, "event reading code", 0); if (rv) return rv; rv = ipmi_mc_add_sensor(mc, lun, num, type, code); if (rv) printf("**Unable to add to sensor, error 0x%x\n", rv); return rv; } static int sensor_set_bit(emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char bit; unsigned char value; unsigned char gen_event; rv = get_uchar(toks, &lun, "LUN", 0); if (rv) return rv; rv = get_uchar(toks, &num, "sensor num", 0); if (rv) return rv; rv = get_uchar(toks, &bit, "bit to set", 0); if (rv) return rv; rv = get_uchar(toks, &value, "bit value", 0); if (rv) return rv; rv = get_uchar(toks, &gen_event, "generate event", 0); if (rv) return rv; rv = ipmi_mc_sensor_set_bit(mc, lun, num, bit, value, gen_event); if (rv) printf("**Unable to set sensor bit, error 0x%x\n", rv); return rv; } static int sensor_set_bit_clr_rest(emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char bit; unsigned char gen_event; rv = get_uchar(toks, &lun, "LUN", 0); if (rv) return rv; rv = get_uchar(toks, &num, "sensor num", 0); if (rv) return rv; rv = get_uchar(toks, &bit, "bit to set", 0); if (rv) return rv; rv = get_uchar(toks, &gen_event, "generate event", 0); if (rv) return rv; rv = ipmi_mc_sensor_set_bit_clr_rest(mc, lun, num, bit, gen_event); if (rv) printf("**Unable to set sensor bit, error 0x%x\n", rv); return rv; } static int sensor_set_value(emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char value; unsigned char gen_event; rv = get_uchar(toks, &lun, "LUN", 0); if (rv) return rv; rv = get_uchar(toks, &num, "sensor num", 0); if (rv) return rv; rv = get_uchar(toks, &value, "value", 0); if (rv) return rv; rv = get_uchar(toks, &gen_event, "generate event", 0); if (rv) return rv; rv = ipmi_mc_sensor_set_value(mc, lun, num, value, gen_event); if (rv) printf("**Unable to set sensor value, error 0x%x\n", rv); return rv; } static int sensor_set_hysteresis(emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char support; unsigned char positive, negative; rv = get_uchar(toks, &lun, "LUN", 0); if (rv) return rv; rv = get_uchar(toks, &num, "sensor num", 0); if (rv) return rv; rv = get_uchar(toks, &support, "hysteresis support", 0); if (rv) return rv; rv = get_uchar(toks, &positive, "positive hysteresis", 0); if (rv) return rv; rv = get_uchar(toks, &negative, "negative hysteresis", 0); if (rv) return rv; rv = ipmi_mc_sensor_set_hysteresis(mc, lun, num, support, positive, negative); if (rv) printf("**Unable to set sensor hysteresis, error 0x%x\n", rv); return rv; } static int sensor_set_threshold(emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char support; unsigned char enabled[6]; unsigned char thresholds[6]; int i; rv = get_uchar(toks, &lun, "LUN", 0); if (rv) return rv; rv = get_uchar(toks, &num, "sensor num", 0); if (rv) return rv; rv = get_uchar(toks, &support, "threshold support", 0); if (rv) return rv; rv = get_bitmask(toks, enabled, "threshold enabled", 6, 0); if (rv) return rv; for (i=5; i>=0; i--) { rv = get_uchar(toks, &thresholds[i], "threshold value", 0); if (rv) return rv; } rv = ipmi_mc_sensor_set_threshold(mc, lun, num, support, enabled, thresholds); if (rv) printf("**Unable to set sensor thresholds, error 0x%x\n", rv); return rv; } static int sensor_set_event_support(emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char lun; unsigned char num; unsigned char support; unsigned char events_enable; unsigned char scanning; unsigned char assert_support[15]; unsigned char deassert_support[15]; unsigned char assert_enabled[15]; unsigned char deassert_enabled[15]; rv = get_uchar(toks, &lun, "LUN", 0); if (rv) return rv; rv = get_uchar(toks, &num, "sensor num", 0); if (rv) return rv; rv = get_uchar(toks, &events_enable, "events enable", 0); if (rv) return rv; rv = get_uchar(toks, &scanning, "scanning", 0); if (rv) return rv; rv = get_uchar(toks, &support, "event support", 0); if (rv) return rv; rv = get_bitmask(toks, assert_support, "assert support", 15, 0); if (rv) return rv; rv = get_bitmask(toks, deassert_support, "deassert support", 15, 0); if (rv) return rv; rv = get_bitmask(toks, assert_enabled, "assert enabled", 15, 0); if (rv) return rv; rv = get_bitmask(toks, deassert_enabled, "deassert enabled", 15, 0); if (rv) return rv; rv = ipmi_mc_sensor_set_event_support(mc, lun, num, events_enable, scanning, support, assert_support, deassert_support, assert_enabled, deassert_enabled); if (rv) printf("**Unable to set sensor thresholds, error 0x%x\n", rv); return rv; } static int mc_add(emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned char ipmb; unsigned char device_id; unsigned char has_device_sdrs; unsigned char device_revision; unsigned char major_fw_rev; unsigned char minor_fw_rev; unsigned char device_support; unsigned char mfg_id[3]; unsigned int mfg_id_i; unsigned char product_id[2]; unsigned int product_id_i; unsigned char dyn_sens = 0; int rv; rv = get_uchar(toks, &ipmb, "IPMB address", 0); if (rv) return rv; rv = get_uchar(toks, &device_id, "Device ID", 0); if (rv) return rv; rv = get_uchar(toks, &has_device_sdrs, "Has Device SDRs", 0); if (rv) return rv; rv = get_uchar(toks, &device_revision, "Device Revision", 0); if (rv) return rv; rv = get_uchar(toks, &major_fw_rev, "Major FW Rev", 0); if (rv) return rv; rv = get_uchar(toks, &minor_fw_rev, "Minor FW Rev", 0); if (rv) return rv; rv = get_uchar(toks, &device_support, "Device Support", 0); if (rv) return rv; rv = get_uint(toks, &mfg_id_i, "Manufacturer ID"); if (rv) return rv; rv = get_uint(toks, &product_id_i, "Product ID"); if (rv) return rv; rv = get_uchar(toks, &dyn_sens, "Dynamic Sensor Population", 1); if (rv) goto next; next: mfg_id[0] = mfg_id_i & 0xff; mfg_id[1] = (mfg_id_i >> 8) & 0xff; mfg_id[2] = (mfg_id_i >> 16) & 0xff; product_id[0] = product_id_i & 0xff; product_id[1] = (product_id_i >> 8) & 0xff; rv = ipmi_emu_add_mc(emu, ipmb, device_id, has_device_sdrs, device_revision, major_fw_rev, minor_fw_rev, device_support, mfg_id, product_id, dyn_sens); if (rv) printf("**Unable to add the MC, error 0x%x\n", rv); return rv; } static int mc_setchan(emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned char channel; unsigned char medium_type; unsigned char protocol_type; unsigned char session_support; int rv; rv = get_uchar(toks, &channel, "Channel Number", 0); if (rv) return rv; rv = get_uchar(toks, &medium_type, "Medium Type", 0); if (rv) return rv; rv = get_uchar(toks, &protocol_type, "Protocol Type", 0); if (rv) return rv; rv = get_uchar(toks, &session_support, "Session Support", 0); if (rv) return rv; rv = ipmi_emu_set_mc_channel(mc, channel, medium_type, protocol_type, session_support); if (rv) printf("**Unable to set up channel, error 0x%x\n", rv); return rv; } static int mc_delete(emu_data_t *emu, lmc_data_t *mc, char **toks) { ipmi_mc_destroy(mc); return 0; } static int mc_disable(emu_data_t *emu, lmc_data_t *mc, char **toks) { ipmi_mc_disable(mc); return 0; } static int mc_enable(emu_data_t *emu, lmc_data_t *mc, char **toks) { ipmi_mc_enable(mc); return 0; } static int mc_set_power(emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned char power; unsigned char gen_int; int rv; rv = get_uchar(toks, &power, "Power", 0); if (rv) return rv; rv = get_uchar(toks, &gen_int, "Gen int", 0); if (rv) return rv; rv = ipmi_mc_set_power(mc, power, gen_int); if (rv) printf("**Unable to set power, error 0x%x\n", rv); return rv; } #define MAX_FRU_SIZE 8192 static int mc_add_fru_data(emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned char data[MAX_FRU_SIZE]; unsigned char devid; unsigned int length; int i; int rv; rv = get_uchar(toks, &devid, "Device ID", 0); if (rv) return rv; rv = get_uint(toks, &length, "FRU physical size"); if (rv) return rv; for (i=0; i 0) && ((i % 8) == 0)) printf("\n"); printf(" 0x%2.2x", data[i]); } printf("\n"); out: return rv; } static int mc_setbmc(emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned char ipmb; int rv; rv = get_uchar(toks, &ipmb, "IPMB address of BMC", 0); if (rv) return rv; rv = ipmi_emu_set_bmc_mc(emu, ipmb); if (rv) printf("**Invalid IPMB address\n"); return rv; } static int atca_enable(emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; rv = ipmi_emu_atca_enable(emu); if (rv) printf("**Unable to enable ATCA mode, error 0x%x\n", rv); return rv; } static int atca_set_site(emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char hw_address; unsigned char site_type; unsigned char site_number; rv = get_uchar(toks, &hw_address, "hardware address", 0); if (rv) return rv; rv = get_uchar(toks, &site_type, "site type", 0); if (rv) return rv; rv = get_uchar(toks, &site_number, "site number", 0); if (rv) return rv; rv = ipmi_emu_atca_set_site(emu, hw_address, site_type, site_number); if (rv) printf("**Unable to set site type, error 0x%x\n", rv); return rv; } static int mc_set_num_leds(emu_data_t *emu, lmc_data_t *mc, char **toks) { int rv; unsigned char count; rv = get_uchar(toks, &count, "number of LEDs", 0); if (rv) return rv; rv = ipmi_mc_set_num_leds(mc, count); if (rv) printf("**Unable to set number of LEDs, error 0x%x\n", rv); return rv; } static int read_cmds(emu_data_t *emu, lmc_data_t *mc, char **toks) { char *filename = strtok_r(NULL, " \t\n", toks); if (!filename) { printf("**No filename specified\n"); return EINVAL; } return read_command_file(emu, filename); } static int sleep_cmd(emu_data_t *emu, lmc_data_t *mc, char **toks) { unsigned int time; struct timeval tv; int rv; rv = get_uint(toks, &time, "timeout"); if (rv) return rv; tv.tv_sec = time / 1000; tv.tv_usec = (time % 1000) * 1000; ipmi_emu_sleep(emu, &tv); return 0; } static int quit(emu_data_t *emu, lmc_data_t *mc, char **toks) { ipmi_emu_shutdown(); return 0; } #define MC 1 #define NOMC 0 static struct { char *name; int flags; ipmi_emu_cmd_handler handler; } cmds[] = { { "quit", NOMC, quit }, { "sel_enable", MC, sel_enable }, { "sel_add", MC, sel_add }, { "main_sdr_add", MC, main_sdr_add }, { "device_sdr_add", MC, device_sdr_add }, { "sensor_add", MC, sensor_add }, { "sensor_set_bit", MC, sensor_set_bit }, { "sensor_set_bit_clr_rest", MC, sensor_set_bit_clr_rest }, { "sensor_set_value", MC, sensor_set_value }, { "sensor_set_hysteresis", MC, sensor_set_hysteresis }, { "sensor_set_threshold", MC, sensor_set_threshold }, { "sensor_set_event_support", MC, sensor_set_event_support }, { "mc_set_power", MC, mc_set_power }, { "mc_add_fru_data",MC, mc_add_fru_data }, { "mc_dump_fru_data",MC, mc_dump_fru_data }, { "mc_set_num_leds",MC, mc_set_num_leds }, { "mc_add", NOMC, mc_add }, { "mc_delete", MC, mc_delete }, { "mc_disable", MC, mc_disable }, { "mc_enable", MC, mc_enable }, { "mc_setbmc", NOMC, mc_setbmc }, { "mc_setchan", MC, mc_setchan }, { "atca_enable", NOMC, atca_enable }, { "atca_set_site", NOMC, atca_set_site }, { "read_cmds", NOMC, read_cmds }, { "sleep", NOMC, sleep_cmd }, { NULL } }; int ipmi_emu_cmd(emu_data_t *emu, char *cmd_str) { char *toks; char *cmd; int i; int rv = EINVAL; lmc_data_t *mc = NULL; cmd = strtok_r(cmd_str, " \t\n", &toks); if (!cmd) return 0; if (cmd[0] == '#') return 0; for (i=0; cmds[i].name; i++) { if (strcmp(cmd, cmds[i].name) == 0) { if (cmds[i].flags & MC) { unsigned char ipmb; rv = get_uchar(&toks, &ipmb, "MC address", 0); if (rv) return rv; rv = ipmi_emu_get_mc_by_addr(emu, ipmb, &mc); if (rv) { printf("**Invalid MC address\n"); return rv; } } rv = cmds[i].handler(emu, mc, &toks); if (rv) return rv; goto out; } } printf("**Unknown command: %s\n", cmd); out: return rv; } openipmi-2.0.18/lanserv/lanserv_asf.c0000644000175000017500000001037710320111277016521 0ustar chuckchuck/* * lanserv_asf.c * * MontaVista IPMI RMCP/ASF LAN interface protocol engine * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include /* Deal with multi-byte data, RMCP (big-endian) style. */ #if 0 /* These are not currently used. */ static unsigned int rmcp_get_uint16(uint8_t *data) { return (data[1] | (data[0] << 8)); } static void rmcp_set_uint16(uint8_t *data, int val) { data[1] = val & 0xff; data[0] = (val >> 8) & 0xff; } #endif static unsigned int rmcp_get_uint32(uint8_t *data) { return (data[3] | (data[2] << 8) | (data[1] << 16) | (data[0] << 24)); } static void rmcp_set_uint32(uint8_t *data, int val) { data[3] = val & 0xff; data[2] = (val >> 8) & 0xff; data[1] = (val >> 16) & 0xff; data[0] = (val >> 24) & 0xff; } #define ASF_IANA 4542 void handle_asf(lan_data_t *lan, uint8_t *data, int len, void *from_addr, int from_len) { uint8_t rsp[28]; struct iovec vec[1]; if (len < 12) return; if (rmcp_get_uint32(data+4) != ASF_IANA) return; /* Not ASF IANA */ if (data[8] != 0x80) return; /* Not a presence ping. */ /* Ok, it's a valid RMCP/ASF Presence Ping, start working on the response. */ rsp[0] = 6; rsp[1] = 0; rsp[2] = 0xff; /* No ack, the ack is not required, so we don't do it. */ rsp[3] = 6; /* ASF class */ rmcp_set_uint32(rsp+4, ASF_IANA); rsp[8] = 0x40; /* Presense Pong */ rsp[9] = data[9]; /* Message tag */ rsp[10] = 0; rsp[11] = 16; /* Data length */ rmcp_set_uint32(rsp+12, ASF_IANA); /* no special capabilities */ rmcp_set_uint32(rsp+16, 0); /* no special capabilities */ rsp[20] = 0x81; /* We support IPMI */ rsp[21] = 0x0; /* No supported interactions */ memset(rsp+22, 0, 6); /* Reserved. */ vec[0].iov_base = rsp; vec[0].iov_len = 28; /* Return the response. */ lan->lan_send(lan, vec, 1, from_addr, from_len); } openipmi-2.0.18/lanserv/lanserv_ipmi.c0000644000175000017500000026150711034536455016725 0ustar chuckchuck/* * lanserv_ipmi.c * * MontaVista IPMI IPMI LAN interface protocol engine * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #ifdef HAVE_OPENSSL #include #endif #include #include #include #include #include #if 0 static void dump_data(const unsigned char *d, int l, const char *n) { int i; printf("%s:", n); for (i=0; i> 8) & 0xff; } static unsigned int ipmi_get_uint32(uint8_t *data) { return (data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24)); } static void ipmi_set_uint32(uint8_t *data, int val) { data[0] = val & 0xff; data[1] = (val >> 8) & 0xff; data[2] = (val >> 16) & 0xff; data[3] = (val >> 24) & 0xff; } static int is_authval_null(uint8_t *val) { int i; for (i=0; i<16; i++) if (val[i] != 0) return 0; return 1; } static void cleanup_ascii_16(uint8_t *c) { int i; i = 0; while ((i < 16) && (*c != 0)) { c++; i++; } while (i < 16) { *c = 0; c++; i++; } } static oem_handler_t *oem_handlers = NULL; void ipmi_register_oem(oem_handler_t *handler) { handler->next = oem_handlers; oem_handlers = handler; } static void check_oem_handlers(lan_data_t *lan) { oem_handler_t *c; c = oem_handlers; while (c) { if ((c->manufacturer_id == lan->manufacturer_id) && (c->product_id == lan->product_id)) { c->handler(lan, c->cb_data); break; } c = c->next; } } static user_t * find_user(lan_data_t *lan, uint8_t *user, int name_only_lookup, int priv) { int i; user_t *rv = NULL; for (i=1; i<=MAX_USERS; i++) { if (lan->users[i].valid && (memcmp(user, lan->users[i].username, 16) == 0)) { if (name_only_lookup || (lan->users[i].privilege == priv)) { rv = &(lan->users[i]); break; } } } return rv; } static uint8_t ipmb_checksum(uint8_t *data, int size, uint8_t start) { uint8_t csum = start; for (; size > 0; size--, data++) csum += *data; return csum; } static session_t * sid_to_session(lan_data_t *lan, unsigned int sid) { int idx; session_t *session; if (sid & 1) return NULL; idx = (sid >> 1) & SESSION_MASK; if (idx > MAX_SESSIONS) return NULL; session = lan->sessions + idx; if (!session->active) return NULL; if (session->sid != sid) return NULL; return session; } static void close_session(lan_data_t *lan, session_t *session) { session->active = 0; if (session->authtype <= 4) ipmi_auths[session->authtype].authcode_cleanup(session->authdata); if (session->integh) session->integh->cleanup(lan, session); if (session->confh) session->confh->cleanup(lan, session); lan->active_sessions--; if (session->src_addr) { lan->free(lan, session->src_addr); session->src_addr = NULL; } } static int auth_gen(session_t *ses, uint8_t *out, uint8_t *sid, uint8_t *seq, uint8_t *data1, int data1_len, uint8_t *data2, int data2_len, uint8_t *data3, int data3_len) { int rv; ipmi_auth_sg_t l[] = { { sid, 4 }, { data1, data1_len }, { data2, data2_len }, { data3, data3_len }, { seq, 4 }, { NULL, 0 }}; rv = ipmi_auths[ses->authtype].authcode_gen(ses->authdata, l, out); return rv; } static int auth_check(session_t *ses, uint8_t *sid, uint8_t *seq, uint8_t *data, int data_len, uint8_t *code) { int rv; ipmi_auth_sg_t l[] = { { sid, 4 }, { data, data_len }, { seq, 4 }, { NULL, 0 }}; rv = ipmi_auths[ses->authtype].authcode_check(ses->authdata, l, code); return rv; } static int gen_challenge(lan_data_t *lan, uint8_t *out, uint32_t sid) { int rv; ipmi_auth_sg_t l[] = { { &sid, 4 }, { NULL, 0 }}; rv = ipmi_md5_authcode_gen(lan->challenge_auth, l, out); return rv; } static int check_challenge(lan_data_t *lan, uint32_t sid, uint8_t *code) { int rv; ipmi_auth_sg_t l[] = { { &sid, 4 }, { NULL, 0 }}; rv = ipmi_md5_authcode_check(lan->challenge_auth, l, code); return rv; } #define IPMI_LAN_MAX_HEADER_SIZE 64 #define IPMI_LAN_MAX_TRAILER_SIZE 64 static void return_rmcpp_rsp(lan_data_t *lan, session_t *session, msg_t *msg, unsigned int payload, unsigned char *data, unsigned int len, unsigned char iana[3], unsigned int payload_id) { uint8_t d[IPMI_LAN_MAX_HEADER_SIZE+IPMI_LAN_MAX_HEADER_SIZE +IPMI_LAN_MAX_TRAILER_SIZE+1]; uint8_t *pos = d + IPMI_LAN_MAX_HEADER_SIZE; uint8_t *tpos; unsigned int hdr_left = IPMI_LAN_MAX_HEADER_SIZE; unsigned int dlen = IPMI_LAN_MAX_HEADER_SIZE + IPMI_LAN_MAX_TRAILER_SIZE; unsigned int mlen; struct iovec vec[3]; uint32_t sid, seq, *seqp; int rv; unsigned int s; if (!session) session = sid_to_session(lan, msg->sid); if (len > dlen) return; memcpy(pos, data, len); if (payload == 0) { /* Add the IPMI header - fixme -cheap hack */ if (hdr_left < 6) return; hdr_left -= 6; pos -= 6; dlen += 6; /* Adding header, increase total length */ len += 6; pos[0] = msg->rq_addr; pos[1] = ((msg->netfn | 1) << 2) | msg->rq_lun; pos[2] = -ipmb_checksum(pos, 2, 0); pos[3] = msg->rs_addr; pos[4] = (msg->rq_seq << 2) | msg->rs_lun; pos[5] = msg->cmd; pos[len] = -ipmb_checksum(pos+3, len-3, 0); len++; } if (session && !session->in_startup) { if (session->conf) { rv = session->confh->encrypt(lan, session, &pos, &hdr_left, &len, &dlen); if (rv) { lan->log(INVALID_MSG, msg, "Message failure:" " encryption failed: 0x%x", rv); return; } } } mlen = len; if (session && !session->in_startup && session->integ) { unsigned int count; /* Pad to the next multiple of 4, including the pad length and next header. */ count = 0; while ((mlen+2) % 4) { if (mlen == dlen) return; pos[mlen] = 0xff; count++; mlen++; } if (mlen == dlen) return; pos[mlen] = count; mlen++; if (mlen == dlen) return; pos[mlen] = 0x07; /* Next header */ mlen++; } if (payload == 2) s = 22; else s = 16; if (hdr_left < s) return; hdr_left -= s; pos -= s; dlen += s; /* Adding header, increase total length */ mlen += s; pos[0] = 0x06; pos[1] = 0; pos[2] = 0xff; pos[3] = 0x07; pos[4] = IPMI_AUTHTYPE_RMCP_PLUS; pos[5] = payload; if (!session || session->in_startup) { sid = 0; seq = 0; seqp = NULL; } else { sid = session->rem_sid; if (session->integ != 0) { seq = session->xmit_seq; seqp = &session->xmit_seq; pos[5] |= 0x40; } else { seq = session->unauth_xmit_seq; seqp = &session->unauth_xmit_seq; } if (session->conf != 0) pos[5] |= 0x80; } tpos = pos + 6; if (payload == 2) { memcpy(tpos, iana, 3); tpos[3] = 0; ipmi_set_uint16(tpos+4, payload_id); tpos += 6; } ipmi_set_uint32(tpos, sid); tpos += 4; ipmi_set_uint32(tpos, seq); tpos += 4; ipmi_set_uint16(tpos, seq); ipmi_set_uint16(tpos, len); if (session && !session->in_startup && session->integ) { rv = session->integh->add(lan, session, pos, &mlen, dlen); if (rv) { lan->log(INVALID_MSG, msg, "Message failure:" " encryption failed: 0x%x", rv); return; } } if (seqp) { (*seqp)++; if (*seqp == 0) *seqp = 1; } vec[0].iov_base = pos; vec[0].iov_len = mlen; lan->lan_send(lan, vec, 1, msg->src_addr, msg->src_len); } static void return_rsp(lan_data_t *lan, msg_t *msg, session_t *session, rsp_msg_t *rsp) { uint8_t data[IPMI_LAN_MAX_HEADER_SIZE]; struct iovec vec[3]; uint8_t csum; session_t dummy_session; uint8_t *pos; int len; int rv; if (!session) session = sid_to_session(lan, msg->sid); if (session && session->rmcpplus) { return_rmcpp_rsp(lan, session, msg, 0, rsp->data, rsp->data_len, NULL, 0); return; } else if (msg->sid == 0) { session = &dummy_session; session->active = 1; session->authtype = IPMI_AUTHTYPE_NONE; session->xmit_seq = 0; session->sid = 0; } if (lan->oem_handle_rsp && lan->oem_handle_rsp(lan, msg, session, rsp)) /* OEM code handled the response. */ return; if (!session) return; data[0] = 6; /* RMCP version. */ data[1] = 0; data[2] = 0xff; /* No seq num */ data[3] = 7; /* IPMI msg class */ data[4] = session->authtype; ipmi_set_uint32(data+5, session->xmit_seq); session->xmit_seq++; if (session->xmit_seq == 0) session->xmit_seq++; ipmi_set_uint32(data+9, session->sid); if (session->authtype == IPMI_AUTHTYPE_NONE) pos = data+13; else pos = data+29; len = rsp->data_len + 7; *pos = len; pos++; pos[0] = msg->rq_addr; pos[1] = (rsp->netfn << 2) | msg->rq_lun; pos[2] = - ipmb_checksum(pos, 2, 0); pos[3] = msg->rs_addr; pos[4] = (msg->rq_seq << 2) | msg->rs_lun; pos[5] = rsp->cmd; csum = ipmb_checksum(pos+3, 3, 0); csum = - ipmb_checksum(rsp->data, rsp->data_len, csum); vec[0].iov_base = data; if (session->authtype == IPMI_AUTHTYPE_NONE) vec[0].iov_len = 14 + 6; else { rv = auth_gen(session, data+13, data+9, data+5, pos, 6, rsp->data, rsp->data_len, &csum, 1); if (rv) { /* FIXME - what to do? */ return; } vec[0].iov_len = 30 + 6; } vec[1].iov_base = rsp->data; vec[1].iov_len = rsp->data_len; vec[2].iov_base = &csum; vec[2].iov_len = 1; lan->lan_send(lan, vec, 3, msg->src_addr, msg->src_len); } static void return_rsp_data(lan_data_t *lan, msg_t *msg, session_t *session, uint8_t *data, int len) { rsp_msg_t rsp; rsp.netfn = msg->netfn | 1; rsp.cmd = msg->cmd; rsp.data = data; rsp.data_len = len; return_rsp(lan, msg, session, &rsp); } static void return_err(lan_data_t *lan, msg_t *msg, session_t *session, uint8_t err) { rsp_msg_t rsp; rsp.netfn = msg->netfn | 1; rsp.cmd = msg->cmd; rsp.data = &err; rsp.data_len = 1; return_rsp(lan, msg, session, &rsp); } static void handle_get_system_guid(lan_data_t *lan, session_t *session, msg_t *msg) { uint8_t data[17]; if (lan->guid) { data[0] = 0; memcpy(data+1, lan->guid, 16); return_rsp_data(lan, msg, session, data, 17); } else { lan->log(INVALID_MSG, msg, "Invalid command: 0x%x", msg->cmd); return_err(lan, msg, session, IPMI_INVALID_CMD_CC); } } static void handle_get_channel_auth_capabilities(lan_data_t *lan, msg_t *msg) { uint8_t data[9]; uint8_t chan; uint8_t priv; int do_rmcpp; if (msg->len < 2) { lan->log(INVALID_MSG, msg, "Get channel auth failed: message too short"); return_err(lan, msg, NULL, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } do_rmcpp = (msg->data[0] >> 7) & 1; chan = msg->data[0] & 0xf; priv = msg->data[1] & 0xf; if (chan == 0xe) chan = MAIN_CHANNEL; if (chan != MAIN_CHANNEL) { lan->log(INVALID_MSG, msg, "Get channel auth failed: Invalid channel: %d", chan); return_err(lan, msg, NULL, IPMI_INVALID_DATA_FIELD_CC); } else if (priv > lan->channel.privilege_limit) { lan->log(INVALID_MSG, msg, "Get channel auth failed: Invalid privilege: %d", priv); return_err(lan, msg, NULL, IPMI_INVALID_DATA_FIELD_CC); } else { if (! lan->guid) do_rmcpp = 0; /* Must have a GUID to do RMCP+ */ data[0] = 0; data[1] = chan; data[2] = lan->channel.priv_info[priv-1].allowed_auths; if (do_rmcpp) data[2] |= 0x80; data[3] = 0x04; /* per-message authentication is on, user-level authenitcation is on, non-null user names disabled, no anonymous support. */ if (lan->users[1].valid) { if (is_authval_null(lan->users[1].pw)) data[3] |= 0x01; /* Anonymous login. */ else data[3] |= 0x02; /* Null user supported. */ } if (lan->bmc_key) data[3] |= 0x20; data[4] = 0; if (do_rmcpp) data[4] |= 0x3; /* Support RMCP and RMCP+ */ data[5] = lan->manufacturer_id & 0xff; data[6] = (lan->manufacturer_id >> 8) & 0xff; data[7] = (lan->manufacturer_id >> 16) & 0xff; data[8] = 0; return_rsp_data(lan, msg, NULL, data, 9); } } static void handle_get_session_challenge(lan_data_t *lan, msg_t *msg) { uint8_t data[21]; user_t *user; uint32_t sid; uint8_t authtype; int rv; if (msg->len < 17) { lan->log(INVALID_MSG, msg, "Session challenge failed: message too short"); return_err(lan, msg, NULL, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } authtype = msg->data[0] & 0xf; user = find_user(lan, msg->data+1, 1, 0); if (!user) { lan->log(SESSION_CHALLENGE_FAILED, msg, "Session challenge failed: Invalid user"); if (is_authval_null(msg->data+1)) return_err(lan, msg, NULL, 0x82); /* no null user */ else return_err(lan, msg, NULL, 0x81); /* no user */ return; } if (!(user->allowed_auths & (1 << authtype))) { lan->log(SESSION_CHALLENGE_FAILED, msg, "Session challenge failed: Invalid authorization type"); return_err(lan, msg, NULL, IPMI_INVALID_DATA_FIELD_CC); return; } data[0] = 0; sid = (lan->next_challenge_seq << (USER_BITS_REQ+1)) | (user->idx << 1) | 1; lan->next_challenge_seq++; ipmi_set_uint32(data+1, sid); rv = gen_challenge(lan, data+5, sid); if (rv) { lan->log(SESSION_CHALLENGE_FAILED, msg, "Session challenge failed: Error generating challenge"); return_err(lan, msg, NULL, IPMI_UNKNOWN_ERR_CC); } else { return_rsp_data(lan, msg, NULL, data, 21); } } static void handle_no_session(lan_data_t *lan, msg_t *msg) { /* Should be a session challenge, validate everything else. */ if (msg->seq != 0) { lan->log(INVALID_MSG, msg, "No session message failed: Invalid seq"); return; } if (msg->authtype != IPMI_AUTHTYPE_NONE) { lan->log(INVALID_MSG, msg, "No session message failed: Invalid authtype: %d", msg->authtype); return; } switch (msg->cmd) { case IPMI_GET_SYSTEM_GUID_CMD: handle_get_system_guid(lan, NULL, msg); break; case IPMI_GET_CHANNEL_AUTH_CAPABILITIES_CMD: handle_get_channel_auth_capabilities(lan, msg); break; case IPMI_GET_SESSION_CHALLENGE_CMD: handle_get_session_challenge(lan, msg); break; default: lan->log(INVALID_MSG, msg, "No session message failed: Invalid command: 0x%x", msg->cmd); return_err(lan, msg, NULL, IPMI_NOT_SUPPORTED_IN_PRESENT_STATE_CC); break; } } static void * ialloc(void *info, int size) { lan_data_t *lan = info; return lan->alloc(lan, size); } static void ifree(void *info, void *data) { lan_data_t *lan = info; lan->free(lan, data); } static session_t * find_free_session(lan_data_t *lan) { int i; /* Find a free session. Session 0 is invalid. */ for (i=1; i<=MAX_SESSIONS; i++) { if (! lan->sessions[i].active) return &(lan->sessions[i]); } return NULL; } static void handle_temp_session(lan_data_t *lan, msg_t *msg) { uint8_t seq_data[4]; int user_idx; user_t *user; uint8_t auth, priv; session_t *session = NULL; session_t dummy_session; int rv; uint32_t xmit_seq; uint8_t data[11]; unsigned char tsid[4]; unsigned char tseq[4]; if (msg->cmd != IPMI_ACTIVATE_SESSION_CMD) { lan->log(INVALID_MSG, msg, " message failed: Invalid command: 0x%x", msg->cmd); return; } if (msg->len < 22) { lan->log(INVALID_MSG, msg, "Activate session failed: message too short"); return; } rv = check_challenge(lan, msg->sid, msg->data+2); if (rv) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: challenge failed"); return; } user_idx = (msg->sid >> 1) & USER_MASK; if ((user_idx > MAX_USERS) || (user_idx == 0)) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: Invalid sid: 0x%x", msg->sid); return; } auth = msg->data[0] & 0xf; user = &(lan->users[user_idx]); if (! (user->valid)) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: Invalid user idx: 0x%x", user_idx); return; } if (! (user->allowed_auths & (1 << auth))) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: Requested auth %d was invalid for" " user 0x%x", auth, user_idx); return; } if (! (user->allowed_auths & (1 << msg->authtype))) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: Message auth %d was invalid for" " user 0x%x", msg->authtype, user_idx); return; } xmit_seq = ipmi_get_uint32(msg->data+18); memset(&dummy_session, 0, sizeof(dummy_session)); dummy_session.active = 1; dummy_session.authtype = msg->authtype; dummy_session.xmit_seq = xmit_seq; dummy_session.sid = msg->sid; rv = ipmi_auths[msg->authtype].authcode_init(user->pw, &dummy_session.authdata, lan, ialloc, ifree); if (rv) { lan->log(AUTH_FAILED, msg, "Activate session failed: Message auth init failed"); return; } /* The "-6, +7" is cheating a little, but we need the last checksum to correctly calculate the code. */ ipmi_set_uint32(tsid, msg->sid); ipmi_set_uint32(tseq, msg->seq); rv = auth_check(&dummy_session, tsid, tseq, msg->data-6, msg->len+7, msg->authcode); if (rv) { lan->log(AUTH_FAILED, msg, "Activate session failed: Message auth failed"); goto out_free; } /* Note that before this point, we cannot return an error, there's no way to generate an authcode for it. */ if (xmit_seq == 0) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: Invalid sequence number"); return_err(lan, msg, &dummy_session, 0x85); /* Invalid seq id */ goto out_free; } priv = msg->data[1] & 0xf; if ((user->privilege == 0xf) || (priv > user->privilege) || (priv > lan->channel.privilege_limit)) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: Privilege %d for user 0x%d failed", priv, user_idx); return_err(lan, msg, &dummy_session, 0x86); /* Privilege error */ goto out_free; } if (! (lan->channel.priv_info[priv-1].allowed_auths & (1 << auth))) { /* Authentication level not permitted for this privilege */ lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: Auth level %d invalid for" " privilege %d", auth, priv); return_err(lan, msg, &dummy_session, IPMI_INVALID_DATA_FIELD_CC); goto out_free; } session = find_free_session(lan); if (!session) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: out of free sessions"); return_err(lan, msg, &dummy_session, 0x81); /* No session slot */ goto out_free; } session->src_addr = lan->alloc(lan, msg->src_len); if (!session->src_addr) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: out of memory"); return_err(lan, msg, &dummy_session, IPMI_UNKNOWN_ERR_CC); goto out_free; } memcpy(session->src_addr, msg->src_addr, msg->src_len); session->src_len = msg->src_len; session->active = 1; session->rmcpplus = 0; session->authtype = auth; session->authdata = dummy_session.authdata; rv = lan->gen_rand(lan, seq_data, 4); if (rv) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: Could not generate random number"); return_err(lan, msg, &dummy_session, IPMI_UNKNOWN_ERR_CC); goto out_free; } session->recv_seq = ipmi_get_uint32(seq_data) & ~1; if (!session->recv_seq) session->recv_seq = 2; session->xmit_seq = xmit_seq; session->max_priv = priv; session->priv = IPMI_PRIVILEGE_USER; /* Start at user privilege. */ session->userid = user->idx; session->time_left = lan->default_session_timeout; lan->log(NEW_SESSION, msg, "Activate session: Session opened for user 0x%x, max priv %d", user_idx, priv); if (lan->sid_seq == 0) lan->sid_seq++; session->sid = ((lan->sid_seq << (SESSION_BITS_REQ+1)) | (session->handle << 1)); lan->sid_seq++; data[0] = 0; data[1] = auth; ipmi_set_uint32(data+2, session->sid); ipmi_set_uint32(data+6, session->recv_seq); data[10] = session->max_priv; lan->active_sessions++; return_rsp_data(lan, msg, &dummy_session, data, 11); return; out_free: ipmi_auths[msg->authtype].authcode_cleanup(dummy_session.authdata); } /* The command handling below is for active sessions. */ static void handle_smi_msg(lan_data_t *lan, session_t *session, msg_t *msg) { msg_t *nmsg; int rv; nmsg = lan->alloc(lan, sizeof(*nmsg)+msg->src_len+msg->len); if (!nmsg) { lan->log(OS_ERROR, msg, "SMI message: out of memory"); return_err(lan, msg, NULL, IPMI_UNKNOWN_ERR_CC); return; } memcpy(nmsg, msg, sizeof(*nmsg)); nmsg->src_addr = ((char *) nmsg) + sizeof(*nmsg); memcpy(nmsg->src_addr, msg->src_addr, msg->src_len); nmsg->data = ((uint8_t *) nmsg->src_addr) + msg->src_len; memcpy(nmsg->data, msg->data, msg->len); rv = lan->smi_send(lan, nmsg); if (rv) { lan->log(OS_ERROR, msg, "SMI send: error %d", rv); lan->free(lan, nmsg); if (rv == EMSGSIZE) return_err(lan, msg, session, IPMI_REQUESTED_DATA_LENGTH_EXCEEDED_CC); else return_err(lan, msg, session, IPMI_UNKNOWN_ERR_CC); return; } } static void handle_activate_session_cmd(lan_data_t *lan, session_t *session, msg_t *msg) { uint8_t data[11]; if (msg->len < 22) { lan->log(INVALID_MSG, msg, "Activate session failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } /* We are already connected, we ignore everything but the outbound sequence number. */ session->xmit_seq = ipmi_get_uint32(msg->data+18); data[0] = 0; data[1] = session->authtype; ipmi_set_uint32(data+2, session->sid); ipmi_set_uint32(data+6, session->recv_seq); data[10] = session->max_priv; return_rsp_data(lan, msg, session, data, 11); } static void handle_set_session_privilege(lan_data_t *lan, session_t *session, msg_t *msg) { uint8_t data[2]; uint8_t priv; if (msg->len < 1) { lan->log(INVALID_MSG, msg, "Set session priv failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } priv = msg->data[0] & 0xf; if (priv == 0) priv = session->priv; if (priv == IPMI_PRIVILEGE_CALLBACK) { return_err(lan, msg, session, 0x80); /* Can't drop below user priv. */ return; } if (priv > session->max_priv) { return_err(lan, msg, session, 0x81); /* Cannot set the priv this high. */ return; } session->priv = priv; data[0] = 0; data[1] = priv; return_rsp_data(lan, msg, session, data, 2); } static void handle_close_session(lan_data_t *lan, session_t *session, msg_t *msg) { uint32_t sid; session_t *nses = session; if (msg->len < 4) { lan->log(INVALID_MSG, msg, "Close session failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } sid = ipmi_get_uint32(msg->data); if (sid != session->sid) { if (session->priv != IPMI_PRIVILEGE_ADMIN) { /* Only admins can close other people's sessions. */ return_err(lan, msg, session, IPMI_INSUFFICIENT_PRIVILEGE_CC); return; } nses = sid_to_session(lan, sid); if (!nses) { return_err(lan, msg, session, 0x87); /* session not found */ return; } } lan->log(SESSION_CLOSED, msg, "Session closed: Closed due to request"); return_err(lan, msg, session, 0); close_session(lan, nses); } static void handle_get_session_info(lan_data_t *lan, session_t *session, msg_t *msg) { uint8_t idx; session_t *nses = NULL; uint8_t data[19]; if (msg->len < 1) { lan->log(INVALID_MSG, msg, "Get session failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } idx = msg->data[0]; if (idx == 0xff) { unsigned int sid; if (msg->len < 5) { return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } sid = ipmi_get_uint32(msg->data+1); nses = sid_to_session(lan, sid); } else if (idx == 0xfe) { int handle; if (msg->len < 2) { return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } handle = msg->data[1]; if (handle >= MAX_SESSIONS) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } if (lan->sessions[handle].active) nses = &lan->sessions[handle]; } else if (idx == 0) { nses = session; } else { int i; if (idx <= lan->active_sessions) { for (i=0; i<=MAX_SESSIONS; i++) { if (lan->sessions[i].active) { idx--; if (idx == 0) { nses = &lan->sessions[i]; break; } } } } } data[0] = 0; data[2] = MAX_SESSIONS; data[3] = lan->active_sessions; if (nses) { data[1] = nses->handle; data[4] = nses->userid; data[5] = nses->priv; data[6] = MAIN_CHANNEL | (session->rmcpplus << 4); return_rsp_data(lan, msg, session, data, 7); } else { data[1] = 0; return_rsp_data(lan, msg, session, data, 4); } /* FIXME - We don't currently return the IP information, because it's hard to get. Maybe later. */ } static void handle_get_authcode(lan_data_t *lan, session_t *session, msg_t *msg) { lan->log(INVALID_MSG, msg, "Get authcode failure: invalid command"); /* This is optional, and we don't do it yet. */ return_err(lan, msg, session, IPMI_INVALID_CMD_CC); } static void handle_set_channel_access(lan_data_t *lan, session_t *session, msg_t *msg) { uint8_t upd1, upd2; int write_nonv = 0; uint8_t newv; if (msg->len < 3) { lan->log(INVALID_MSG, msg, "Set channel access failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } if ((msg->data[0] & 0xf) != MAIN_CHANNEL) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } upd1 = (msg->data[1] >> 6) & 0x3; if ((upd1 == 1) || (upd1 == 2)) { newv = (msg->data[1] >> 4) & 1; if (newv) { /* Don't support per-msg authentication */ return_err(lan, msg, session, 0x83); return; } newv = (msg->data[1] >> 3) & 1; if (newv) { /* Don't support unauthenticated user-level access */ return_err(lan, msg, session, 0x83); return; } newv = (msg->data[1] >> 0) & 7; if (newv != 0x2) { /* Only support "always available" channel */ return_err(lan, msg, session, 0x83); return; } if (upd1 == 1) { lan->channel.PEF_alerting = (msg->data[1] >> 5) & 1; } else { lan->nonv_channel.PEF_alerting = (msg->data[1] >> 5) & 1; write_nonv = 1; } } else if (upd1 != 0) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } upd2 = (msg->data[2] >> 6) & 0x3; if ((upd2 == 1) || (upd2 == 2)) { newv = (msg->data[2] >> 0) & 0xf; if ((newv == 0) || (newv > 4)) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } if (upd2 == 1) { lan->nonv_channel.privilege_limit = newv; write_nonv = 1; } else { lan->channel.privilege_limit = newv; } } else if (upd2 != 0) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } if (write_nonv) lan->write_config(lan); return_err(lan, msg, session, 0); } static void handle_get_channel_access(lan_data_t *lan, session_t *session, msg_t *msg) { uint8_t data[3]; uint8_t upd; channel_t *channel; if (msg->len < 2) { lan->log(INVALID_MSG, msg, "Get channel access failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } if ((msg->data[0] & 0xf) != MAIN_CHANNEL) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } upd = (msg->data[1] >> 6) & 0x3; if (upd == 2) { channel = &(lan->channel); } else if (upd == 1) { channel = &(lan->nonv_channel); } else { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } data[0] = 0; data[1] = ((channel->PEF_alerting << 5) | 0x2); data[2] = channel->privilege_limit; return_rsp_data(lan, msg, session, data, 3); } static void handle_get_channel_info(lan_data_t *lan, session_t *session, msg_t *msg) { uint8_t data[10]; uint8_t chan; if (msg->len < 1) { lan->log(INVALID_MSG, msg, "Get channel info failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } chan = msg->data[0] & 0xf; if (chan == 0xe) chan = MAIN_CHANNEL; if (chan == MAIN_CHANNEL) { data[0] = 0; data[1] = chan; data[2] = 4; /* 802.3 LAN */ data[3] = 1; /* IPMB, for some reason. */ data[4] = (2 << 6) | lan->active_sessions; data[5] = 0xf2; /* IPMI IANA */ data[6] = 0x1b; data[7] = 0x00; data[8] = 0x00; data[9] = 0x00; return_rsp_data(lan, msg, session, data, 10); } else { /* Send it on. */ handle_smi_msg(lan, session, msg); } } static void handle_set_user_access(lan_data_t *lan, session_t *session, msg_t *msg) { uint8_t user; uint8_t priv; uint8_t newv; int changed = 0; if (msg->len < 3) { lan->log(INVALID_MSG, msg, "Set user access failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } if ((msg->data[0] & 0xf) != MAIN_CHANNEL) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } user = msg->data[1] & 0x3f; if (user == 0) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } priv = msg->data[2] & 0xf; /* Allow privilege level F as the "no access" privilege */ if (((priv == 0) || (priv > 4)) && (priv != 0xf)) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } if (msg->data[0] & 0x80) { newv = (msg->data[0] >> 4) & 1; if (newv != lan->users[user].valid) { lan->users[user].valid = newv; changed = 1; } newv = (msg->data[0] >> 5) & 1; if (newv != lan->users[user].link_auth) { lan->users[user].link_auth = newv; changed = 1; } newv = (msg->data[0] >> 6) & 1; if (newv != lan->users[user].cb_only) { lan->users[user].cb_only = newv; changed = 1; } } if (priv != lan->users[user].privilege) { lan->users[user].privilege = priv; changed = 1; } if (msg->len >= 4) { /* Got the session limit byte. */ newv = msg->data[3] & 0xf; if (newv != lan->users[user].max_sessions) { lan->users[user].max_sessions = newv; changed = 1; } } if (changed) lan->write_config(lan); return_err(lan, msg, session, 0); } static void handle_get_user_access(lan_data_t *lan, session_t *session, msg_t *msg) { uint8_t data[5]; int i; uint8_t user; if (msg->len < 2) { lan->log(INVALID_MSG, msg, "Get user access failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } if ((msg->data[0] & 0xf) != MAIN_CHANNEL) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } user = msg->data[1] & 0x3f; if (user == 0) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } data[0] = 0; data[1] = MAX_USERS; /* Number of enabled users. */ data[2] = 0; for (i=1; i<=MAX_USERS; i++) { if (lan->users[i].valid) data[2]++; } /* Only fixed user name is user 1. */ data[3] = lan->users[1].valid; data[4] = ((lan->users[user].valid << 4) | (lan->users[user].link_auth << 5) | (lan->users[user].cb_only << 6) | lan->users[user].privilege); return_rsp_data(lan, msg, session, data, 5); } static void handle_set_user_name(lan_data_t *lan, session_t *session, msg_t *msg) { uint8_t user; if (msg->len < 17) { lan->log(INVALID_MSG, msg, "Set user name failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } user = msg->data[0] & 0x3f; if (user <= 1) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } memcpy(lan->users[user].username, msg->data+1, 16); cleanup_ascii_16(lan->users[user].username); return_err(lan, msg, session, 0); } static void handle_get_user_name(lan_data_t *lan, session_t *session, msg_t *msg) { uint8_t user; uint8_t data[17]; if (msg->len < 1) { lan->log(INVALID_MSG, msg, "Get user name failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } user = msg->data[0] & 0x3f; if (user <= 1) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } data[0] = 0; memcpy(data+1, lan->users[user].username, 16); return_rsp_data(lan, msg, session, data, 17); } static void handle_set_user_password(lan_data_t *lan, session_t *session, msg_t *msg) { uint8_t user; uint8_t op; if (msg->len < 2) { lan->log(INVALID_MSG, msg, "Set user password failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } user = msg->data[0] & 0x3f; if (user == 0) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } op = msg->data[1] & 0x3; if (op == 0) { lan->users[user].valid = 0; } else if (op == 1) { lan->users[user].valid = 1; } else { if (msg->len < 18) { lan->log(INVALID_MSG, msg, "Set user password failure: message too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } if (op == 2) { memcpy(lan->users[user].pw, msg->data+2, 16); } else { /* Nothing to do for test password, we accept anything. */ } } return_err(lan, msg, session, 0); } static void handle_ipmi_set_lan_config_parms(lan_data_t *lan, session_t *session, msg_t *msg) { unsigned char err = 0; int idx; if (msg->len < 3) { lan->log(INVALID_MSG, msg, "Set lan config parm too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } if ((msg->data[0] & 0xf) != MAIN_CHANNEL) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } switch (msg->data[1]) { case 0: switch (msg->data[2] & 0x3) { case 0: if (lan->lanparm.set_in_progress) { /* rollback */ memcpy(&lan->lanparm, &lan->lanparm_rollback, sizeof(lan->lanparm)); } /* No affect otherwise */ break; case 1: if (lan->lanparm.set_in_progress) err = 0x81; /* Another user is writing. */ else { /* Save rollback data */ memcpy(&lan->lanparm_rollback, &lan->lanparm, sizeof(lan->lanparm)); lan->lanparm.set_in_progress = 1; } break; case 2: if (lan->lanparm.commit) lan->lanparm.commit(lan); memset(&lan->lanparm.changed, 0, sizeof(lan->lanparm.changed)); lan->lanparm.set_in_progress = 0; break; case 3: err = IPMI_INVALID_DATA_FIELD_CC; } break; case 1: case 17: case 22: case 23: err = 0x82; /* Read-only data */ break; case 2: if (msg->len < 7) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.auth_type_enables, msg->data+2, 5); lan->lanparm.changed.auth_type_enables = 1; } break; case 3: if (msg->len < 6) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.ip_addr, msg->data+2, 4); lan->lanparm.changed.ip_addr = 1; } break; case 4: lan->lanparm.ip_addr_src = msg->data[2]; lan->lanparm.changed.ip_addr_src = 1; break; case 5: if (msg->len < 8) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.mac_addr, msg->data+2, 6); lan->lanparm.changed.mac_addr = 1; } break; case 6: if (msg->len < 6) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.subnet_mask, msg->data+2, 4); lan->lanparm.changed.subnet_mask = 1; } break; case 7: if (msg->len < 5) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.ipv4_hdr_parms, msg->data+2, 3); lan->lanparm.changed.ipv4_hdr_parms = 1; } break; case 8: if (msg->len < 4) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.primary_rmcp_port, msg->data+2, 2); lan->lanparm.changed.primary_rmcp_port = 1; } break; case 9: if (msg->len < 4) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.secondary_rmcp_port, msg->data+2, 2); lan->lanparm.changed.secondary_rmcp_port = 1; } break; case 10: lan->lanparm.bmc_gen_arp_ctl = msg->data[2]; lan->lanparm.changed.bmc_gen_arp_ctl = 1; break; case 11: lan->lanparm.garp_interval = msg->data[2]; lan->lanparm.changed.garp_interval = 1; break; case 12: if (msg->len < 6) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.default_gw_ip_addr, msg->data+2, 4); lan->lanparm.changed.default_gw_ip_addr = 1; } break; case 13: if (msg->len < 8) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.default_gw_mac_addr, msg->data+2, 6); lan->lanparm.changed.default_gw_mac_addr = 1; } break; case 14: if (msg->len < 6) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.backup_gw_ip_addr, msg->data+2, 4); lan->lanparm.changed.backup_gw_ip_addr = 1; } break; case 15: if (msg->len < 8) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.backup_gw_mac_addr, msg->data+2, 6); lan->lanparm.changed.backup_gw_mac_addr = 1; } break; case 16: if (msg->len < 20) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.community_string, msg->data+2, 18); lan->lanparm.changed.community_string = 1; } break; case 18: idx = msg->data[2] & 0xf; if (msg->len < 6) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if (idx > lan->lanparm.num_destinations) err = IPMI_INVALID_DATA_FIELD_CC; else { memcpy(lan->lanparm.dest[idx].type, msg->data+2, 4); lan->lanparm.changed.dest_type[idx] = 1; } break; case 19: idx = msg->data[2] & 0xf; if (msg->len < 15) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if (idx > lan->lanparm.num_destinations) err = IPMI_INVALID_DATA_FIELD_CC; else { memcpy(lan->lanparm.dest[idx].addr, msg->data+2, 13); lan->lanparm.changed.dest_addr[idx] = 1; } break; case 20: if (msg->len < 4) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.vlan_id, msg->data+2, 2); lan->lanparm.changed.vlan_id = 1; } break; case 21: lan->lanparm.vlan_priority = msg->data[2]; lan->lanparm.changed.vlan_priority = 1; break; case 24: if (msg->len < 11) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->lanparm.max_priv_for_cipher_suite, msg->data+2, 9); lan->lanparm.changed.max_priv_for_cipher_suite = 1; } break; case 25: idx = msg->data[2] & 0xf; if (msg->len < 6) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if (idx > lan->lanparm.num_destinations) err = IPMI_INVALID_DATA_FIELD_CC; else { memcpy(lan->lanparm.dest[idx].vlan, msg->data+2, 4); lan->lanparm.changed.dest_vlan[idx] = 1; } break; default: err = 0x80; /* Parm not supported */ } return_err(lan, msg, session, err); } static void return_lan_config_data(lan_data_t *lan, unsigned int rev, int rev_only, msg_t *msg, session_t *session, unsigned char *data, unsigned int data_len) { rsp_msg_t rsp; unsigned char d[36]; unsigned int d_len; d[0] = 0; d[1] = rev; if (rev_only) { d_len = 2; } else { memcpy(d+2, data, data_len); d_len = data_len + 2; } rsp.netfn = IPMI_TRANSPORT_NETFN | 1; rsp.cmd = IPMI_GET_LAN_CONFIG_PARMS_CMD; rsp.data = d; rsp.data_len = d_len; return_rsp(lan, msg, session, &rsp); } static void handle_ipmi_get_lan_config_parms(lan_data_t *lan, session_t *session, msg_t *msg) { int idx; unsigned char databyte = 0; unsigned char *data = NULL; unsigned int length = 0; if (msg->len < 4) { lan->log(INVALID_MSG, msg, "Get lan config parm too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } if ((msg->data[0] & 0xf) != MAIN_CHANNEL) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } switch (msg->data[1]) { case 0: databyte = lan->lanparm.set_in_progress; break; case 1: databyte = lan->lanparm.auth_type_support; break; case 17: databyte = lan->lanparm.num_destinations; break; case 2: data = lan->lanparm.auth_type_enables; length = 5; break; case 3: data = lan->lanparm.ip_addr; length = 4; break; case 4: databyte = lan->lanparm.ip_addr_src; break; case 5: data = lan->lanparm.mac_addr; length = 6; break; case 6: data = lan->lanparm.subnet_mask; length = 4; break; case 7: data = lan->lanparm.ipv4_hdr_parms; length = 3; break; case 8: data = lan->lanparm.primary_rmcp_port; length = 2; break; case 9: data = lan->lanparm.secondary_rmcp_port; length = 2; break; case 10: databyte = lan->lanparm.bmc_gen_arp_ctl; break; case 11: databyte = lan->lanparm.garp_interval; break; case 12: data = lan->lanparm.default_gw_ip_addr; length = 4; break; case 13: data = lan->lanparm.default_gw_mac_addr; length = 6; break; case 14: data = lan->lanparm.backup_gw_ip_addr; length = 4; break; case 15: data = lan->lanparm.backup_gw_mac_addr; length = 6; break; case 16: data = lan->lanparm.community_string; length = 18; break; case 18: idx = msg->data[2] & 0xf; if (idx > lan->lanparm.num_destinations) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } else { data = lan->lanparm.dest[idx].type; length = 4; } break; case 19: idx = msg->data[2] & 0xf; if (idx > lan->lanparm.num_destinations) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } else { data = lan->lanparm.dest[idx].addr; length = 13; } break; case 20: data = lan->lanparm.vlan_id; length = 2; break; case 21: databyte = lan->lanparm.vlan_priority; break; case 22: databyte = lan->lanparm.num_cipher_suites; break; case 23: data = lan->lanparm.cipher_suite_entry; length = 17; break; case 24: data = lan->lanparm.max_priv_for_cipher_suite; length = 9; break; case 25: idx = msg->data[2] & 0xf; if (idx > lan->lanparm.num_destinations) { return_err(lan, msg, session, IPMI_INVALID_DATA_FIELD_CC); return; } else { data = lan->lanparm.dest[idx].vlan; length = 4; } break; default: return_err(lan, msg, session, 0x80); /* Parm not supported */ return; } if (data) { return_lan_config_data(lan, 0x11, msg->data[0] & 0x80, msg, session, data, length); } else { return_lan_config_data(lan, 0x11, msg->data[0] & 0x80, msg, session, &databyte, 1); } } static void handle_ipmi_get_pef_capabilities(lan_data_t *lan, session_t *session, msg_t *msg) { unsigned char data[4]; data[0] = 0; data[1] = 0x51; /* version */ data[2] = 0x3f; /* support everything but OEM */ data[3] = MAX_EVENT_FILTERS; return return_rsp_data(lan, msg, session, data, 4); } static void handle_ipmi_set_pef_config_parms(lan_data_t *lan, session_t *session, msg_t *msg) { unsigned char err = 0; int set, block; if (msg->len < 2) { lan->log(INVALID_MSG, msg, "Set pef config parm too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } switch (msg->data[0] & 0x7f) { case 0: switch (msg->data[1] & 0x3) { case 0: if (lan->pef.set_in_progress) { /* rollback */ memcpy(&lan->pef, &lan->pef_rollback, sizeof(lan->pef)); } /* No affect otherwise */ break; case 1: if (lan->pef.set_in_progress) err = 0x81; /* Another user is writing. */ else { /* Save rollback data */ memcpy(&lan->pef_rollback, &lan->pef, sizeof(lan->pef)); lan->pef.set_in_progress = 1; } break; case 2: if (lan->pef.commit) lan->pef.commit(lan); memset(&lan->pef.changed, 0, sizeof(lan->pef.changed)); lan->pef.set_in_progress = 0; break; case 3: err = IPMI_INVALID_DATA_FIELD_CC; } break; case 5: case 8: case 11: err = 0x82; /* Read-only data */ break; case 1: lan->pef.pef_control = msg->data[1]; lan->pef.changed.pef_control = 1; break; case 2: lan->pef.pef_action_global_control = msg->data[1]; lan->pef.changed.pef_action_global_control = 1; break; case 3: lan->pef.pef_startup_delay = msg->data[1]; lan->pef.changed.pef_startup_delay = 1; break; case 4: lan->pef.pef_alert_startup_delay = msg->data[1]; lan->pef.changed.pef_alert_startup_delay = 1; break; case 6: set = msg->data[1] & 0x7f; if (msg->len < 22) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if ((set <= 0) || (set >= lan->pef.num_event_filters)) err = IPMI_INVALID_DATA_FIELD_CC; else { set = msg->data[1] & 0x7f; memcpy(lan->pef.event_filter_table[set], msg->data+1, 21); lan->pef.changed.event_filter_table[set] = 1; } break; case 7: set = msg->data[1] & 0x7f; if (msg->len < 3) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if ((set <= 0) || (set >= lan->pef.num_event_filters)) err = IPMI_INVALID_DATA_FIELD_CC; else { set = msg->data[1] & 0x7f; memcpy(lan->pef.event_filter_data1[set], msg->data+1, 2); lan->pef.changed.event_filter_data1[set] = 1; } break; case 9: set = msg->data[1] & 0x7f; if (msg->len < 5) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if ((set <= 0) || (set >= lan->pef.num_alert_policies)) err = IPMI_INVALID_DATA_FIELD_CC; else { set = msg->data[1] & 0x7f; memcpy(lan->pef.alert_policy_table[set], msg->data+1, 4); lan->pef.changed.alert_policy_table[set] = 1; } break; case 10: if (msg->len < 18) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else { memcpy(lan->pef.system_guid, msg->data+1, 17); lan->pef.changed.system_guid = 1; } break; case 12: set = msg->data[1] & 0x7f; if (msg->len < 4) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if (set >= lan->pef.num_alert_strings) err = IPMI_INVALID_DATA_FIELD_CC; else { set = msg->data[1] & 0x7f; memcpy(lan->pef.alert_string_keys[set], msg->data+1, 3); lan->pef.changed.alert_string_keys[set] = 1; } break; case 13: set = msg->data[1] & 0x7f; if (msg->len < 4) err = IPMI_REQUEST_DATA_LENGTH_INVALID_CC; else if (set >= lan->pef.num_alert_strings) err = IPMI_INVALID_DATA_FIELD_CC; else if (msg->data[2] == 0) err = IPMI_INVALID_DATA_FIELD_CC; else { int dlen = msg->len - 3; set = msg->data[1] & 0x7f; block = msg->data[2] - 1; if (((block*16) + dlen) > MAX_ALERT_STRING_LEN) { err = IPMI_PARAMETER_OUT_OF_RANGE_CC; break; } memcpy(lan->pef.alert_strings[set]+(block*16), msg->data+3, dlen); lan->pef.changed.alert_strings[set] = 1; } break; default: err = 0x80; /* Parm not supported */ } return_err(lan, msg, session, err); } static void return_pef_config_data(lan_data_t *lan, unsigned int rev, int rev_only, msg_t *msg, session_t *session, unsigned char *data, unsigned int data_len) { rsp_msg_t rsp; unsigned char d[36]; unsigned int d_len; d[0] = 0; d[1] = rev; if (rev_only) { d_len = 2; } else { memcpy(d+2, data, data_len); d_len = data_len + 2; } rsp.netfn = IPMI_SENSOR_EVENT_NETFN | 1; rsp.cmd = IPMI_GET_PEF_CONFIG_PARMS_CMD; rsp.data = d; rsp.data_len = d_len; return_rsp(lan, msg, session, &rsp); } static void handle_ipmi_get_pef_config_parms(lan_data_t *lan, session_t *session, msg_t *msg) { int set, block; unsigned char databyte = 0; unsigned char *data = NULL; unsigned int length = 0; unsigned char err = 0; unsigned char tmpdata[18]; if (msg->len < 3) { lan->log(INVALID_MSG, msg, "Get pef config parm too short"); return_err(lan, msg, session, IPMI_REQUEST_DATA_LENGTH_INVALID_CC); return; } switch (msg->data[0] & 0x7f) { case 0: databyte = lan->pef.set_in_progress; break; case 5: databyte = lan->pef.num_event_filters - 1; break; case 8: databyte = lan->pef.num_alert_policies - 1; break; case 11: databyte = lan->pef.num_alert_strings - 1; break; case 1: databyte = lan->pef.pef_control; break; case 2: databyte = lan->pef.pef_action_global_control; break; case 3: databyte = lan->pef.pef_startup_delay; break; case 4: databyte = lan->pef.pef_alert_startup_delay; break; case 6: set = msg->data[1] & 0x7f; if ((set <= 0) || (set >= lan->pef.num_event_filters)) err = IPMI_INVALID_DATA_FIELD_CC; else { data = lan->pef.event_filter_table[set]; length = 21; } break; case 7: set = msg->data[1] & 0x7f; if ((set <= 0) || (set >= lan->pef.num_event_filters)) err = IPMI_INVALID_DATA_FIELD_CC; else { data = lan->pef.event_filter_data1[set]; length = 2; } break; case 9: set = msg->data[1] & 0x7f; if ((set <= 0) || (set >= lan->pef.num_alert_policies)) err = IPMI_INVALID_DATA_FIELD_CC; else { data = lan->pef.alert_policy_table[set]; length = 4; } break; case 10: data = lan->pef.system_guid; length = 17; break; case 12: set = msg->data[1] & 0x7f; if (set >= lan->pef.num_alert_strings) err = IPMI_INVALID_DATA_FIELD_CC; else { data = lan->pef.alert_string_keys[set]; length = 3; } break; case 13: set = msg->data[1] & 0x7f; if (set >= lan->pef.num_alert_strings) err = IPMI_INVALID_DATA_FIELD_CC; else if (msg->data[2] == 0) err = IPMI_INVALID_DATA_FIELD_CC; else { block = msg->data[2] - 1; if ((block*16) > MAX_ALERT_STRING_LEN) { err = IPMI_PARAMETER_OUT_OF_RANGE_CC; break; } tmpdata[0] = set; tmpdata[1] = block + 1; memcpy(tmpdata+2, lan->pef.alert_strings[set]+(block*16), 16); data = tmpdata; length = 18; } break; default: err = 0x80; /* Parm not supported */ } if (err) { return_err(lan, msg, session, err); } else if (data) { return_pef_config_data(lan, 0x11, msg->data[0] & 0x80, msg, session, data, length); } else { return_pef_config_data(lan, 0x11, msg->data[0] & 0x80, msg, session, &databyte, 1); } } static void handle_normal_session(lan_data_t *lan, msg_t *msg) { session_t *session = sid_to_session(lan, msg->sid); int rv; if (session == NULL) { lan->log(INVALID_MSG, msg, "Normal session message failure: Invalid SID"); return; } session->time_left = lan->default_session_timeout; if (lan->oem_handle_msg && lan->oem_handle_msg(lan, msg, session)) /* OEM code handled the message. */ return; rv = IPMI_PRIV_INVALID; if (lan->oem_check_permitted) rv = lan->oem_check_permitted(session->priv, msg->netfn, msg->cmd); if (rv == IPMI_PRIV_INVALID) rv = ipmi_cmd_permitted(session->priv, msg->netfn, msg->cmd); switch (rv) { case IPMI_PRIV_PERMITTED: break; case IPMI_PRIV_SEND: /* The spec says that operator privilege is require to send on other channels, but that doesn't make any sense. Instead, we look at the message to tell if the operation is permitted. */ rv = ipmi_cmd_permitted(session->priv, msg->data[2]>>2, /* netfn */ msg->data[6]); /* cmd */ if (rv == IPMI_PRIV_PERMITTED) break; /* fallthrough */ case IPMI_PRIV_DENIED: case IPMI_PRIV_BOOT: /* FIXME - this can sometimes be permitted. */ lan->log(INVALID_MSG, msg, "Normal session message failure: no privilege"); return_err(lan, msg, session, IPMI_INSUFFICIENT_PRIVILEGE_CC); return; case IPMI_PRIV_INVALID: default: lan->log(INVALID_MSG, msg, "Normal session message failure: Internal error 1"); return_err(lan, msg, session, IPMI_UNKNOWN_ERR_CC); return; } if (msg->netfn == IPMI_APP_NETFN) { switch (msg->cmd) { case IPMI_GET_SYSTEM_GUID_CMD: handle_get_system_guid(lan, session, msg); break; case IPMI_GET_CHANNEL_AUTH_CAPABILITIES_CMD: case IPMI_GET_SESSION_CHALLENGE_CMD: return_err(lan, msg, session, IPMI_NOT_SUPPORTED_IN_PRESENT_STATE_CC); break; case IPMI_ACTIVATE_SESSION_CMD: handle_activate_session_cmd(lan, session, msg); break; case IPMI_SET_SESSION_PRIVILEGE_CMD: handle_set_session_privilege(lan, session, msg); break; case IPMI_CLOSE_SESSION_CMD: handle_close_session(lan, session, msg); break; case IPMI_GET_SESSION_INFO_CMD: handle_get_session_info(lan, session, msg); break; case IPMI_GET_AUTHCODE_CMD: handle_get_authcode(lan, session, msg); break; case IPMI_SET_CHANNEL_ACCESS_CMD: handle_set_channel_access(lan, session, msg); break; case IPMI_GET_CHANNEL_ACCESS_CMD: handle_get_channel_access(lan, session, msg); break; case IPMI_GET_CHANNEL_INFO_CMD: handle_get_channel_info(lan, session, msg); break; case IPMI_SET_USER_ACCESS_CMD: handle_set_user_access(lan, session, msg); break; case IPMI_GET_USER_ACCESS_CMD: handle_get_user_access(lan, session, msg); break; case IPMI_SET_USER_NAME_CMD: handle_set_user_name(lan, session, msg); break; case IPMI_GET_USER_NAME_CMD: handle_get_user_name(lan, session, msg); break; case IPMI_SET_USER_PASSWORD_CMD: handle_set_user_password(lan, session, msg); break; default: handle_smi_msg(lan, session, msg); } } else if (msg->netfn == IPMI_TRANSPORT_NETFN) { switch (msg->cmd) { case IPMI_SET_LAN_CONFIG_PARMS_CMD: handle_ipmi_set_lan_config_parms(lan, session, msg); break; case IPMI_GET_LAN_CONFIG_PARMS_CMD: handle_ipmi_get_lan_config_parms(lan, session, msg); break; default: lan->log(INVALID_MSG, msg, "Normal session message failure: Invalid cmd: 0x%x", msg->cmd); return_err(lan, msg, session, IPMI_INVALID_CMD_CC); break; } } else if (msg->netfn == IPMI_SENSOR_EVENT_NETFN) { switch (msg->cmd) { case IPMI_GET_PEF_CAPABILITIES_CMD: handle_ipmi_get_pef_capabilities(lan, session, msg); break; case IPMI_SET_PEF_CONFIG_PARMS_CMD: handle_ipmi_set_pef_config_parms(lan, session, msg); break; case IPMI_GET_PEF_CONFIG_PARMS_CMD: handle_ipmi_get_pef_config_parms(lan, session, msg); break; default: goto normal_msg; } } else { normal_msg: handle_smi_msg(lan, session, msg); } } void handle_ipmi_payload(lan_data_t *lan, msg_t *msg) { if (msg->len < 7) { lan->log(LAN_ERR, msg, "LAN msg failure: Length field too short"); return; } if (ipmb_checksum(msg->data, 3, 0) != 0) { lan->log(LAN_ERR, msg, "LAN msg failure: Checksum 1 failed"); return; } if (ipmb_checksum(msg->data+3, msg->len-3, 0) != 0) { lan->log(LAN_ERR, msg, "LAN msg failure: Checksum 2 failed"); return; } msg->len--; /* Remove the final checksum */ msg->rs_addr = msg->data[0]; msg->netfn = msg->data[1] >> 2; msg->rs_lun = msg->data[1] & 0x3; msg->rq_addr = msg->data[3]; msg->rq_seq = msg->data[4] >> 2; msg->rq_lun = msg->data[4] & 0x3; msg->cmd = msg->data[5]; msg->data += 6; msg->len -= 6; if (lan->debug) { lan->log(DEBUG, msg, "msg: netfn = 0x%2.2x cmd=%2.2x", msg->netfn, msg->cmd); } if (msg->sid == 0) { handle_no_session(lan, msg); } else if (msg->sid & 1) { /* We use odd SIDs for temporary ones. */ /* Temp sessions have to be set up before the auth is done, so we can't do that here. */ handle_temp_session(lan, msg); } else { handle_normal_session(lan, msg); } } #ifdef HAVE_OPENSSL static int rakp_hmac_sha1_init(lan_data_t *lan, session_t *session) { session->auth_data.akey = EVP_sha1(); session->auth_data.akey_len = 20; session->auth_data.integ_len = 12; return 0; } static int rakp_hmac_md5_init(lan_data_t *lan, session_t *session) { session->auth_data.akey = EVP_md5(); session->auth_data.akey_len = 16; session->auth_data.integ_len = 16; return 0; } static int rakp_hmac_set2(lan_data_t *lan, session_t *session, unsigned char *data, unsigned int *data_len, unsigned int max_len) { unsigned char idata[74]; unsigned int ilen; const unsigned char *p; user_t *user; auth_data_t *a = &session->auth_data; if (((*data_len) + a->akey_len) > max_len) return E2BIG; ipmi_set_uint32(idata+0, session->rem_sid); ipmi_set_uint32(idata+4, session->sid); memcpy(idata+8, a->rem_rand, 16); memcpy(idata+24, a->rand, 16); memcpy(idata+40, lan->guid, 16); idata[56] = a->role; idata[57] = a->username_len; memcpy(idata+58, a->username, idata[57]); user = &(lan->users[session->userid]); HMAC(a->akey, user->pw, a->akey_len, idata, 58+idata[57], data + *data_len, &ilen); *data_len += a->akey_len; /* Now generate the SIK */ memcpy(idata+0, a->rem_rand, 16); memcpy(idata+16, a->rand, 16); idata[32] = a->role; idata[33] = a->username_len; memcpy(idata+34, a->username, idata[33]); if (lan->bmc_key) p = lan->bmc_key; else p = user->pw; HMAC(a->akey, p, a->akey_len, idata, 34+idata[33], a->sik, &ilen); /* Now generate k1 and k2. */ memset(idata, 1, a->akey_len); HMAC(a->akey, a->sik, a->akey_len, idata, a->akey_len, a->k1, &ilen); memset(idata, 2, a->akey_len); HMAC(a->akey, a->sik, a->akey_len, idata, a->akey_len, a->k2, &ilen); return 0; } static int rakp_hmac_check3(lan_data_t *lan, session_t *session, unsigned char *data, unsigned int *data_len) { unsigned char idata[38]; unsigned int ilen; unsigned char integ[20]; user_t *user = &(lan->users[session->userid]); auth_data_t *a = &session->auth_data; if (((*data_len) - a->akey_len) < 8) return E2BIG; memcpy(idata+0, a->rand, 16); ipmi_set_uint32(idata+16, session->rem_sid); idata[20] = a->role; idata[21] = a->username_len; memcpy(idata+22, a->username, idata[21]); HMAC(a->akey, user->pw, a->akey_len, idata, 22+idata[21], integ, &ilen); if (memcmp(integ, data+(*data_len)-a->akey_len, a->akey_len) != 0) return EINVAL; *data_len -= a->akey_len; return 0; } static int rakp_hmac_set4(lan_data_t *lan, session_t *session, unsigned char *data, unsigned int *data_len, unsigned int max_len) { unsigned char idata[36]; unsigned int ilen; auth_data_t *a = &session->auth_data; unsigned char integ[20]; if (((*data_len) + a->akey_len) > max_len) return E2BIG; memcpy(idata+0, a->rem_rand, 16); ipmi_set_uint32(idata+16, session->sid); memcpy(idata+20, lan->guid, 16); HMAC(a->akey, a->sik, a->akey_len, idata, 36, integ, &ilen); memcpy(data+*data_len, integ, a->integ_len); *data_len += a->integ_len; return 0; } static auth_handlers_t rakp_hmac_sha1 = { .init = rakp_hmac_sha1_init, .set2 = rakp_hmac_set2, .check3 = rakp_hmac_check3, .set4 = rakp_hmac_set4 }; static auth_handlers_t rakp_hmac_md5 = { .init = rakp_hmac_md5_init, .set2 = rakp_hmac_set2, .check3 = rakp_hmac_check3, .set4 = rakp_hmac_set4 }; #define RAKP_INIT , &rakp_hmac_sha1, &rakp_hmac_md5 static int hmac_sha1_init(lan_data_t *lan, session_t *session) { session->auth_data.ikey2 = EVP_sha1(); session->auth_data.ikey = session->auth_data.k1; session->auth_data.ikey_len = 20; session->auth_data.integ_len = 12; return 0; } static int hmac_md5_init(lan_data_t *lan, session_t *session) { user_t *user = &(lan->users[session->userid]); session->auth_data.ikey2 = EVP_md5(); session->auth_data.ikey = user->pw; session->auth_data.ikey_len = 16; session->auth_data.integ_len = 16; return 0; } static void hmac_cleanup(lan_data_t *lan, session_t *session) { } static int hmac_add(lan_data_t *lan, session_t *session, unsigned char *pos, unsigned int *data_len, unsigned int data_size) { auth_data_t *a = &session->auth_data; unsigned int ilen; unsigned char integ[20]; if (((*data_len) + a->ikey_len) > data_size) return E2BIG; HMAC(a->ikey2, a->ikey, a->ikey_len, pos+4, (*data_len)-4, integ, &ilen); memcpy(pos+(*data_len), integ, a->integ_len); *data_len += a->integ_len; return 0; } static int hmac_check(lan_data_t *lan, session_t *session, msg_t *msg) { unsigned char integ[20]; auth_data_t *a = &session->auth_data; unsigned int ilen; if ((msg->len-5) < a->integ_len) return E2BIG; HMAC(a->ikey2, a->ikey, a->ikey_len, msg->data, msg->len-a->integ_len, integ, &ilen); if (memcmp(msg->data+msg->len-a->integ_len, integ, a->integ_len) != 0) return EINVAL; return 0; } static void * auth_alloc(void *info, int size) { return malloc(size); } static void auth_free(void *info, void *data) { free(data); } static int md5_init(lan_data_t *lan, session_t *session) { user_t *user = &(lan->users[session->userid]); int rv; ipmi_authdata_t idata; rv = ipmi_md5_authcode_initl(user->pw, 20, &idata, NULL, auth_alloc, auth_free); if (rv) return rv; session->auth_data.idata = idata; session->auth_data.ikey_len = 16; return 0; } static void md5_cleanup(lan_data_t *lan, session_t *session) { ipmi_md5_authcode_cleanup(session->auth_data.idata); session->auth_data.idata = NULL; } static int md5_add(lan_data_t *lan, session_t *session, unsigned char *pos, unsigned int *data_len, unsigned int data_size) { auth_data_t *a = &session->auth_data; ipmi_auth_sg_t data[2]; int rv; if (((*data_len) + a->ikey_len) > data_size) return E2BIG; data[0].data = pos+4; data[0].len = (*data_len)-4; data[1].data = NULL; rv = ipmi_md5_authcode_gen(a->idata, data, pos+(*data_len)); if (rv) return rv; *data_len += a->ikey_len; return 0; } static int md5_check(lan_data_t *lan, session_t *session, msg_t *msg) { auth_data_t *a = &session->auth_data; ipmi_auth_sg_t data[2]; int rv; if ((msg->len-5) < a->ikey_len) return E2BIG; data[0].data = msg->data; data[0].len = msg->len - a->ikey_len; data[1].data = NULL; rv = ipmi_md5_authcode_check(a->idata, data, msg->data + msg->len - a->ikey_len); return rv; } static integ_handlers_t hmac_sha1_integ = { hmac_sha1_init, hmac_cleanup, hmac_add, hmac_check }; static integ_handlers_t hmac_md5_integ = { hmac_md5_init, hmac_cleanup, hmac_add, hmac_check }; static integ_handlers_t md5_integ = { md5_init, md5_cleanup, md5_add, md5_check }; #define HMAC_INIT , &hmac_sha1_integ, &hmac_md5_integ #define MD5_INIT , &md5_integ static int aes_cbc_init(lan_data_t *lan, session_t *session) { session->auth_data.ckey = session->auth_data.k2; session->auth_data.ckey_len = 16; return 0; } static void aes_cbc_cleanup(lan_data_t *lan, session_t *session) { } static int aes_cbc_encrypt(lan_data_t *lan, session_t *session, unsigned char **pos, unsigned int *hdr_left, unsigned int *data_len, unsigned int *data_size) { auth_data_t *a = &session->auth_data; unsigned int l = *data_len; unsigned char *d; unsigned char *iv; unsigned int i; EVP_CIPHER_CTX ctx; int rv; int outlen; int tmplen; unsigned char *padpos; unsigned char padval; unsigned int padlen; if (*hdr_left < 16) return E2BIG; /* Calculate the number of padding bytes -> e. Note that the pad length byte is included, thus the +1. We don't add the pad, AES does, but we need to know what it is. */ /* Calculate the number of padding bytes -> e. Note that the pad length byte is included, thus the +1. We then do the padding. */ padlen = 15 - (l % 16); l += padlen + 1; if (l > *data_size) return E2BIG; /* We store the unencrypted data here, then crypt into the real data. */ d = malloc(l); if (!d) return ENOMEM; memcpy(d, *pos, *data_len); /* Now add the padding. */ padpos = d + *data_len; padval = 1; for (i=0; igen_rand(lan, iv, 16); if (rv) { free(d); return rv; } *hdr_left -= 16; *data_size += 16; /* Ok, we're set to do the crypt operation. */ EVP_CIPHER_CTX_init(&ctx); EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, a->ckey, iv); EVP_CIPHER_CTX_set_padding(&ctx, 0); if (!EVP_EncryptUpdate(&ctx, *pos, &outlen, d, l)) { rv = ENOMEM; goto out_cleanup; } if (!EVP_EncryptFinal_ex(&ctx, (*pos) + outlen, &tmplen)) { rv = ENOMEM; /* right? */ goto out_cleanup; } outlen += tmplen; *pos = iv; *data_len = outlen + 16; out_cleanup: EVP_CIPHER_CTX_cleanup(&ctx); free(d); return rv; } static int aes_cbc_decrypt(lan_data_t *lan, session_t *session, msg_t *msg) { auth_data_t *a = &session->auth_data; unsigned int l = msg->len; unsigned char *d; EVP_CIPHER_CTX ctx; int outlen; unsigned char *pad; int padlen; int rv = 0; if (l < 32) /* Not possible with this algorithm. */ return EINVAL; l -= 16; /* We store the encrypted data here, then decrypt into the real data. */ d = malloc(l); if (!d) return ENOMEM; memcpy(d, msg->data+16, l); /* Ok, we're set to do the decrypt operation. */ EVP_CIPHER_CTX_init(&ctx); EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, a->k2, msg->data); EVP_CIPHER_CTX_set_padding(&ctx, 0); if (!EVP_DecryptUpdate(&ctx, msg->data+16, &outlen, d, l)) { rv = EINVAL; goto out_cleanup; } if (outlen < 16) { rv = EINVAL; goto out_cleanup; } /* Now remove the padding */ pad = msg->data + 16 + outlen - 1; padlen = *pad; if (padlen >= 16) { rv = EINVAL; goto out_cleanup; } outlen--; pad--; while (padlen) { if (*pad != padlen) { rv = EINVAL; goto out_cleanup; } outlen--; pad--; padlen--; } msg->data += 16; /* Remove the init vector */ msg->len = outlen; out_cleanup: EVP_CIPHER_CTX_cleanup(&ctx); free(d); return rv; } static conf_handlers_t aes_cbc_conf = { aes_cbc_init, aes_cbc_cleanup, aes_cbc_encrypt, aes_cbc_decrypt }; #define AES_CBC_INIT , &aes_cbc_conf unsigned int default_auth = 1; /* RAKP-HMAC-SHA1 */ unsigned int default_integ = 1; /* HMAC-SHA1-96 */ unsigned int default_conf = 1; /* AES-CBC-128 */ #else #define RAKP_INIT , NULL, NULL #define MD5_INIT , NULL #define HMAC_INIT , NULL #define AES_CBC_INIT , NULL unsigned int default_auth = 0; unsigned int default_integ = 0; unsigned int default_conf = 0; #endif integ_handlers_t *integs[64] = { NULL HMAC_INIT MD5_INIT }; conf_handlers_t *confs[64] = { NULL AES_CBC_INIT }; auth_handlers_t *auths[64] = { NULL RAKP_INIT }; struct valid_cypher_suites_s { int auth, integ, conf; } valid_cipher_suites[] = { { 0, 0, 0 }, { 1, 0, 0 }, { 1, 1, 0 }, { 1, 1, 1 }, { 1, 1, 2 }, { 1, 1, 3 }, { 2, 0, 0 }, { 2, 2, 0 }, { 2, 2, 1 }, { 2, 2, 2 }, { 2, 2, 3 }, { 2, 3, 0 }, { 2, 3, 1 }, { 2, 3, 2 }, { 2, 3, 3 }, { -1, -1. -1 } }; void handle_open_session_payload(lan_data_t *lan, msg_t *msg) { unsigned char data[36]; unsigned char priv; unsigned char auth; unsigned char integ; unsigned char conf; session_t *session = NULL; uint32_t rem_sid; unsigned char err; int i; int rv; if (msg->sid != 0) { err = IPMI_RMCPP_INVALID_SESSION_ID; goto out_err; } if (msg->len < 32) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } priv = msg->data[1] & 0xf; if (priv > 4) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } rem_sid = ipmi_get_uint32(msg->data+4); if (rem_sid == 0) { err = IPMI_RMCPP_INVALID_SESSION_ID; goto out_err; } if (msg->data[8] != 0) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } if (msg->data[11] == 0) auth = default_auth; else if (msg->data[11] != 8) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } else auth = msg->data[12] & 0x3f; if (auth && !auths[auth]) { err = IPMI_RMCPP_INVALID_AUTHENTICATION_ALGORITHM; goto out_err; } if (msg->data[16] != 1) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } if (msg->data[19] == 0) integ = default_integ; else if (msg->data[19] != 8) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } else integ = msg->data[20] & 0x3f; if (integ && !integs[integ]) { err = IPMI_RMCPP_INVALID_INTEGRITY_ALGORITHM; goto out_err; } if (msg->data[24] != 2) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } if (msg->data[27] == 0) conf = default_conf; else if (msg->data[27] != 8) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } else conf = msg->data[28] & 0x3f; if (conf && !confs[conf]) { err = IPMI_RMCPP_INVALID_CONFIDENTIALITY_ALGORITHM; goto out_err; } for (i=0; ; i++) { if (valid_cipher_suites[i].auth == -1) break; if ((valid_cipher_suites[i].auth == auth) && (valid_cipher_suites[i].integ == integ) && (valid_cipher_suites[i].conf == conf)) break; } if (valid_cipher_suites[i].auth == -1) { err = IPMI_RMCPP_NO_CIPHER_SUITE_MATCHES; goto out_err; } session = find_free_session(lan); if (!session) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: out of free sessions"); err = IPMI_RMCPP_INSUFFICIENT_RESOURCES_FOR_SESSION; goto out_err; } session->src_addr = lan->alloc(lan, msg->src_len); if (!session->src_addr) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: out of memory"); err = IPMI_RMCPP_INSUFFICIENT_RESOURCES_FOR_SESSION; goto out_err; } memcpy(session->src_addr, msg->src_addr, msg->src_len); session->src_len = msg->src_len; session->active = 1; session->in_startup = 1; session->rmcpplus = 1; session->authtype = IPMI_AUTHTYPE_RMCP_PLUS; rv = lan->gen_rand(lan, session->auth_data.rand, 16); if (rv) { lan->log(NEW_SESSION_FAILED, msg, "Activate session failed: Could not generate random number"); err = IPMI_RMCPP_INSUFFICIENT_RESOURCES_FOR_SESSION; goto out_err; } session->recv_seq = 1; session->xmit_seq = 1; session->unauth_recv_seq = 1; session->unauth_xmit_seq = 1; session->rem_sid = rem_sid; session->auth = auth; session->authh = auths[auth]; if (session->authh) session->authh->init(lan, session); session->integ = integ; session->integh = integs[integ]; session->conf = conf; session->confh = confs[conf]; session->userid = 0; session->time_left = lan->default_session_timeout; session->sid = ((lan->sid_seq << (SESSION_BITS_REQ+1)) | (session->handle << 1)); lan->sid_seq++; lan->log(NEW_SESSION, msg, "Activate session: Session started, max priv %d", priv); memset(data, 0, sizeof(data)); data[0] = msg->data[0]; data[1] = 0; data[2] = priv; ipmi_set_uint32(data+4, session->rem_sid); ipmi_set_uint32(data+8, session->sid); data[12] = 0; data[15] = 8; data[16] = auth; data[20] = 1; data[23] = 8; data[24] = integ; data[28] = 2; data[31] = 8; data[32] = conf; lan->active_sessions++; return_rmcpp_rsp(lan, session, msg, 0x11, data, 36, NULL, 0); return; out_err: data[0] = msg->data[0]; data[1] = err; return_rmcpp_rsp(lan, session, msg, 0x11, data, 2, NULL, 0); if (session) close_session(lan, session); } void handle_rakp1_payload(lan_data_t *lan, msg_t *msg) { unsigned char data[64]; unsigned char priv; session_t *session = NULL; uint32_t sid; unsigned char err = 0; unsigned char username[17]; int name_only_lookup; unsigned char name_len; user_t *user; unsigned int len; if (msg->sid != 0) return; if (msg->len < 28) return; sid = ipmi_get_uint32(msg->data+4); if (sid == 0) return; session = sid_to_session(lan, sid); if (!session) return; memcpy(session->auth_data.rem_rand, msg->data+8, 16); session->auth_data.role = msg->data[24]; priv = msg->data[24] & 0xf; if (priv > 4) { err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } name_only_lookup = (msg->data[24] >> 4) & 1; name_len = msg->data[27]; if (name_len > 16) { lan->log(NEW_SESSION_FAILED, msg, "RAKP msg: name length too long: %d", name_len); err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } if ((unsigned int) (28+name_len) > msg->len) { lan->log(NEW_SESSION_FAILED, msg, "RAKP msg: name length doesn't match: %d", name_len); err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } session->max_priv = priv; session->priv = IPMI_PRIVILEGE_USER; /* Start at user privilege. */ memset(username, 0, sizeof(username)); memcpy(username, msg->data+28, name_len); user = find_user(lan, username, name_only_lookup, priv); if (!user) { lan->log(NEW_SESSION_FAILED, msg, "RAKP msg: invalid user: %s", user); err = IPMI_RMCPP_ILLEGAL_PARAMETER; goto out_err; } session->userid = user->idx; session->auth_data.username_len = name_len; memcpy(session->auth_data.username, username, 16); if (session->integh) { int rv = session->integh->init(lan, session); if (rv) { err = IPMI_RMCPP_INSUFFICIENT_RESOURCES_FOR_SESSION; goto out_err; } } if (session->confh) { int rv = session->confh->init(lan, session); if (rv) { err = IPMI_RMCPP_INSUFFICIENT_RESOURCES_FOR_SESSION; goto out_err; } } out_err: memset(data, 0, sizeof(data)); data[0] = msg->data[0]; data[1] = err; ipmi_set_uint32(data+4, session->rem_sid); memcpy(data+8, session->auth_data.rand, 16); memcpy(data+24, lan->guid, 16); len = 40; if (session->authh) { int rv; rv = session->authh->set2(lan, session, data, &len, sizeof(data)); if (rv) { lan->log(NEW_SESSION_FAILED, msg, "RAKP msg: set2 failed: 0x%x", rv); return; } } return_rmcpp_rsp(lan, session, msg, 0x13, data, len, NULL, 0); if (err) close_session(lan, session); } void handle_rakp3_payload(lan_data_t *lan, msg_t *msg) { unsigned char data[32]; session_t *session = NULL; uint32_t sid; unsigned char err = 0; unsigned int len; if (msg->sid != 0) return; if (msg->len < 8) return; sid = ipmi_get_uint32(msg->data+4); if (sid == 0) return; session = sid_to_session(lan, sid); if (!session) return; if (session->authh) { int rv; rv = session->authh->check3(lan, session, msg->data, &msg->len); if (rv) { lan->log(NEW_SESSION_FAILED, msg, "RAKP msg: check3 failed: 0x%x", rv); err = 0x0f; /* Invalid integrity check */ goto out_err; } } if (msg->data[1]) { /* Other end reported an error, shut down. */ close_session(lan, session); return; } out_err: memset(data, 0, sizeof(data)); data[0] = msg->data[0]; data[1] = err; ipmi_set_uint32(data+4, session->rem_sid); len = 8; if (session->authh) { int rv; rv = session->authh->set4(lan, session, data, &len, sizeof(data)); if (rv) { lan->log(NEW_SESSION_FAILED, msg, "RAKP msg: set4 failed: 0x%x", rv); } } return_rmcpp_rsp(lan, session, msg, 0x15, data, len, NULL, 0); if (err) close_session(lan, session); else session->in_startup = 0; } typedef void (*payload_handler_cb)(lan_data_t *lan, msg_t *msg); payload_handler_cb payload_handlers[64] = { [0] = handle_ipmi_payload, [0x10] = handle_open_session_payload, [0x12] = handle_rakp1_payload, [0x14] = handle_rakp3_payload, }; int decrypt_message(lan_data_t *lan, session_t *session, msg_t *msg) { if (!msg->encrypted) { if (session->conf != 0) { lan->log(INVALID_MSG, msg, "Message failure:" " Unencrypted msg on encrypted session"); return EINVAL; } return 0; } return session->confh->decrypt(lan, session, msg); } int check_message_integrity(lan_data_t *lan, session_t *session, msg_t *msg) { if (!msg->authenticated) { if (session->integ != 0) { lan->log(INVALID_MSG, msg, "Message failure:" " Unauthenticated msg on authenticated session"); return EINVAL; } return 0; } else if (session->integ == 0) { lan->log(INVALID_MSG, msg, "Message failure:" " Authenticated msg on unauthenticated session"); return EINVAL; } return session->integh->check(lan, session, msg); } void ipmi_handle_rmcpp_msg(lan_data_t *lan, msg_t *msg) { unsigned int len; uint32_t *seq; msg_t imsg; imsg.data = msg->data-1; imsg.len = msg->len+1; if (msg->len < 11) { lan->log(LAN_ERR, msg, "LAN msg failure: message too short"); return; } msg->payload = msg->data[0] & 0x3f; msg->encrypted = (msg->data[0] >> 7) & 1; msg->authenticated = (msg->data[0] >> 6) & 1; msg->data++; if (msg->payload == 2) { if (msg->len < 17) { lan->log(LAN_ERR, msg, "LAN msg failure: message too short"); return; } memcpy(msg->iana, msg->data+1, 3); msg->data+= 4; msg->payload_id = ipmi_get_uint16(msg->data); msg->data += 2; } msg->sid = ipmi_get_uint32(msg->data); msg->data += 4; msg->seq = ipmi_get_uint32(msg->data); msg->data += 4; len = ipmi_get_uint16(msg->data); msg->data += 2; if (len > msg->len) { lan->log(LAN_ERR, msg, "LAN msg failure: Length field invalid: %d, %d", len, msg->len); return; /* The length field is not valid. We allow extra bytes, but reject if not enough. */ } msg->authdata_len = msg->len - len; msg->authdata = msg->data + len; msg->len = len; if (msg->sid == 0) { if (msg->authenticated || msg->encrypted) { lan->log(LAN_ERR, msg, "LAN msg failure:" " Got encrypted or authenticated SID 0 msg"); return; } } else { session_t *session = sid_to_session(lan, msg->sid); int rv; int diff; if (session == NULL) { lan->log(INVALID_MSG, msg, "Normal session message failure: Invalid SID"); return; } if (!session->rmcpplus) { lan->log(INVALID_MSG, msg, "Normal session message failure:" " RMCP+ msg on RMCP session"); return; } imsg.encrypted = msg->encrypted; imsg.authenticated = msg->authenticated; rv = check_message_integrity(lan, session, &imsg); if (rv) { lan->log(LAN_ERR, msg, "LAN msg failure:" " Message integrity failed"); return; } rv = decrypt_message(lan, session, msg); if (rv) { lan->log(LAN_ERR, msg, "LAN msg failure:" " Message decryption failed"); return; } /* Check that the session sequence number is valid. We make sure it is within 8 of the last highest received sequence number, per the spec. */ if (msg->authenticated) seq = &session->recv_seq; else seq = &session->unauth_recv_seq; diff = msg->seq - *seq; if ((diff < -16) || (diff > 15)) { lan->log(INVALID_MSG, msg, "Normal session message failure: SEQ out of range"); return; } /* We wait until after the message is authenticated to set the sequence number, to prevent spoofing. */ if (msg->seq > *seq) *seq = msg->seq; } if (payload_handlers[msg->payload]) payload_handlers[msg->payload](lan, msg); } void ipmi_handle_rmcp_msg(lan_data_t *lan, msg_t *msg) { unsigned char *tsid; unsigned char *tseq; if (msg->len < 9) { lan->log(LAN_ERR, msg, "LAN msg failure: message too short"); return; } tseq = msg->data+0; msg->seq = ipmi_get_uint32(msg->data+0); tsid = msg->data+4; msg->sid = ipmi_get_uint32(msg->data+4); if (msg->authtype != IPMI_AUTHTYPE_NONE) { if (msg->len < 25) { lan->log(LAN_ERR, msg, "LAN msg failure: message too short"); return; } memcpy(msg->authcode_data, msg->data + 8, 16); msg->authcode = msg->authcode_data; msg->data += 24; msg->len -= 24; } else { msg->authcode = NULL; msg->data += 8; msg->len -= 8; } if (msg->len < msg->data[0]) { lan->log(LAN_ERR, msg, "LAN msg failure: Length field invalid"); return; /* The length field is not valid. We allow extra bytes, but reject if not enough. */ } msg->len = msg->data[0]; msg->data++; /* Validate even, non-zero sids here. The odd sids are temporary sessions and get authenticated in that handling. */ if ((msg->sid > 0) && ((msg->sid & 1) == 0)) { /* The "-6, +7" is cheating a little, but we need the last checksum to correctly calculate the code. */ session_t *session = sid_to_session(lan, msg->sid); int rv; int diff; if (session == NULL) { lan->log(INVALID_MSG, msg, "Normal session message failure: Invalid SID"); return; } if (session->rmcpplus) { lan->log(INVALID_MSG, msg, "Normal session message failure:" " RMCP msg on RMCP+ session"); return; } rv = auth_check(session, tsid, tseq, msg->data, msg->len, msg->authcode); if (rv) { lan->log(AUTH_FAILED, msg, "Normal session message failure: auth failure"); return; } /* Check that the session sequence number is valid. We make sure it is within 8 of the last highest received sequence number, per the spec. */ diff = msg->seq - session->recv_seq; if ((diff < -8) || (diff > 8)) { lan->log(INVALID_MSG, msg, "Normal session message failure: SEQ out of range"); return; } /* We wait until after the message is authenticated to set the sequence number, to prevent spoofing. */ if (msg->seq > session->recv_seq) session->recv_seq = msg->seq; } handle_ipmi_payload(lan, msg); } void ipmi_handle_lan_msg(lan_data_t *lan, uint8_t *data, int len, void *from_addr, int from_len) { msg_t msg; msg.src_addr = from_addr; msg.src_len = from_len; msg.oem_data = 0; if (len < 5) { lan->log(LAN_ERR, &msg, "LAN msg failure: message too short"); return; } if (data[2] != 0xff) { lan->log(LAN_ERR, &msg, "LAN msg failure: seq not ff"); return; /* Sequence # must be ff (no ack) */ } msg.authtype = data[4]; msg.data = data+5; msg.len = len - 5; if (msg.authtype == IPMI_AUTHTYPE_RMCP_PLUS) { ipmi_handle_rmcpp_msg(lan, &msg); } else { ipmi_handle_rmcp_msg(lan, &msg); } } void ipmi_handle_smi_rsp(lan_data_t *lan, msg_t *msg, uint8_t *rsp, int rsp_len) { return_rsp_data(lan, msg, NULL, rsp, rsp_len); lan->free(lan, msg); } void ipmi_lan_tick(lan_data_t *lan, unsigned int time_since_last) { int i; msg_t msg; /* A fake message to hold the address. */ for (i=1; i<=MAX_SESSIONS; i++) { if (lan->sessions[i].active) { if (lan->sessions[i].time_left <= time_since_last) { msg.src_addr = lan->sessions[i].src_addr; msg.src_len = lan->sessions[i].src_len; lan->log(SESSION_CLOSED, &msg, "Session closed: Closed due to timeout"); close_session(lan, &(lan->sessions[i])); } else { lan->sessions[i].time_left -= time_since_last; } } } } static int lan_look_for_get_devid(lan_data_t *lan, msg_t *msg, session_t *session, rsp_msg_t *rsp) { if ((rsp->netfn == (IPMI_APP_NETFN | 1)) && (rsp->cmd == IPMI_GET_DEVICE_ID_CMD) && (rsp->data_len >= 12) && (rsp->data[0] == 0)) { lan->oem_handle_rsp = NULL; lan->manufacturer_id = (rsp->data[7] | (rsp->data[8] << 8) | (rsp->data[9] << 16)); lan->product_id = rsp->data[10] | (rsp->data[11] << 8); check_oem_handlers(lan); /* Will be set to 1 if we sent it. */ return msg->oem_data; } return 0; } int ipmi_oem_send_msg(lan_data_t *lan, unsigned char netfn, unsigned char cmd, unsigned char *data, unsigned int len, long oem_data) { msg_t *nmsg; int rv; nmsg = lan->alloc(lan, sizeof(*nmsg)+len); if (!nmsg) { lan->log(OS_ERROR, NULL, "SMI message: out of memory"); return ENOMEM; } memset(nmsg, 0, sizeof(*nmsg)); nmsg->oem_data = oem_data; nmsg->netfn = netfn; nmsg->cmd = cmd; nmsg->data = ((unsigned char *) nmsg) + sizeof(*nmsg); nmsg->len = len; if (len > 0) memcpy(nmsg->data, data, len); rv = lan->smi_send(lan, nmsg); if (rv) { lan->log(OS_ERROR, nmsg, "SMI send: error %d", rv); lan->free(lan, nmsg); } return rv; } int ipmi_lan_init(lan_data_t *lan) { int i; uint8_t challenge_data[16]; for (i=0; i<=MAX_USERS; i++) { lan->users[i].idx = i; } for (i=0; i<=MAX_SESSIONS; i++) { lan->sessions[i].handle = i; } lan->lanparm.num_destinations = 15; for (i=0; i<16; i++) { lan->lanparm.dest[i].addr[0] = i; lan->lanparm.dest[i].type[0] = i; lan->lanparm.dest[i].vlan[0] = i; } lan->lanparm.num_cipher_suites = 15; for (i=0; i<17; i++) lan->lanparm.cipher_suite_entry[i] = i; lan->pef.num_event_filters = MAX_EVENT_FILTERS; for (i=0; ipef.event_filter_table[i][0] = i; lan->pef.event_filter_data1[i][0] = i; } lan->pef.num_alert_policies = MAX_ALERT_POLICIES; for (i=0; ipef.alert_policy_table[i][0] = i; lan->pef.num_alert_strings = MAX_ALERT_STRINGS; for (i=0; ipef.alert_string_keys[i][0] = i; } /* Force user 1 to be a null user. */ memset(lan->users[1].username, 0, 16); i = lan->gen_rand(lan, challenge_data, 16); if (i) return i; i = ipmi_md5_authcode_init(challenge_data, &(lan->challenge_auth), lan, ialloc, ifree); if (i) return i; lan->sid_seq = 0; lan->next_challenge_seq = 0; /* If the calling code already hasn't set up an OEM handler, we set up our own to look for a get device id. When we find a get device ID, we call the OEM code to install their own. */ if (lan->oem_handle_rsp == NULL) { int rv; lan->oem_handle_rsp = lan_look_for_get_devid; /* Send a get device id to the low-level code so we can discover who we are. */ rv = ipmi_oem_send_msg(lan, IPMI_APP_NETFN, IPMI_GET_DEVICE_ID_CMD, NULL, 0, 1); } /* Default the timeout to 30 seconds. */ if (lan->default_session_timeout == 0) lan->default_session_timeout = 30; return 0; } openipmi-2.0.18/lanserv/lanserv_emu.c0000644000175000017500000003320611363572740016550 0ustar chuckchuck/* * lanserv_emu.c * * MontaVista IPMI code for creating a LAN interface to an emulated * SMI interface. * * Author: MontaVista Software, Inc. * Corey Minyard * source@mvista.com * * Copyright 2003,2004,2005 MontaVista Software Inc. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * Lesser General Public License (GPL) Version 2 or the modified BSD * license below. The following disclamer applies to both licenses: * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * GNU Lesser General Public Licence * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Modified BSD Licence * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* Option parsing made easy */ #include #include #include #include #include #include #include "emu.h" #define MAX_ADDR 4 static char *config_file = "/etc/ipmi_lan.conf"; static char *command_string = NULL; static char *command_file = NULL; static int debug = 0; static int port = -1; typedef struct misc_data { int max_fd; int lan_fd[MAX_ADDR]; char *config_file; struct timeval next_tick_time; lan_data_t *lan; } misc_data_t; static void * ialloc(lan_data_t *lan, int size) { return malloc(size); } static void ifree(lan_data_t *lan, void *data) { return free(data); } typedef struct lan_addr_s { struct sockaddr addr; socklen_t addr_len; int xmit_fd; } lan_addr_t; static void lan_send(lan_data_t *lan, struct iovec *data, int vecs, void *addr, int addr_len) { struct msghdr msg; lan_addr_t *l = addr; int rv; /* When we send messages to ourself, we set the address to NULL so it won't be used. */ if (!l) return; msg.msg_name = &(l->addr); msg.msg_namelen = l->addr_len; msg.msg_iov = data; msg.msg_iovlen = vecs; msg.msg_control = NULL; msg.msg_controllen = 0; msg.msg_flags = 0; rv = sendmsg(l->xmit_fd, &msg, 0); if (rv) { /* FIXME - log an error. */ } } static emu_data_t *emu; static int smi_send(lan_data_t *lan, msg_t *msg) { unsigned char data[36]; unsigned int data_len = sizeof(data); ipmi_msg_t imsg; imsg.netfn = msg->netfn; imsg.cmd = msg->cmd; imsg.data = msg->data; imsg.data_len = msg->len; /* LAN is defined to be channel 1. */ ipmi_emu_handle_msg(emu, 1, msg->rs_lun, &imsg, data, &data_len); ipmi_handle_smi_rsp(lan, msg, data, data_len); return 0; } static int gen_rand(lan_data_t *lan, void *data, int len) { int fd = open("/dev/urandom", O_RDONLY); int rv; if (fd == -1) return errno; while (len > 0) { rv = read(fd, data, len); if (rv < 0) { rv = errno; goto out; } len -= rv; } rv = 0; out: close(fd); return rv; } static void handle_msg_lan(int lan_fd, lan_data_t *lan) { int len; lan_addr_t l; unsigned char data[256]; l.addr_len = sizeof(l.addr); len = recvfrom(lan_fd, data, sizeof(data), 0, &(l.addr), &(l.addr_len)); if (len < 0) { if (errno != EINTR) { perror("Error receiving message"); exit(1); } return; } l.xmit_fd = lan_fd; if (len < 4) return; if (data[0] != 6) return; /* Invalid version */ /* Check the message class. */ switch (data[3]) { case 6: handle_asf(lan, data, len, &l, sizeof(l)); break; case 7: ipmi_handle_lan_msg(lan, data, len, &l, sizeof(l)); break; } } static int open_lan_fd(struct sockaddr *addr, socklen_t addr_len) { int fd; int rv; struct sockaddr_in *ipaddr = (struct sockaddr_in *) addr; if (port > 0) ipaddr->sin_port = htons(port); fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fd == -1) { perror("Unable to create socket"); exit(1); } rv = bind(fd, addr, addr_len); if (rv == -1) { fprintf(stderr, "Unable to bind to LAN port: %s\n", strerror(errno)); exit(1); } return fd; } static int cmp_timeval(struct timeval *tv1, struct timeval *tv2) { if (tv1->tv_sec < tv2->tv_sec) return -1; if (tv1->tv_sec > tv2->tv_sec) return 1; if (tv1->tv_usec < tv2->tv_usec) return -1; if (tv1->tv_usec > tv2->tv_usec) return 1; return 0; } static void diff_timeval(struct timeval *dest, struct timeval *left, struct timeval *right) { if ( (left->tv_sec < right->tv_sec) || ( (left->tv_sec == right->tv_sec) && (left->tv_usec < right->tv_usec))) { /* If left < right, just force to zero, don't allow negative numbers. */ dest->tv_sec = 0; dest->tv_usec = 0; return; } dest->tv_sec = left->tv_sec - right->tv_sec; dest->tv_usec = left->tv_usec - right->tv_usec; while (dest->tv_usec < 0) { dest->tv_usec += 1000000; dest->tv_sec--; } } static void lanserv_log(int logtype, msg_t *msg, char *format, ...) { va_list ap; struct timeval tod; struct tm ltime; char timebuf[30]; int timelen; char fullformat[256]; va_start(ap, format); gettimeofday(&tod, NULL); localtime_r(&tod.tv_sec, <ime); asctime_r(<ime, timebuf); timelen = strlen(timebuf); timebuf[timelen-1] = '\0'; /* Nuke the '\n'. */ timelen--; if ((timelen + strlen(format) + 2) >= sizeof(fullformat)) { vprintf(format, ap); } else { strcpy(fullformat, timebuf); strcat(fullformat, ": "); strcat(fullformat, format); vprintf(fullformat, ap); } printf("\n"); va_end(ap); } static struct poptOption poptOpts[]= { { "config-file", 'c', POPT_ARG_STRING, &config_file, 'c', "configuration file", "" }, { "command-string", 'x', POPT_ARG_STRING, &command_string, 'x', "command string", "" }, { "command-file", 'f', POPT_ARG_STRING, &command_file, 'f', "command file", "" }, { "debug", 'd', POPT_ARG_NONE, NULL, 'd', "debug", "" }, { "port", 'p', POPT_ARG_INT, &port, 'p', "port", "" }, POPT_AUTOHELP { NULL, 0, 0, NULL, 0 } }; static void write_config(lan_data_t *lan) { // misc_data_t *info = lan->user_info; } sockaddr_ip_t addr[MAX_ADDR]; socklen_t addr_len[MAX_ADDR]; int num_addr = 0; static char buffer[1024]; static unsigned int pos = 0; static int echo = 1; static void handle_user_char(char c) { switch(c) { case 8: case 0x7f: if (pos > 0) { pos--; if (echo) printf("\b \b"); } break; case 4: if (pos == 0) { if (echo) printf("\n"); ipmi_emu_shutdown(); } break; case 10: case 13: printf("\n"); buffer[pos] = '\0'; if (strcmp(buffer, "noecho") == 0) echo = 0; else ipmi_emu_cmd(emu, buffer); printf("> "); pos = 0; break; default: if (pos >= sizeof(buffer)-1) { printf("\nCommand is too long, max of %d characters\n", (int) sizeof(buffer)-1); } else { buffer[pos] = c; pos++; if (echo) printf("%c", c); } } } static void handle_user_data_ready(void) { char rc; int count; count = read(0, &rc, 1); if (count > 0) handle_user_char(rc); } struct termios old_termios; int old_flags; static void init_term(void) { struct termios new_termios; tcgetattr(0, &old_termios); new_termios = old_termios; new_termios.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON); new_termios.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); tcsetattr(0, TCSADRAIN, &new_termios); } void ipmi_emu_shutdown(void) { tcsetattr(0, TCSADRAIN, &old_termios); fcntl(0, F_SETFL, old_flags); tcdrain(0); exit(0); } /* Sleep and don't take any user input. */ static void sleeper(emu_data_t *emu, struct timeval *time) { misc_data_t *data = ipmi_emu_get_user_data(emu); struct timeval timeout; struct timeval left = *time; struct timeval time_now; int i; int rv; int done_on_timeout = 0; for (;;) { fd_set readfds; fflush(stdout); FD_ZERO(&readfds); for (i=0; ilan_fd[i], &readfds); gettimeofday(&time_now, NULL); diff_timeval(&timeout, &data->next_tick_time, &time_now); if (cmp_timeval(&timeout, &left) < 0) { diff_timeval(&left, &left, &timeout); } else { timeout = left; done_on_timeout = 1; } rv = select(data->max_fd, &readfds, NULL, NULL, &timeout); if ((rv == -1) && (errno == EINTR)) continue; if (rv == 0) { if (done_on_timeout) return; ipmi_lan_tick(data->lan, 1); ipmi_emu_tick(emu, 1); gettimeofday(&data->next_tick_time, NULL); data->next_tick_time.tv_sec += 1; } else { for (i=0; ilan_fd[i], &readfds)) handle_msg_lan(data->lan_fd[i], data->lan); } } } } int main(int argc, const char *argv[]) { lan_data_t lan; misc_data_t data; int rv; int o; int i; poptContext poptCtx; struct timeval timeout; struct timeval time_now; poptCtx = poptGetContext(argv[0], argc, argv, poptOpts, 0); while ((o = poptGetNextOpt(poptCtx)) >= 0) { switch (o) { case 'd': debug++; break; } } data.config_file = config_file; emu = ipmi_emu_alloc(&data, sleeper); memset(&lan, 0, sizeof(lan)); lan.user_info = &data; lan.alloc = ialloc; lan.free = ifree; lan.lan_send = lan_send; lan.smi_send = smi_send; lan.gen_rand = gen_rand; lan.write_config = write_config; lan.log = lanserv_log; lan.debug = debug; num_addr = MAX_ADDR; if (lanserv_read_config(&lan, data.config_file, (sockaddr_ip_t *) addr, addr_len, &num_addr)) exit(1); if (num_addr == 0) { struct sockaddr_in *ipaddr = (void *) &addr[0]; ipaddr->sin_family = AF_INET; if (port > 0) ipaddr->sin_port = htons(port); else ipaddr->sin_port = htons(623); ipaddr->sin_addr.s_addr = INADDR_ANY; addr_len[0] = sizeof(*ipaddr); num_addr++; } for (i=0; i "); data.max_fd = -1; for (i=0; i data.max_fd) data.max_fd = data.lan_fd[i]; } data.max_fd++; if (command_string) { ipmi_emu_cmd(emu, command_string); } if (command_file) read_command_file(emu, command_file); gettimeofday(&data.next_tick_time, NULL); data.next_tick_time.tv_sec += 1; for (;;) { fd_set readfds; fflush(stdout); FD_ZERO(&readfds); FD_SET(0, &readfds); for (i=0; i * source@mvista.com * * Copyright 2003 MontaVista Software Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include typedef struct force_oem_data_s { unsigned char slave_addr; unsigned char curr_addr; } force_oem_data_t; static int force_rsp_handler(lan_data_t *lan, msg_t *msg, session_t *session, rsp_msg_t *rsp) { unsigned char new_addr; if (rsp->netfn == 0x31) { /* A force OEM response. */ force_oem_data_t *fdata = lan->oem_data; switch (rsp->cmd) { case 3: /* A response to a change mode. */ /* Ignore errors. */ if (rsp->data_len < 1) return 0; if (rsp->data[0] != 0) return 0; /* See what it was changed to. */ if (msg->data[0] == 0) /* Changed to master, address is 0x20 */ new_addr = 0x20; else new_addr = fdata->slave_addr; if (new_addr != fdata->curr_addr) { fdata->curr_addr = fdata->slave_addr; lan->log(INFO, NULL, "Change Force MC address to 0x%x", new_addr); if (lan->ipmb_addr_change) lan->ipmb_addr_change(lan, fdata->curr_addr); } break; case 4: /* A request for the IPMB address. */ /* Ignore errors. */ if (rsp->data_len < 4) return 0; if (rsp->data[0] != 0) return 0; fdata->slave_addr = rsp->data[3]; if (fdata->curr_addr != rsp->data[2]) { fdata->curr_addr = rsp->data[2]; if (lan->ipmb_addr_change) lan->ipmb_addr_change(lan, fdata->curr_addr); } return msg->oem_data; } } return 0; } static int force_check_permitted(unsigned char priv, unsigned char netfn, unsigned char cmd) { int req_priv = IPMI_PRIVILEGE_ADMIN; if (netfn != 0x30) return IPMI_PRIV_INVALID; switch (cmd) { case 3: req_priv = IPMI_PRIVILEGE_OPERATOR; break; case 4: req_priv = IPMI_PRIVILEGE_USER; break; case 5: req_priv = IPMI_PRIVILEGE_USER; break; case 6: req_priv = IPMI_PRIVILEGE_OPERATOR; break; } if (priv >= req_priv) return IPMI_PRIV_PERMITTED; else return IPMI_PRIV_DENIED; } static force_oem_data_t force_data = { .slave_addr = 0, .curr_addr = 0, }; static void force_oem_installer(lan_data_t *lan, void *cb_data) { lan->oem_handle_rsp = force_rsp_handler; lan->oem_check_permitted = force_check_permitted; lan->oem_data = &force_data; /* Set a command to get the current address. */ ipmi_oem_send_msg(lan, 0x30, 4, NULL, 0, 1); } static oem_handler_t force_735_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0804, .handler = force_oem_installer, .cb_data = NULL, }; static oem_handler_t force_740_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0808, .handler = force_oem_installer, .cb_data = NULL, }; static oem_handler_t force_786_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0810, .handler = force_oem_installer, .cb_data = NULL, }; static oem_handler_t force_550_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0880, .handler = force_oem_installer, .cb_data = NULL, }; static oem_handler_t force_560_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0888, .handler = force_oem_installer, .cb_data = NULL, }; static oem_handler_t force_690_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0900, .handler = force_oem_installer, .cb_data = NULL, }; static oem_handler_t force_695_oem = { .manufacturer_id = 0x000e48, .product_id = 0x0904, .handler = force_oem_installer, .cb_data = NULL, }; void init_oem_force(void) { ipmi_register_oem(&force_735_oem); ipmi_register_oem(&force_740_oem); ipmi_register_oem(&force_786_oem); ipmi_register_oem(&force_550_oem); ipmi_register_oem(&force_560_oem); ipmi_register_oem(&force_690_oem); ipmi_register_oem(&force_695_oem); } #if 0 /* If you include this as a module under Linux, you can use the following code to initialize it. Otherwise, something has to call init_oem_force(). */ static void (*const __init_patch_debug[1]) \ (void) __attribute__ ((section(".ctors"))) = { init_oem_force }; #endif openipmi-2.0.18/lanserv/README.emulator0000644000175000017500000001777410264775374016616 0ustar chuckchuckThe lanserv_emu program is an IPMI emulator. Command-line parameters are: -c - Use the file as the LAN configuration file (see the ipmilan.8 manual for details on this). -x - Execute the given string at startup. -f - Execute all the commands in the given file. -d - turn debugging on. Once it is up, it acts as an IPMI LAN based system, emulating a lot of commands (but not nearly the whole set yet). However, it comes up empty. You have to execute commands, either at the command line or in a command file, to add the various data you need. Note that there is an atca.emu file included that sets up an ATCA chassis (somewhat incomplete right now). It currently supports: * A BMC just for the connection and SEL at 0x20. * a FRU device at 0x10 * a FRU device at 0x12 There is currently not any IPMB sensor support and many of the commands are not yet implemented, but it's a start. The commands available are: quit - stop the program. sleep

- list the SDRs for the mc. Either gets the main SDR repository or the sensor SDR repository. Response is: MC Name: SDR Record ID: Type: Version: . Data: SDR Record ID: Type: Version: . Data: . . * get_sel_time - Get the time in the SEL for the given MC MC Name: SEL Time: * sel_info - Dump information about the MC's SEL. Response is: SEL Count: SEL Slots Used: * sel * list - list the local copy of the system event log Response is: Domain Name: Entries: Slots in use: Event **EVENT INFO** . . * delete - Delete the given event number from the SEL Response is: Event deleted MC: Record: * add <13 bytes of data> - Add the event data to the SEL. Response is: MC Name: Record ID: * clear - clear the system event log * con * list - List all the connections in the domain. Response is: Domain Name: Connections Name: Name: . . * info Response is: Connection Name: Active: true | false * activate - Activate the given connection Response is: Connection activated: * pet * list - List all the pets in the domain. Response is: Name: Name: . . * info - Dump information about a pet. Response is: PET MC: Channel: IP Address: MAC Address: EFT Selector: Policy Number: APT Selector: LAN Dest Selector: * new - Set up the domain to send PET traps from the given connection to the given IP/MAC address over the given channel. Response is: PET Created: * mcnew - Set up the domain to send PET traps from the given connection to the given IP/MAC address over the given channel. This takes an MC instead of a connection. Response is: PET Created: * close - Close the pet. PET destroyed: * pef - commands dealing with platform even filters. These are basically connections to the PEF configuration parameters in an MC. You use a pef to fetch a pef config, which you can then modify and write back to the MC. Note that when you get a pef config, you claim a lock on the MC that must be unlocked. * list - List all the pefs that currently exist in the domain. Response is: Name: Name: . . * info - Dump info about the pef. Response is: PEF Name: MC: * new - Create a pef for the given MC. Response is: PEF: * unlock_mc - Unlock the PEF lock on the given MC. Response is: PEF unlocked: * close - Free the given pef PEF destroyed: * config - commands dealing with PEF configurations. These are the actual PEF data items. * list - list all the PEF configs Response is: PEFs Name: Name: . . * info - Dump information about the pef config. Response is: PEF Config Name: ** PEF CONFIG ** * get - Fetch the pef data items from the pef and create a pef config. Response is: PEF Config Name: ** PEF CONFIG ** * update [selector] - Set the given parameter in the pef config to the given value. If the parameter has a selector of some type, the selector must be given, otherwise no selector should be given. Response is: PEF config updated: * set - Write the pef data back to the pef. Note that this must be the same pef used to create the config. Response is: PEF config set: * unlock - Unlock the lock in the MC and mark the pef config as unlocked. Response is: PEF config unlocked: * close - Free the pef config. PEF config destroyed: * lanparm - commands dealing with lanparms. These are basically connections to the LAN configuration parameters in an MC. You use a lanparm to fetch a lanparm config, which you can then modify and write back to the MC. Note that when you get a lanparm config, you claim a lock on the MC that must be unlocked. * list - List all the lanparms that currently exist in the domain. Response is: Domain Name: LANPARMs Name: Name: . . * info - Dump info about the lanparm. Response is: LANPARM Name: MC: Channel: * new - Create a lanparm for the given MC and channel. Response is: LANPARM: * unlock_mc - Unlock the lanparm lock on the given MC and channel. Response is: LANPARM unlocked: * close - Free the given lanparm Response is: LANPARM destroyed: * config - commands dealing with lanparm configurations. These are the actual lanparm data items. * list - list all the lanparm configs Response is: LANPARMS Name: Name: . . * info - Dump information about the lanparm config. Response is: LANPARM Config Name: ** LANPARM CONFIG ** * get - Fetch the lanparm data items from the lanparm and create a lanparm config. Response is: LANPARM Config Name: ** LANPARM CONFIG ** * set - Write the lanparm data back to the lanparm. Note that this must be the same lanparm used to create the config. Response is: LANPARM config set: * unlock - Unlock the lock in the MC and mark the lanparm config as unlocked. Response is: LANPARM config unlocked: * close - Free the lanparm config. Response is: LANPARM config destroyed: * general * evinfo true | false - Turn on or off dumping object information when an event comes in. This is false by default. * debug on|off - Turn the given debugging type on or off EVENTS ====== The command language will output events to the console when they happen. Events all occur in the format: Event **EVENT INFO** The event info varies on the type of events. The defined events are listed. The following event is output when the domain is completely up and operational and finished all it SDR, FRU, and bus scans: EVENT Object Type: Domain Name: Operation: Domain fully up Connection Number: Port Number: Any Connection Up: true | false Error: The following comes out when domain connection infomration changes: EVENT Object Type: Domain Name: Operation: Connection Change The following comes out when domains are added: EVENT Object Type: Domain Name: Operation: Add %**DOMAIN INFO** The following comes out when domains are destroyed: EVENT Object Type: Domain Name: Operation: Delete The following comes out when the domain gets an event that does not have a handler: EVENT Object Type: Event **EVENT INFO** The following comes out when an entity is added: EVENT Object Type: Entity Name: Operation: Add %**ENTITY INFO** The following comes out when an entity is deleted: EVENT Object Type: Entity Name: Operation: Delete The following comes out when an entity is changed: EVENT Object Type: Entity Name: Operation: Change %**ENTITY INFO** The following comes out when an entity's FRU is added: EVENT Object Type: Entity FRU Name: Operation: Add %**FRU INFO** The following comes out when an entity's FRU is deleted: EVENT Object Type: Entity FRU Name: Operation: Delete The following comes out when an entity's FRU is changed: EVENT Object Type: Entity FRU Name: Operation: Change %**FRU INFO** The following comes out when an entity's presence changes: EVENT Object Type: Entity Name: Operation: Presence Change Present: true | false %Event **EVENT INFO** The following comes out when an entity's hot-swap state changes: EVENT Object Type: Entity Name: Operation: Hot-Swap Change Last State: not_present | inactive | activation_requested | activation_in_progress | active | deactivation_requested | deactivation_in_progress | out_of_con State: not_present | inactive | activation_requested | activation_in_progress | active | deactivation_requested | deactivation_in_progress | out_of_con %Event **EVENT INFO** The following comes out when a discrete sensor gets an event: EVENT Object Type: Sensor Name: Operation: Event Offset: Direction: assertion | deassertion Severity: Previous Severity: %Event **EVENT INFO** The following comes out when a threshold sensor gets an event: EVENT Object Type: Sensor Name: Operation: Event Threshold: lower non critical | lower critical | lower non recoverable | upper non critical | upper critical | upper non recoverable High/Low: going high | going low Direction: assertion | deassertion %Value: %Raw Value: %Event **EVENT INFO** The following comes out when a sensor is added: EVENT Object Type: Sensor Name: Operation: Add %**SENSOR INFO** The following comes out when a sensor is deleted: EVENT Object Type: Sensor Name: Operation: Delete The following comes out when a sensor is changed: EVENT Object Type: Sensor Name: Operation: Change %**SENSOR INFO** The following comes out when a control gets an event: EVENT Object Type: Control Name: Operation: Event Value Number: Value: %Event **EVENT INFO** The following comes out when a control is added: EVENT Object Type: Control Name: Operation: Add %**CONTROL INFO** The following comes out when a control is deleted: EVENT Object Type: Control Name: Operation: Delete The following comes out when a control is changed: EVENT Object Type: Control Name: Operation: Change %**CONTROL INFO** OBJECT INFO =========== **EVENT INFO** MC: Record ID: Event type: Timestamp: Data: **DOMAIN INFO** Type: SEL Rescan Time: